diff options
author | Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> | 2024-02-24 22:38:28 -0300 |
---|---|---|
committer | Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> | 2024-02-25 15:24:14 -0300 |
commit | e7052fe4e27361dce45a3eff4ee1f7c21f69aca2 (patch) | |
tree | bade0bd78f4ee5d7c2b8ef58655890a9006338cd /movement/watch_faces | |
parent | 0773439a4930f644924c10d42786aaa20b3060bd (diff) | |
download | Sensor-Watch-e7052fe4e27361dce45a3eff4ee1f7c21f69aca2.tar.gz Sensor-Watch-e7052fe4e27361dce45a3eff4ee1f7c21f69aca2.tar.bz2 Sensor-Watch-e7052fe4e27361dce45a3eff4ee1f7c21f69aca2.zip |
faces/clock: simplify LAP indication function
Simplifies the code by adding a dedicated function for this.
Also documents the meaning of the LAP indicator: Low Available Power.
Diffstat (limited to 'movement/watch_faces')
-rw-r--r-- | movement/watch_faces/clock/clock_face.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/movement/watch_faces/clock/clock_face.c b/movement/watch_faces/clock/clock_face.c index 537104a4..08007a89 100644 --- a/movement/watch_faces/clock/clock_face.c +++ b/movement/watch_faces/clock/clock_face.c @@ -94,6 +94,11 @@ static void clock_check_battery_periodically(clock_state_t *clock, watch_date_ti clock->battery_low = voltage < CLOCK_FACE_LOW_BATTERY_VOLTAGE_THRESHOLD; } +static void clock_indicate_low_available_power(clock_state_t *clock) { + // Set the LAP indicator if battery power is low + clock_indicate(WATCH_INDICATOR_LAP, clock->battery_low); +} + void clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) { (void) settings; (void) watch_face_index; @@ -137,9 +142,7 @@ bool clock_face_loop(movement_event_t event, movement_settings_t *settings, void state->previous_date_time = date_time.reg; clock_check_battery_periodically(state, date_time); - - // Set the LAP indicator if battery power is low - if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP); + clock_indicate_low_available_power(state); if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) { // everything before seconds is the same, don't waste cycles setting those segments. |