]> git.earman.xyz Git - sensor-watch.git/commitdiff
refactor movement's 24h mode to a function call
authorjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 12:02:20 +0000 (08:02 -0400)
committerjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 12:02:20 +0000 (08:02 -0400)
27 files changed:
movement.c
movement.h
movement/watch_faces/clock/clock_face.c
movement/watch_faces/clock/close_enough_clock_face.c
movement/watch_faces/clock/french_revolutionary_face.c
movement/watch_faces/clock/minimal_clock_face.c
movement/watch_faces/clock/minute_repeater_decimal_face.c
movement/watch_faces/clock/repetition_minute_face.c
movement/watch_faces/clock/simple_clock_bin_led_face.c
movement/watch_faces/clock/weeknumber_clock_face.c
movement/watch_faces/clock/world_clock2_face.c
movement/watch_faces/complication/activity_face.c
movement/watch_faces/complication/alarm_face.c
movement/watch_faces/complication/deadline_face.c
movement/watch_faces/complication/endless_runner_face.c
movement/watch_faces/complication/planetary_hours_face.c
movement/watch_faces/complication/planetary_time_face.c
movement/watch_faces/complication/solstice_face.c
movement/watch_faces/complication/sunrise_sunset_face.c
movement/watch_faces/complication/wake_face.c
movement/watch_faces/demo/lis2dw_logging_face.c
movement/watch_faces/sensor/thermistor_logging_face.c
movement/watch_faces/settings/set_time_hackwatch_face.c
watch-faces/clock/simple_clock_face.c
watch-faces/clock/world_clock_face.c
watch-faces/settings/preferences_face.c
watch-faces/settings/set_time_face.c

index d343961b4a3ef26e5628f53dbd37ddbeda1d60f8..344522375dde516f71d6c19431d1085fe2b0d3fd 100644 (file)
@@ -337,6 +337,14 @@ void movement_set_button_should_sound(bool value) {
     movement_state.settings.bit.button_should_sound = value;
 }
 
+movement_clock_mode_t movement_clock_mode_24h(void) {
+    return movement_state.settings.bit.clock_mode_24h ? MOVEMENT_CLOCK_MODE_24H : MOVEMENT_CLOCK_MODE_12H;
+}
+
+void movement_set_clock_mode_24h(movement_clock_mode_t value) {
+    movement_state.settings.bit.clock_mode_24h = (value == MOVEMENT_CLOCK_MODE_24H);
+}
+
 void app_init(void) {
     _watch_init();
 
index 661373cb693314a029720731b0de62aa4c2f698e..a071f94ed55350f6bca8f95dee2e760cdd2f73f1 100644 (file)
 //   stuff we'll want to make available to all watch faces and stash in the BKUP[3] register.
 // This allows these preferences to be stored before entering BACKUP mode and and restored after waking from reset.
 
+typedef enum {
+    MOVEMENT_CLOCK_MODE_12H = 0,
+    MOVEMENT_CLOCK_MODE_24H,
+    MOVEMENT_NUM_CLOCK_MODES
+} movement_clock_mode_t;
+
 // movement_settings_t contains global settings that cover watch behavior, including preferences around clock and unit
 // display, time zones, buzzer behavior, LED color and low energy mode timeouts.
 typedef union {
@@ -321,3 +327,6 @@ int32_t movement_get_current_timezone_offset(void);
 
 bool movement_button_should_sound(void);
 void movement_set_button_should_sound(bool value);
+
+movement_clock_mode_t movement_clock_mode_24h(void);
+void movement_set_clock_mode_24h(movement_clock_mode_t value);
index 4de602b04c83a8b2c92ce94263627d885e3b9e23..64a2bcd88fc9ac1b2b79aaedecdd6fd5782c17b6 100644 (file)
@@ -53,11 +53,7 @@ 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
+    return movement_clock_mode_24h();
 }
 
 static bool clock_should_set_leading_zero(movement_settings_t *settings) {
@@ -89,7 +85,7 @@ static bool clock_is_pm(watch_date_time date_time) {
 }
 
 static void clock_indicate_pm(movement_settings_t *settings, watch_date_time date_time) {
-    if (settings->bit.clock_mode_24h) { return; }
+    if (movement_clock_mode_24h()) { return; }
     clock_indicate(WATCH_INDICATOR_PM, clock_is_pm(date_time));
 }
 
index cbd62e2767187e8ef48f45db53897a160758b708..0ca4b8092d6d7d7e5afacdfa7f2bd2b570ef167a 100644 (file)
@@ -77,7 +77,7 @@ void close_enough_clock_face_activate(movement_settings_t *settings, void *conte
         watch_stop_tick_animation();
     }
 
-    if (settings->bit.clock_mode_24h) {
+    if (movement_clock_mode_24h()) {
         watch_set_indicator(WATCH_INDICATOR_24H);
     }
 
@@ -155,7 +155,7 @@ bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *s
                 close_enough_hour = (close_enough_hour + 1) % 24;
             }
 
-            if (!settings->bit.clock_mode_24h) {
+            if (!movement_clock_mode_24h()) {
                 // if we are in 12 hour mode, do some cleanup.
                 if (close_enough_hour < 12) {
                     watch_clear_indicator(WATCH_INDICATOR_PM);
index da94fc978e71ea9ca823af506c69fc5a9ec9ba99..34ef6f1e6a5feb14a2804209725a2b252576d5f3 100644 (file)
@@ -102,7 +102,7 @@ bool french_revolutionary_face_loop(movement_event_t event, movement_settings_t
             else { watch_display_string("--", 8); }
             break;
         case EVENT_LIGHT_LONG_PRESS:
-            // In case anyone really wants that upper time in 12-hour format. I thought about using the global setting (settings->bit.clock_mode_24h)
+            // In case anyone really wants that upper time in 12-hour format. I thought about using the global setting (movement_clock_mode_24h())
             // for this preference, but thought someone who prefers 12-hour format normally, might prefer 24hr when compared to a 10hr decimal day,
             // so this is separate for now.
             state->use_am_pm = !state->use_am_pm;
index fa4880e1fa6c4ee60b4cd79f1189a65a54dd26be..03ea6c41f69d3dc0f985ea5b123f1b4df488d69d 100644 (file)
@@ -30,7 +30,7 @@ static void _minimal_clock_face_update_display(movement_settings_t *settings) {
     watch_date_time date_time = watch_rtc_get_date_time();
     char buffer[11];
 
-    if (!settings->bit.clock_mode_24h) {
+    if (!movement_clock_mode_24h()) {
         date_time.unit.hour %= 12;
         sprintf(buffer, "%2d%02d  ", date_time.unit.hour, date_time.unit.minute);
     } else {
index 2cedc3075b5d3dae210a71acdd16769b92ace4e8..8a745e3e214499ad515ab7ca0cb3cac4991d8260 100644 (file)
@@ -83,7 +83,7 @@ void minute_repeater_decimal_face_activate(movement_settings_t *settings, void *
 
     if (watch_tick_animation_is_running()) watch_stop_tick_animation();
 
-    if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
+    if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
     // handle chime indicator
     if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
@@ -138,7 +138,7 @@ bool minute_repeater_decimal_face_loop(movement_event_t event, movement_settings
                 sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
             } else {
                 // other stuff changed; let's do it all.
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     // if we are in 12 hour mode, do some cleanup.
                     if (date_time.unit.hour < 12) {
                         watch_clear_indicator(WATCH_INDICATOR_PM);
@@ -183,7 +183,7 @@ bool minute_repeater_decimal_face_loop(movement_event_t event, movement_settings
             int minutes = date_time.unit.minute % 10;
 
             // chiming hours
-            if (!settings->bit.clock_mode_24h) {
+            if (!movement_clock_mode_24h()) {
                 hours = date_time.unit.hour % 12;                
                 if (hours == 0) hours = 12;
             }
index e9e5e3197507fd99296498205f063da1c8249482..27c2346c95fcb11e66127a3934f4eb5af6a84ae0 100644 (file)
@@ -68,7 +68,7 @@ void repetition_minute_face_activate(movement_settings_t *settings, void *contex
 
     if (watch_tick_animation_is_running()) watch_stop_tick_animation();
 
-    if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
+    if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
     // handle chime indicator
     if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
@@ -123,7 +123,7 @@ bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *se
                 sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
             } else {
                 // other stuff changed; let's do it all.
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     // if we are in 12 hour mode, do some cleanup.
                     if (date_time.unit.hour < 12) {
                         watch_clear_indicator(WATCH_INDICATOR_PM);
@@ -170,7 +170,7 @@ bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *se
             int minutes = date_time.unit.minute % 15;
 
             // chiming hours
-            if (!settings->bit.clock_mode_24h) {
+            if (!movement_clock_mode_24h()) {
                 hours = date_time.unit.hour % 12;                
                 if (hours == 0) hours = 12;
             }
index cf39c1886bb8aa8908a2a47b91a494f9a967e2bf..263efedbcf11ae9b54dcf8a94e6a0d232d5d43b8 100644 (file)
@@ -60,7 +60,7 @@ void simple_clock_bin_led_face_activate(movement_settings_t *settings, void *con
 
     if (watch_tick_animation_is_running()) watch_stop_tick_animation();
 
-    if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
+    if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
     // handle chime indicator
     if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
@@ -149,7 +149,7 @@ bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t
                     sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
                 } else {
                     // other stuff changed; let's do it all.
-                    if (!settings->bit.clock_mode_24h) {
+                    if (!movement_clock_mode_24h()) {
                         // if we are in 12 hour mode, do some cleanup.
                         if (date_time.unit.hour < 12) {
                             watch_clear_indicator(WATCH_INDICATOR_PM);
@@ -187,7 +187,7 @@ bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t
                 date_time = watch_rtc_get_date_time();
                 state->flashing_state = 1 + 128;
                 state->ticks = 4;
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     date_time.unit.hour %= 12;
                     if (date_time.unit.hour == 0) date_time.unit.hour = 12;
                 }
index 81df58475ba962dcea335112280e891d76927f7e..9941858ca265de7137697c25b6e3e3214dcd32f9 100644 (file)
@@ -50,7 +50,7 @@ void weeknumber_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 (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
     // handle chime indicator
     if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
@@ -100,7 +100,7 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
                 sprintf(buf, "%02d%02d", date_time.unit.minute, watch_utility_get_weeknumber(date_time.unit.year, date_time.unit.month, date_time.unit.day));
             } else {
                 // other stuff changed; let's do it all.
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     // if we are in 12 hour mode, do some cleanup.
                     if (date_time.unit.hour < 12) {
                         watch_clear_indicator(WATCH_INDICATOR_PM);
index b678bdd99fa83f69843489a0a1e81dfd96217176..7fa86d281a0fa5ab732f3d08c7e5b47d59da89a1 100644 (file)
@@ -174,7 +174,7 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
            if (refresh_face) {
                watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
                watch_set_colon();
-                if (settings->bit.clock_mode_24h)
+                if (movement_clock_mode_24h())
                     watch_set_indicator(WATCH_INDICATOR_24H);
 
                 state->previous_date_time = REFRESH_TIME;
@@ -198,7 +198,7 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
                sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
            } else {
                /* Other stuff changed; Let's do it all. */
-               if (!settings->bit.clock_mode_24h) {
+               if (!movement_clock_mode_24h()) {
                    /* If we are in 12 hour mode, do some cleanup. */
                    if (date_time.unit.hour < 12) {
                        watch_clear_indicator(WATCH_INDICATOR_PM);
index 136352f78f2aeb536352db48b9cd6b9cbcf68cb6..c7399c2d32cdd07792731c2865739a723a6de79d 100644 (file)
@@ -296,7 +296,7 @@ static void _activity_update_logging_screen(movement_settings_t *settings, activ
         watch_clear_indicator(WATCH_INDICATOR_LAP);
         watch_date_time now = watch_rtc_get_date_time();
         uint8_t hour = now.unit.hour;
-        if (!settings->bit.clock_mode_24h) {
+        if (!movement_clock_mode_24h()) {
             watch_clear_indicator(WATCH_INDICATOR_24H);
             if (hour < 12)
                 watch_clear_indicator(WATCH_INDICATOR_PM);
index 6a949cba8536e6e4d164ef7cd94551a61c3ec61b..a123f0e07a8a76f850ba53af09255fbf51b9b9c8 100644 (file)
@@ -73,7 +73,7 @@ static void _alarm_face_draw(movement_settings_t *settings, alarm_state_t *state
     }
     //handle am/pm for hour display
     uint8_t h = state->alarm[state->alarm_idx].hour;
-    if (!settings->bit.clock_mode_24h) {
+    if (!movement_clock_mode_24h()) {
         if (h >= 12) {
             watch_set_indicator(WATCH_INDICATOR_PM);
             h %= 12;
index c30229c13b2340168532079d9f34e17e14793d20..8e2f41ea569995a9c8a06d98fe1eb4013716dafa 100644 (file)
@@ -448,7 +448,7 @@ static void _setting_display(movement_event_t event, movement_settings_t *settin
     int i = state->current_index + 1;
     if (state->current_page > 2) {
         watch_set_colon();
-        if (settings->bit.clock_mode_24h) {
+        if (movement_clock_mode_24h()) {
             watch_set_indicator(WATCH_INDICATOR_24H);
             sprintf(buf, "%s%2d%2d%02d  ", settings_titles[state->current_page], i, date_time.unit.hour, date_time.unit.minute);
         } else {
index 3509fc229443f68565a267b9cc33cfd8b0a3677b..6d8b4873e8b029678cfb94a43708acc14e45e501 100644 (file)
@@ -602,7 +602,7 @@ bool endless_runner_face_loop(movement_event_t event, movement_settings_t *setti
                 display_title(state);
             break;
         case EVENT_LOW_ENERGY_UPDATE:
-            display_time(watch_rtc_get_date_time(), settings->bit.clock_mode_24h);
+            display_time(watch_rtc_get_date_time(), movement_clock_mode_24h());
             break;
         default:
             return movement_default_loop_handler(event, settings);
index acded9175a6276de8e25a99c3ce7670097520cb6..7c00449123373ca7c451394c18107e8c79f6f432 100644 (file)
@@ -253,7 +253,7 @@ static void _planetary_hours(movement_settings_t *settings, planetary_hours_stat
         return;
     }
 
-    if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
+    if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
     // roll over hour iterator
     if ( state->hour < 0 ) state->hour = 23;
@@ -305,7 +305,7 @@ static void _planetary_hours(movement_settings_t *settings, planetary_hours_stat
     else if ( scratch_time.unit.minute < 59 ) scratch_time.unit.minute++;
 
     // if we are in 12 hour mode, do some cleanup
-    if (!settings->bit.clock_mode_24h) {
+    if (!movement_clock_mode_24h()) {
         if (scratch_time.unit.hour < 12) {
             watch_clear_indicator(WATCH_INDICATOR_PM);
         } else {
index 56a18cf2289aa7b734d2fbd781e0f638b41cfb79..227f68d4abcef586e35e4d02c2787f9392d45209 100644 (file)
@@ -218,11 +218,11 @@ static void _planetary_time(movement_event_t event, movement_settings_t *setting
         return;
     }
 
-    if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
+    if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
     // PM for night hours, otherwise the night hours are counted from 13
     if ( state->night ) {
-        if (settings->bit.clock_mode_24h) night_hour_count = 12;
+        if (movement_clock_mode_24h()) night_hour_count = 12;
         else watch_set_indicator(WATCH_INDICATOR_PM);
     }
 
index e74f8789d160501e205b36ccd65a1bca76dc135b..c31223e97a645f13c27f5283dc1f71109516712d 100644 (file)
@@ -165,7 +165,7 @@ static void show_main_screen(solstice_state_t *state) {
 static void show_date_time(movement_settings_t *settings, solstice_state_t *state) {
     char buf[11];
     watch_date_time date_time = state->datetimes[state->index];
-    if (!settings->bit.clock_mode_24h) {
+    if (!movement_clock_mode_24h()) {
         if (date_time.unit.hour < 12) {
             watch_clear_indicator(WATCH_INDICATOR_PM);
         } else {
index fbf60cfeeca69c21418afdf6fc7c9f9f74d70673..7a0ba366abe672884cf4f6d1f1a0b73820afda21 100644 (file)
@@ -93,7 +93,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
         }
 
         watch_set_colon();
-        if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
+        if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
         rise += hours_from_utc;
         set += hours_from_utc;
@@ -113,7 +113,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
 
         if (date_time.reg < scratch_time.reg || show_next_match) {
             if (state->rise_index == 0 || show_next_match) {
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
                     else watch_clear_indicator(WATCH_INDICATOR_PM);
                 }
@@ -140,7 +140,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
 
         if (date_time.reg < scratch_time.reg || show_next_match) {
             if (state->rise_index == 0 || show_next_match) {
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
                     else watch_clear_indicator(WATCH_INDICATOR_PM);
                 }
index 6fa801fa9cc09c618d7b48c9ef3d2898e6a3a8fd..7926256380d1b6bea3925fd9753aeb6a3916df96 100644 (file)
@@ -38,7 +38,7 @@ void _wake_face_update_display(movement_settings_t *settings, wake_face_state_t
     uint8_t hour = state->hour;
 
     watch_clear_display();
-    if ( settings->bit.clock_mode_24h )
+    if ( movement_clock_mode_24h() )
         watch_set_indicator(WATCH_INDICATOR_24H);
     else {
         if ( hour >= 12 )
index b76c134f7cea642debaf7726fd7544de725d113d..8cd62d7dd6fc568b1c5b9c03255b12ce0dc26f80 100644 (file)
@@ -50,7 +50,7 @@ static void _lis2dw_logging_face_update_display(movement_settings_t *settings, l
         } else {
             date_time = logger_state->data[pos].timestamp;
             watch_set_colon();
-            if (settings->bit.clock_mode_24h) {
+            if (movement_clock_mode_24h()) {
                 watch_set_indicator(WATCH_INDICATOR_24H);
             } else {
                 if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM);
index 64f605e9aeed3d434b563df298268da7ef4fe1e8..63db33ce0a19744d765d1fe6c7bb7e16c05f2430 100644 (file)
@@ -100,18 +100,18 @@ bool thermistor_logging_face_loop(movement_event_t event, movement_settings_t *s
             break;
         case EVENT_LIGHT_BUTTON_DOWN:
             logger_state->ts_ticks = 2;
-            _thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h);
+            _thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, movement_clock_mode_24h());
             break;
         case EVENT_ALARM_BUTTON_DOWN:
             logger_state->display_index = (logger_state->display_index + 1) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
             logger_state->ts_ticks = 0;
             // fall through
         case EVENT_ACTIVATE:
-            _thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h);
+            _thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, movement_clock_mode_24h());
             break;
         case EVENT_TICK:
             if (logger_state->ts_ticks && --logger_state->ts_ticks == 0) {
-                _thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h);
+                _thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, movement_clock_mode_24h());
             }
             break;
         case EVENT_BACKGROUND_TASK:
index 2f4c0341bb5fda96d2bef0c61998c5c6020d0e3d..9b96014f0a580e22ac2e145899c55e657a3adcd7 100644 (file)
@@ -191,7 +191,7 @@ bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *s
     char buf[11];
     if (current_page < 3) {
         watch_set_colon();
-        if (settings->bit.clock_mode_24h) {
+        if (movement_clock_mode_24h()) {
             watch_set_indicator(WATCH_INDICATOR_24H);
             sprintf(buf,
                     "%s  %2d%02d%02d",
index d4fb963cc442b9c9182c96e88e04cf5fc615daa1..d3c2786850cfca258d94b135259c4bf71f1ad02a 100644 (file)
@@ -51,7 +51,7 @@ 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 (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
 
     // handle chime indicator
     if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
@@ -106,7 +106,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
                 watch_display_text(WATCH_POSITION_SECONDS, buf + 2);
             } else {
                 // other stuff changed; let's do it all.
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     // if we are in 12 hour mode, do some cleanup.
                     if (date_time.unit.hour < 12) {
                         watch_clear_indicator(WATCH_INDICATOR_PM);
index 924651b269ef16726b8d08b594d6113bb0cc7712..ddbcc94ea2750f6d40a69910b480433899650125 100644 (file)
@@ -68,7 +68,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
     watch_date_time date_time;
     switch (event.event_type) {
         case EVENT_ACTIVATE:
-            if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
+            if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);
             watch_set_colon();
             state->previous_date_time = 0xFFFFFFFF;
             // fall through
@@ -93,7 +93,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
                 }
             } else {
                 // other stuff changed; let's do it all.
-                if (!settings->bit.clock_mode_24h) {
+                if (!movement_clock_mode_24h()) {
                     // if we are in 12 hour mode, do some cleanup.
                     if (date_time.unit.hour < 12) {
                         watch_clear_indicator(WATCH_INDICATOR_PM);
index 07359451cb1764359e3a97ead5718cff72af00e3..344f0f35b58df30936ddc546fe2d0e670aef7f8e 100644 (file)
@@ -84,7 +84,7 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
                 char buf[8];
                 switch (state->current_page) {
                     case PREFERENCES_PAGE_CLOCK_MODE:
-                        if (settings->bit.clock_mode_24h) watch_display_text(WATCH_POSITION_BOTTOM, "24h");
+                        if (movement_clock_mode_24h()) watch_display_text(WATCH_POSITION_BOTTOM, "24h");
                         else watch_display_text(WATCH_POSITION_BOTTOM, "12h");
                         break;
                     case PREFERENCES_PAGE_BUTTON_SOUND:
@@ -179,7 +179,7 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
         case EVENT_ALARM_BUTTON_UP:
             switch (state->current_page) {
                 case PREFERENCES_PAGE_CLOCK_MODE:
-                    settings->bit.clock_mode_24h = !settings->bit.clock_mode_24h;
+                    movement_set_clock_mode_24h(((movement_clock_mode_24h() + 1) % MOVEMENT_NUM_CLOCK_MODES));
                     break;
                 case PREFERENCES_PAGE_BUTTON_SOUND:
                     movement_set_button_should_sound(!movement_button_should_sound());
index c1c92577c19425e473c01d1d0f8dee312d608430..ea6274997da2b08f18dabf4005478e0dcf7168b0 100644 (file)
@@ -132,7 +132,7 @@ bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, v
     watch_display_text(WATCH_POSITION_TOP_RIGHT, "  ");
     if (current_page < 3) {
         watch_set_colon();
-        if (settings->bit.clock_mode_24h) {
+        if (movement_clock_mode_24h()) {
             watch_set_indicator(WATCH_INDICATOR_24H);
             sprintf(buf, "%2d%02d%02d", date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
         } else {