refactor movement's 24h mode to a function call
This commit is contained in:
parent
63e0981693
commit
c5e5bc1200
@ -337,6 +337,14 @@ void movement_set_button_should_sound(bool value) {
|
|||||||
movement_state.settings.bit.button_should_sound = 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) {
|
void app_init(void) {
|
||||||
_watch_init();
|
_watch_init();
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,12 @@
|
|||||||
// stuff we'll want to make available to all watch faces and stash in the BKUP[3] register.
|
// 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.
|
// 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
|
// 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.
|
// display, time zones, buzzer behavior, LED color and low energy mode timeouts.
|
||||||
typedef union {
|
typedef union {
|
||||||
@ -321,3 +327,6 @@ int32_t movement_get_current_timezone_offset(void);
|
|||||||
|
|
||||||
bool movement_button_should_sound(void);
|
bool movement_button_should_sound(void);
|
||||||
void movement_set_button_should_sound(bool value);
|
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);
|
||||||
|
|||||||
@ -53,11 +53,7 @@ typedef struct {
|
|||||||
} clock_state_t;
|
} clock_state_t;
|
||||||
|
|
||||||
static bool clock_is_in_24h_mode(movement_settings_t *settings) {
|
static bool clock_is_in_24h_mode(movement_settings_t *settings) {
|
||||||
#ifdef CLOCK_FACE_24H_ONLY
|
return movement_clock_mode_24h();
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return settings->bit.clock_mode_24h;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool clock_should_set_leading_zero(movement_settings_t *settings) {
|
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) {
|
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));
|
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();
|
watch_stop_tick_animation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->bit.clock_mode_24h) {
|
if (movement_clock_mode_24h()) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_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;
|
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 we are in 12 hour mode, do some cleanup.
|
||||||
if (close_enough_hour < 12) {
|
if (close_enough_hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
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); }
|
else { watch_display_string("--", 8); }
|
||||||
break;
|
break;
|
||||||
case EVENT_LIGHT_LONG_PRESS:
|
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,
|
// 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.
|
// so this is separate for now.
|
||||||
state->use_am_pm = !state->use_am_pm;
|
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();
|
watch_date_time date_time = watch_rtc_get_date_time();
|
||||||
char buffer[11];
|
char buffer[11];
|
||||||
|
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!movement_clock_mode_24h()) {
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
sprintf(buffer, "%2d%02d ", date_time.unit.hour, date_time.unit.minute);
|
sprintf(buffer, "%2d%02d ", date_time.unit.hour, date_time.unit.minute);
|
||||||
} else {
|
} 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 (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
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
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);
|
sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
|
||||||
} else {
|
} else {
|
||||||
// other stuff changed; let's do it all.
|
// 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 we are in 12 hour mode, do some cleanup.
|
||||||
if (date_time.unit.hour < 12) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
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;
|
int minutes = date_time.unit.minute % 10;
|
||||||
|
|
||||||
// chiming hours
|
// chiming hours
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!movement_clock_mode_24h()) {
|
||||||
hours = date_time.unit.hour % 12;
|
hours = date_time.unit.hour % 12;
|
||||||
if (hours == 0) hours = 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 (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
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
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);
|
sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
|
||||||
} else {
|
} else {
|
||||||
// other stuff changed; let's do it all.
|
// 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 we are in 12 hour mode, do some cleanup.
|
||||||
if (date_time.unit.hour < 12) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
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;
|
int minutes = date_time.unit.minute % 15;
|
||||||
|
|
||||||
// chiming hours
|
// chiming hours
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!movement_clock_mode_24h()) {
|
||||||
hours = date_time.unit.hour % 12;
|
hours = date_time.unit.hour % 12;
|
||||||
if (hours == 0) hours = 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 (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
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
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);
|
sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
|
||||||
} else {
|
} else {
|
||||||
// other stuff changed; let's do it all.
|
// 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 we are in 12 hour mode, do some cleanup.
|
||||||
if (date_time.unit.hour < 12) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
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();
|
date_time = watch_rtc_get_date_time();
|
||||||
state->flashing_state = 1 + 128;
|
state->flashing_state = 1 + 128;
|
||||||
state->ticks = 4;
|
state->ticks = 4;
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!movement_clock_mode_24h()) {
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0) 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 (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
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
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));
|
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 {
|
} else {
|
||||||
// other stuff changed; let's do it all.
|
// 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 we are in 12 hour mode, do some cleanup.
|
||||||
if (date_time.unit.hour < 12) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
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) {
|
if (refresh_face) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h)
|
if (movement_clock_mode_24h())
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
state->previous_date_time = REFRESH_TIME;
|
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);
|
sprintf(buf, "%02d%02d", date_time.unit.minute, date_time.unit.second);
|
||||||
} else {
|
} else {
|
||||||
/* Other stuff changed; Let's do it all. */
|
/* 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 we are in 12 hour mode, do some cleanup. */
|
||||||
if (date_time.unit.hour < 12) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
|
|||||||
@ -296,7 +296,7 @@ static void _activity_update_logging_screen(movement_settings_t *settings, activ
|
|||||||
watch_clear_indicator(WATCH_INDICATOR_LAP);
|
watch_clear_indicator(WATCH_INDICATOR_LAP);
|
||||||
watch_date_time now = watch_rtc_get_date_time();
|
watch_date_time now = watch_rtc_get_date_time();
|
||||||
uint8_t hour = now.unit.hour;
|
uint8_t hour = now.unit.hour;
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!movement_clock_mode_24h()) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||||
if (hour < 12)
|
if (hour < 12)
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
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
|
//handle am/pm for hour display
|
||||||
uint8_t h = state->alarm[state->alarm_idx].hour;
|
uint8_t h = state->alarm[state->alarm_idx].hour;
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!movement_clock_mode_24h()) {
|
||||||
if (h >= 12) {
|
if (h >= 12) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_PM);
|
watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
h %= 12;
|
h %= 12;
|
||||||
|
|||||||
@ -448,7 +448,7 @@ static void _setting_display(movement_event_t event, movement_settings_t *settin
|
|||||||
int i = state->current_index + 1;
|
int i = state->current_index + 1;
|
||||||
if (state->current_page > 2) {
|
if (state->current_page > 2) {
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) {
|
if (movement_clock_mode_24h()) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_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);
|
sprintf(buf, "%s%2d%2d%02d ", settings_titles[state->current_page], i, date_time.unit.hour, date_time.unit.minute);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -602,7 +602,7 @@ bool endless_runner_face_loop(movement_event_t event, movement_settings_t *setti
|
|||||||
display_title(state);
|
display_title(state);
|
||||||
break;
|
break;
|
||||||
case EVENT_LOW_ENERGY_UPDATE:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
return movement_default_loop_handler(event, settings);
|
return movement_default_loop_handler(event, settings);
|
||||||
|
|||||||
@ -253,7 +253,7 @@ static void _planetary_hours(movement_settings_t *settings, planetary_hours_stat
|
|||||||
return;
|
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
|
// roll over hour iterator
|
||||||
if ( state->hour < 0 ) state->hour = 23;
|
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++;
|
else if ( scratch_time.unit.minute < 59 ) scratch_time.unit.minute++;
|
||||||
|
|
||||||
// if we are in 12 hour mode, do some cleanup
|
// 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) {
|
if (scratch_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -218,11 +218,11 @@ static void _planetary_time(movement_event_t event, movement_settings_t *setting
|
|||||||
return;
|
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
|
// PM for night hours, otherwise the night hours are counted from 13
|
||||||
if ( state->night ) {
|
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);
|
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) {
|
static void show_date_time(movement_settings_t *settings, solstice_state_t *state) {
|
||||||
char buf[11];
|
char buf[11];
|
||||||
watch_date_time date_time = state->datetimes[state->index];
|
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) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -93,7 +93,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
watch_set_colon();
|
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;
|
rise += hours_from_utc;
|
||||||
set += 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 (date_time.reg < scratch_time.reg || show_next_match) {
|
||||||
if (state->rise_index == 0 || 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);
|
if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
else watch_clear_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 (date_time.reg < scratch_time.reg || show_next_match) {
|
||||||
if (state->rise_index == 0 || 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);
|
if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
else watch_clear_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;
|
uint8_t hour = state->hour;
|
||||||
|
|
||||||
watch_clear_display();
|
watch_clear_display();
|
||||||
if ( settings->bit.clock_mode_24h )
|
if ( movement_clock_mode_24h() )
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
else {
|
else {
|
||||||
if ( hour >= 12 )
|
if ( hour >= 12 )
|
||||||
|
|||||||
@ -50,7 +50,7 @@ static void _lis2dw_logging_face_update_display(movement_settings_t *settings, l
|
|||||||
} else {
|
} else {
|
||||||
date_time = logger_state->data[pos].timestamp;
|
date_time = logger_state->data[pos].timestamp;
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) {
|
if (movement_clock_mode_24h()) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
} else {
|
} else {
|
||||||
if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM);
|
if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
|
|||||||
@ -100,18 +100,18 @@ bool thermistor_logging_face_loop(movement_event_t event, movement_settings_t *s
|
|||||||
break;
|
break;
|
||||||
case EVENT_LIGHT_BUTTON_DOWN:
|
case EVENT_LIGHT_BUTTON_DOWN:
|
||||||
logger_state->ts_ticks = 2;
|
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;
|
break;
|
||||||
case EVENT_ALARM_BUTTON_DOWN:
|
case EVENT_ALARM_BUTTON_DOWN:
|
||||||
logger_state->display_index = (logger_state->display_index + 1) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
|
logger_state->display_index = (logger_state->display_index + 1) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
|
||||||
logger_state->ts_ticks = 0;
|
logger_state->ts_ticks = 0;
|
||||||
// fall through
|
// fall through
|
||||||
case EVENT_ACTIVATE:
|
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;
|
break;
|
||||||
case EVENT_TICK:
|
case EVENT_TICK:
|
||||||
if (logger_state->ts_ticks && --logger_state->ts_ticks == 0) {
|
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;
|
break;
|
||||||
case EVENT_BACKGROUND_TASK:
|
case EVENT_BACKGROUND_TASK:
|
||||||
|
|||||||
@ -191,7 +191,7 @@ bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *s
|
|||||||
char buf[11];
|
char buf[11];
|
||||||
if (current_page < 3) {
|
if (current_page < 3) {
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) {
|
if (movement_clock_mode_24h()) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
sprintf(buf,
|
sprintf(buf,
|
||||||
"%s %2d%02d%02d",
|
"%s %2d%02d%02d",
|
||||||
|
|||||||
@ -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 (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
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
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);
|
watch_display_text(WATCH_POSITION_SECONDS, buf + 2);
|
||||||
} else {
|
} else {
|
||||||
// other stuff changed; let's do it all.
|
// 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 we are in 12 hour mode, do some cleanup.
|
||||||
if (date_time.unit.hour < 12) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
|
|||||||
@ -68,7 +68,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
|
|||||||
watch_date_time date_time;
|
watch_date_time date_time;
|
||||||
switch (event.event_type) {
|
switch (event.event_type) {
|
||||||
case EVENT_ACTIVATE:
|
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();
|
watch_set_colon();
|
||||||
state->previous_date_time = 0xFFFFFFFF;
|
state->previous_date_time = 0xFFFFFFFF;
|
||||||
// fall through
|
// fall through
|
||||||
@ -93,7 +93,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// other stuff changed; let's do it all.
|
// 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 we are in 12 hour mode, do some cleanup.
|
||||||
if (date_time.unit.hour < 12) {
|
if (date_time.unit.hour < 12) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
|
|||||||
@ -84,7 +84,7 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
|||||||
char buf[8];
|
char buf[8];
|
||||||
switch (state->current_page) {
|
switch (state->current_page) {
|
||||||
case PREFERENCES_PAGE_CLOCK_MODE:
|
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");
|
else watch_display_text(WATCH_POSITION_BOTTOM, "12h");
|
||||||
break;
|
break;
|
||||||
case PREFERENCES_PAGE_BUTTON_SOUND:
|
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:
|
case EVENT_ALARM_BUTTON_UP:
|
||||||
switch (state->current_page) {
|
switch (state->current_page) {
|
||||||
case PREFERENCES_PAGE_CLOCK_MODE:
|
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;
|
break;
|
||||||
case PREFERENCES_PAGE_BUTTON_SOUND:
|
case PREFERENCES_PAGE_BUTTON_SOUND:
|
||||||
movement_set_button_should_sound(!movement_button_should_sound());
|
movement_set_button_should_sound(!movement_button_should_sound());
|
||||||
|
|||||||
@ -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, " ");
|
watch_display_text(WATCH_POSITION_TOP_RIGHT, " ");
|
||||||
if (current_page < 3) {
|
if (current_page < 3) {
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) {
|
if (movement_clock_mode_24h()) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
sprintf(buf, "%2d%02d%02d", date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
sprintf(buf, "%2d%02d%02d", date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user