summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>2024-02-25 14:10:04 -0300
committerMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>2024-02-25 15:24:15 -0300
commit2df6b2879ad134a56b8486b7224f866c689876cd (patch)
treec8663505e79e0b041bd475e2548af4bb5a6d4ec6
parent1e2c23cf13530597b48b838c94dd7711cda8a095 (diff)
downloadSensor-Watch-2df6b2879ad134a56b8486b7224f866c689876cd.tar.gz
Sensor-Watch-2df6b2879ad134a56b8486b7224f866c689876cd.tar.bz2
Sensor-Watch-2df6b2879ad134a56b8486b7224f866c689876cd.zip
faces/clock: refactor time signal toggling code
Simplifies the code by defining dedicated functions for this.
-rw-r--r--movement/watch_faces/clock/clock_face.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/movement/watch_faces/clock/clock_face.c b/movement/watch_faces/clock/clock_face.c
index 7e4ec816..f6c3f3f4 100644
--- a/movement/watch_faces/clock/clock_face.c
+++ b/movement/watch_faces/clock/clock_face.c
@@ -101,6 +101,11 @@ static void clock_indicate_low_available_power(clock_state_t *clock) {
clock_indicate(WATCH_INDICATOR_LAP, clock->battery_low);
}
+static void clock_toggle_time_signal(clock_state_t *clock) {
+ clock->time_signal_enabled = !clock->time_signal_enabled;
+ clock_indicate_time_signal(clock);
+}
+
static void clock_display_all(watch_date_time date_time) {
char buf[10 + 1];
@@ -240,8 +245,7 @@ bool clock_face_loop(movement_event_t event, movement_settings_t *settings, void
break;
case EVENT_ALARM_LONG_PRESS:
- state->time_signal_enabled = !state->time_signal_enabled;
- clock_indicate_time_signal(state);
+ clock_toggle_time_signal(state);
break;
case EVENT_BACKGROUND_TASK:
// uncomment this line to snap back to the clock face when the hour signal sounds: