diff options
Diffstat (limited to 'movement/watch_faces')
-rw-r--r-- | movement/watch_faces/clock/simple_clock_face.c | 20 | ||||
-rw-r--r-- | movement/watch_faces/clock/simple_clock_face.h | 1 |
2 files changed, 18 insertions, 3 deletions
diff --git a/movement/watch_faces/clock/simple_clock_face.c b/movement/watch_faces/clock/simple_clock_face.c index 23f36672..7721b12a 100644 --- a/movement/watch_faces/clock/simple_clock_face.c +++ b/movement/watch_faces/clock/simple_clock_face.c @@ -27,6 +27,12 @@ #include "watch.h" #include "watch_utility.h" +static void _update_alarm_indicator(bool settings_alarm_enabled, simple_clock_state_t *state) { + state->alarm_enabled = settings_alarm_enabled; + if (state->alarm_enabled) watch_set_indicator(WATCH_INDICATOR_SIGNAL); + else watch_clear_indicator(WATCH_INDICATOR_SIGNAL); +} + void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) { (void) settings; (void) watch_face_index; @@ -45,7 +51,13 @@ void simple_clock_face_activate(movement_settings_t *settings, void *context) { if (watch_tick_animation_is_running()) watch_stop_tick_animation(); if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H); - if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_SIGNAL); + + // handle chime indicator + if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL); + else watch_clear_indicator(WATCH_INDICATOR_BELL); + + // show alarm indicator if there is an active alarm + _update_alarm_indicator(settings->bit.alarm_enabled, state); watch_set_colon(); @@ -111,6 +123,8 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting } } watch_display_string(buf, pos); + // handle alarm indicator + if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state); break; case EVENT_MODE_BUTTON_UP: movement_move_to_next_face(); @@ -120,8 +134,8 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting break; case EVENT_ALARM_LONG_PRESS: state->signal_enabled = !state->signal_enabled; - if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_SIGNAL); - else watch_clear_indicator(WATCH_INDICATOR_SIGNAL); + if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL); + else watch_clear_indicator(WATCH_INDICATOR_BELL); break; case EVENT_BACKGROUND_TASK: // uncomment this line to snap back to the clock face when the hour signal sounds: diff --git a/movement/watch_faces/clock/simple_clock_face.h b/movement/watch_faces/clock/simple_clock_face.h index aa625700..1e9babad 100644 --- a/movement/watch_faces/clock/simple_clock_face.h +++ b/movement/watch_faces/clock/simple_clock_face.h @@ -33,6 +33,7 @@ typedef struct { uint8_t watch_face_index; bool signal_enabled; bool battery_low; + bool alarm_enabled; } simple_clock_state_t; void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr); |