]> git.earman.xyz Git - sensor-watch.git/commitdiff
faces/simple_clock: clear segments if not in 024h
authorMatheus Afonso Martins Moreira <matheus@matheusmoreira.com>
Mon, 16 Sep 2024 17:50:42 +0000 (14:50 -0300)
committerMatheus Afonso Martins Moreira <matheus@matheusmoreira.com>
Mon, 16 Sep 2024 18:53:48 +0000 (15:53 -0300)
There was an issue where the simple clock's display would remain in
024h mode even after switching back to 12h/24h mode because it only
took into account the leading zero bit, whose value is meaningless
unless the 24h mode bit is also set.

The issue is fixed by taking both bits into account.

Closes #476.

Reported-by: CarpeNoctem <cryptomax@pm.me>
GitHub-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/476

movement/watch_faces/clock/simple_clock_face.c

index fe46077d08e5517b7a816fbbcf255d5ff25224c8..68e1ccde0e98a595ceb98f2c1fc715cabafa9893 100644 (file)
@@ -124,7 +124,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
                 }
 #endif
 
-                if (settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
+                if (settings->bit.clock_mode_24h && settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
                     set_leading_zero = true;
                 }
 
@@ -137,8 +137,10 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
                 }
             }
             watch_display_string(buf, pos);
+
             if (set_leading_zero)
                 watch_display_string("0", 4);
+
             // handle alarm indicator
             if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
             break;