From dcd4d12c0ab55aea50fc93f4de390a815d4ff6f5 Mon Sep 17 00:00:00 2001 From: Joseph Bryant Date: Sun, 18 Aug 2024 21:50:41 +0100 Subject: [PATCH 1/2] avoid delta overflow in countdown draw --- movement/watch_faces/complication/countdown_face.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/movement/watch_faces/complication/countdown_face.c b/movement/watch_faces/complication/countdown_face.c index be04040e3..6ae3d935b 100644 --- a/movement/watch_faces/complication/countdown_face.c +++ b/movement/watch_faces/complication/countdown_face.c @@ -87,7 +87,10 @@ static void draw(countdown_state_t *state, uint8_t subsecond) { switch (state->mode) { case cd_running: - delta = state->target_ts - state->now_ts; + if (state->target_ts <= state->now_ts) + delta = 0; + else + delta = state->target_ts - state->now_ts; result = div(delta, 60); state->seconds = result.rem; result = div(result.quot, 60); From e2c5babb2c7cd0141a5a78e9f94458804bbd9764 Mon Sep 17 00:00:00 2001 From: Joseph Bryant Date: Sun, 18 Aug 2024 22:03:05 +0100 Subject: [PATCH 2/2] don't change the bell indicator from within background task --- movement/watch_faces/complication/countdown_face.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/movement/watch_faces/complication/countdown_face.c b/movement/watch_faces/complication/countdown_face.c index 6ae3d935b..b48ef595a 100644 --- a/movement/watch_faces/complication/countdown_face.c +++ b/movement/watch_faces/complication/countdown_face.c @@ -100,6 +100,7 @@ static void draw(countdown_state_t *state, uint8_t subsecond) { break; case cd_reset: case cd_paused: + watch_clear_indicator(WATCH_INDICATOR_BELL); sprintf(buf, "CD %2d%02d%02d", state->hours, state->minutes, state->seconds); break; case cd_setting: @@ -133,7 +134,6 @@ static void pause(countdown_state_t *state) { static void reset(countdown_state_t *state) { state->mode = cd_reset; movement_cancel_background_task(); - watch_clear_indicator(WATCH_INDICATOR_BELL); load_countdown(state); }