|
|
|
@@ -45,10 +45,6 @@ static void abort_quick_ticks(countdown_state_t *state) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int32_t get_tz_offset(movement_settings_t *settings) {
|
|
|
|
|
return movement_timezone_offsets[settings->bit.time_zone] * 60;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void store_countdown(countdown_state_t *state) {
|
|
|
|
|
/* Store set countdown time */
|
|
|
|
|
state->set_hours = state->hours;
|
|
|
|
@@ -70,13 +66,14 @@ static inline void button_beep(movement_settings_t *settings) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void schedule_countdown(countdown_state_t *state, movement_settings_t *settings) {
|
|
|
|
|
(void) settings;
|
|
|
|
|
|
|
|
|
|
// Calculate the new state->now_ts but don't update it until we've updated the target -
|
|
|
|
|
// avoid possible race where the old target is compared to the new time and immediately triggers
|
|
|
|
|
uint32_t new_now = watch_utility_date_time_to_unix_time(watch_rtc_get_date_time(), get_tz_offset(settings));
|
|
|
|
|
uint32_t new_now = watch_utility_date_time_to_unix_time(watch_rtc_get_date_time(), movement_get_current_timezone_offset());
|
|
|
|
|
state->target_ts = watch_utility_offset_timestamp(new_now, state->hours, state->minutes, state->seconds);
|
|
|
|
|
state->now_ts = new_now;
|
|
|
|
|
watch_date_time target_dt = watch_utility_date_time_from_unix_time(state->target_ts, get_tz_offset(settings));
|
|
|
|
|
watch_date_time target_dt = watch_utility_date_time_from_unix_time(state->target_ts, movement_get_current_timezone_offset());
|
|
|
|
|
movement_schedule_background_task_for_face(state->watch_face_index, target_dt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -136,7 +133,7 @@ static void draw(countdown_state_t *state, uint8_t subsecond) {
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
watch_display_string(buf, 0);
|
|
|
|
|
watch_display_text(WATCH_POSITION_FULL, buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void pause(countdown_state_t *state) {
|
|
|
|
@@ -203,7 +200,7 @@ void countdown_face_activate(movement_settings_t *settings, void *context) {
|
|
|
|
|
countdown_state_t *state = (countdown_state_t *)context;
|
|
|
|
|
if(state->mode == cd_running) {
|
|
|
|
|
watch_date_time now = watch_rtc_get_date_time();
|
|
|
|
|
state->now_ts = watch_utility_date_time_to_unix_time(now, get_tz_offset(settings));
|
|
|
|
|
state->now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
|
|
|
|
|
watch_set_indicator(WATCH_INDICATOR_SIGNAL);
|
|
|
|
|
}
|
|
|
|
|
watch_set_colon();
|
|
|
|
@@ -224,7 +221,7 @@ bool countdown_face_loop(movement_event_t event, movement_settings_t *settings,
|
|
|
|
|
break;
|
|
|
|
|
case EVENT_TICK:
|
|
|
|
|
if (quick_ticks_running) {
|
|
|
|
|
if (watch_get_pin_level(BTN_ALARM))
|
|
|
|
|
if (HAL_GPIO_BTN_ALARM_read())
|
|
|
|
|
settings_increment(state);
|
|
|
|
|
else
|
|
|
|
|
abort_quick_ticks(state);
|