refactor movement's 24h mode to a function call

This commit is contained in:
joeycastillo
2024-09-29 08:02:20 -04:00
parent 63e0981693
commit c5e5bc1200
27 changed files with 61 additions and 48 deletions

View 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);

View 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);

View 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());

View 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 {