mirror of
https://github.com/joeycastillo/second-movement.git
synced 2025-10-29 19:47:40 +00:00
Tally face port (#38)
* Moved tally face over * Bugfix on tally_face_should_move_back * changed watch_display_text logic * Negative numbers don't appear small * remove tally face from movement_config.h
This commit is contained in:
parent
a729f04f13
commit
4e710066b9
@ -59,5 +59,6 @@
|
|||||||
#include "periodic_table_face.h"
|
#include "periodic_table_face.h"
|
||||||
#include "squash_face.h"
|
#include "squash_face.h"
|
||||||
#include "totp_face.h"
|
#include "totp_face.h"
|
||||||
|
#include "tally_face.h"
|
||||||
#include "probability_face.h"
|
#include "probability_face.h"
|
||||||
// New includes go above this line.
|
// New includes go above this line.
|
||||||
|
|||||||
@ -15,6 +15,7 @@ SRCS += \
|
|||||||
./watch-faces/complication/breathing_face.c \
|
./watch-faces/complication/breathing_face.c \
|
||||||
./watch-faces/complication/squash_face.c \
|
./watch-faces/complication/squash_face.c \
|
||||||
./watch-faces/complication/totp_face.c \
|
./watch-faces/complication/totp_face.c \
|
||||||
|
./watch-faces/complication/tally_face.c \
|
||||||
./watch-faces/demo/all_segments_face.c \
|
./watch-faces/demo/all_segments_face.c \
|
||||||
./watch-faces/demo/character_set_face.c \
|
./watch-faces/demo/character_set_face.c \
|
||||||
./watch-faces/demo/light_sensor_face.c \
|
./watch-faces/demo/light_sensor_face.c \
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* MIT License
|
* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (c) 2022 Andrew Mike
|
* Copyright (c) 2022-2025 Andrew Mike and David Volovskiy
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -28,7 +28,7 @@
|
|||||||
#include "watch.h"
|
#include "watch.h"
|
||||||
|
|
||||||
#define TALLY_FACE_MAX 9999
|
#define TALLY_FACE_MAX 9999
|
||||||
#define TALLY_FACE_MIN -99
|
#define TALLY_FACE_MIN -999
|
||||||
|
|
||||||
static bool _init_val;
|
static bool _init_val;
|
||||||
static bool _quick_ticks_running;
|
static bool _quick_ticks_running;
|
||||||
@ -104,7 +104,6 @@ static void tally_face_decrement(tally_state_t *state, bool sound_on) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool tally_face_should_move_back(tally_state_t *state) {
|
static bool tally_face_should_move_back(tally_state_t *state) {
|
||||||
if (TALLY_FACE_PRESETS_SIZE() <= 1) { return false; }
|
|
||||||
return state->tally_idx == _tally_default[state->tally_default_idx];
|
return state->tally_idx == _tally_default[state->tally_default_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,16 +194,14 @@ bool tally_face_loop(movement_event_t event, void *context) {
|
|||||||
|
|
||||||
// print tally index at the center of display.
|
// print tally index at the center of display.
|
||||||
void print_tally(tally_state_t *state, bool sound_on) {
|
void print_tally(tally_state_t *state, bool sound_on) {
|
||||||
char buf[14];
|
char buf[6];
|
||||||
if (sound_on)
|
if (sound_on)
|
||||||
watch_set_indicator(WATCH_INDICATOR_BELL);
|
watch_set_indicator(WATCH_INDICATOR_BELL);
|
||||||
else
|
else
|
||||||
watch_clear_indicator(WATCH_INDICATOR_BELL);
|
watch_clear_indicator(WATCH_INDICATOR_BELL);
|
||||||
if (state->tally_idx >= 0)
|
watch_display_text_with_fallback(WATCH_POSITION_TOP, "TALLY", "TA");
|
||||||
sprintf(buf, "TA %4d ", (int)(state->tally_idx)); // center of LCD display
|
sprintf(buf, "%4d", (int)(state->tally_idx));
|
||||||
else
|
watch_display_text(WATCH_POSITION_BOTTOM, buf);
|
||||||
sprintf(buf, "TA %-3d", (int)(state->tally_idx)); // center of LCD display
|
|
||||||
watch_display_string(buf, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tally_face_resign(void *context) {
|
void tally_face_resign(void *context) {
|
||||||
Loading…
x
Reference in New Issue
Block a user