isolating this bit of complexity in movement function; Add ifdefs in clock faces for DCE

This commit is contained in:
David Volovskiy
2024-07-10 07:22:55 -04:00
parent 7f6a9e5c9b
commit 2afc2c6721
3 changed files with 19 additions and 6 deletions

View File

@@ -53,7 +53,11 @@ typedef struct {
} clock_state_t;
static bool clock_is_in_24h_mode(movement_settings_t *settings) {
#ifdef CLOCK_FACE_24H_ONLY
return true;
#else
return settings->bit.clock_mode_24h;
#endif
}
static void clock_indicate(WatchIndicatorSegment indicator, bool on) {

View File

@@ -51,7 +51,11 @@ void simple_clock_face_activate(movement_settings_t *settings, void *context) {
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
#ifdef CLOCK_FACE_24H_ONLY
watch_set_indicator(WATCH_INDICATOR_24H);
#else
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
#endif
// handle chime indicator
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
@@ -106,6 +110,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
} else {
// other stuff changed; let's do it all.
#ifndef CLOCK_FACE_24H_ONLY
if (!settings->bit.clock_mode_24h) {
// if we are in 12 hour mode, do some cleanup.
if (date_time.unit.hour < 12) {
@@ -116,6 +121,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
date_time.unit.hour %= 12;
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
}
#endif
pos = 0;
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
if (!watch_tick_animation_is_running()) watch_start_tick_animation(500);