refactor movement's 24h mode to a function call
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user