summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheOnePerson <a.nebinger@web.de>2023-05-18 13:10:32 +0200
committerTheOnePerson <a.nebinger@web.de>2023-05-18 13:10:32 +0200
commit45d9b97f076594f7e0f028f039e63f587bca55ae (patch)
tree0060d48f69113ed77b8079c6ee1777b944d2424e
parent7331851c7762cb1061f5c6d7c64593a1aa1fe7f8 (diff)
downloadSensor-Watch-45d9b97f076594f7e0f028f039e63f587bca55ae.tar.gz
Sensor-Watch-45d9b97f076594f7e0f028f039e63f587bca55ae.tar.bz2
Sensor-Watch-45d9b97f076594f7e0f028f039e63f587bca55ae.zip
timer face: fix problem with messed up durations for repeating timers / always beep when starting a timer
-rw-r--r--movement/watch_faces/complication/timer_face.c8
-rw-r--r--movement/watch_faces/complication/timer_face.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/movement/watch_faces/complication/timer_face.c b/movement/watch_faces/complication/timer_face.c
index 4b0b70b1..70f250a5 100644
--- a/movement/watch_faces/complication/timer_face.c
+++ b/movement/watch_faces/complication/timer_face.c
@@ -62,9 +62,9 @@ static void _start(timer_state_t *state, movement_settings_t *settings, bool wit
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));
state->mode = running;
- movement_schedule_background_task(target_dt);
+ movement_schedule_background_task_for_face(state->watch_face_index, target_dt);
watch_set_indicator(WATCH_INDICATOR_BELL);
- if (settings->bit.button_should_sound && with_beep) watch_buzzer_play_sequence((int8_t *)_sound_seq_start, NULL);
+ if (with_beep) watch_buzzer_play_sequence((int8_t *)_sound_seq_start, NULL);
}
static void _draw(timer_state_t *state, uint8_t subsecond) {
@@ -128,7 +128,7 @@ static void _draw(timer_state_t *state, uint8_t subsecond) {
static void _reset(timer_state_t *state) {
state->mode = waiting;
- movement_cancel_background_task();
+ movement_cancel_background_task_for_face(state->watch_face_index);
watch_clear_indicator(WATCH_INDICATOR_BELL);
}
@@ -193,12 +193,12 @@ static inline bool _check_for_signal() {
void timer_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
(void) settings;
- (void) watch_face_index;
if (*context_ptr == NULL) {
*context_ptr = malloc(sizeof(timer_state_t));
timer_state_t *state = (timer_state_t *)*context_ptr;
memset(*context_ptr, 0, sizeof(timer_state_t));
+ state->watch_face_index = watch_face_index;
for (uint8_t i = 0; i < sizeof(_default_timer_values) / sizeof(uint16_t); i++) {
state->timers[i].value = _default_timer_values[i];
}
diff --git a/movement/watch_faces/complication/timer_face.h b/movement/watch_faces/complication/timer_face.h
index 293f6524..5f035cb3 100644
--- a/movement/watch_faces/complication/timer_face.h
+++ b/movement/watch_faces/complication/timer_face.h
@@ -77,6 +77,7 @@ typedef struct {
uint32_t now_ts;
uint16_t paused_left;
uint8_t pausing_seconds;
+ uint8_t watch_face_index;
timer_setting_t timers[TIMER_SLOTS];
uint8_t settings_state : 4;
uint8_t current_timer : 4;