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