Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed reliance on timezones for the countdown face. #473

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions movement/watch_faces/complication/countdown_face.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,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;
Expand All @@ -69,12 +65,13 @@ static inline void button_beep(movement_settings_t *settings) {
}

static void start(countdown_state_t *state, movement_settings_t *settings) {
(void) settings;
watch_date_time now = watch_rtc_get_date_time();

state->mode = cd_running;
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, 0);
state->target_ts = watch_utility_offset_timestamp(state->now_ts, state->hours, state->minutes, state->seconds);
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, 0);
movement_schedule_background_task(target_dt);
watch_set_indicator(WATCH_INDICATOR_BELL);
}
Expand Down Expand Up @@ -179,7 +176,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, 0);
watch_set_indicator(WATCH_INDICATOR_BELL);
}
watch_set_colon();
Expand Down
11 changes: 4 additions & 7 deletions movement/watch_faces/complication/timer_face.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ static const int8_t _sound_seq_start[] = {BUZZER_NOTE_C8, 2, 0};

static uint8_t _beeps_to_play; // temporary counter for ring signals playing

static inline int32_t _get_tz_offset(movement_settings_t *settings) {
return movement_timezone_offsets[settings->bit.time_zone] * 60;
}

static void _signal_callback() {
if (_beeps_to_play) {
_beeps_to_play--;
Expand All @@ -48,17 +44,18 @@ static void _signal_callback() {
}

static void _start(timer_state_t *state, movement_settings_t *settings, bool with_beep) {
(void) settings;
if (state->timers[state->current_timer].value == 0) return;
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, 0);
if (state->mode == pausing)
state->target_ts = state->now_ts + state->paused_left;
else
state->target_ts = watch_utility_offset_timestamp(state->now_ts,
state->timers[state->current_timer].unit.hours,
state->timers[state->current_timer].unit.minutes,
state->timers[state->current_timer].unit.seconds);
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, 0);
state->mode = running;
movement_schedule_background_task_for_face(state->watch_face_index, target_dt);
watch_set_indicator(WATCH_INDICATOR_BELL);
Expand Down Expand Up @@ -210,7 +207,7 @@ void timer_face_activate(movement_settings_t *settings, void *context) {
watch_set_colon();
if(state->mode == 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, 0);
watch_set_indicator(WATCH_INDICATOR_BELL);
} else {
state->pausing_seconds = 1;
Expand Down
Loading