diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-11-07 00:29:27 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-11-07 00:29:27 -0400 |
commit | ef40d58afc73f8056c90eff68d01b3f3a89976cd (patch) | |
tree | 729de4f6c51ca6c6138a06ee9d957f3946f58bb0 /movement | |
parent | 0f03257ee9ef46ac61e20f7201e2c50dedff01b2 (diff) | |
download | Sensor-Watch-ef40d58afc73f8056c90eff68d01b3f3a89976cd.tar.gz Sensor-Watch-ef40d58afc73f8056c90eff68d01b3f3a89976cd.tar.bz2 Sensor-Watch-ef40d58afc73f8056c90eff68d01b3f3a89976cd.zip |
movement: refactor timeout to tick first, then notify
Diffstat (limited to 'movement')
-rw-r--r-- | movement/movement.c | 16 | ||||
-rw-r--r-- | movement/watch_faces/clock/simple_clock_face.c | 1 |
2 files changed, 10 insertions, 7 deletions
diff --git a/movement/movement.c b/movement/movement.c index 5622f17f..643fc672 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -143,11 +143,6 @@ bool app_loop() { } } - // if we have timed out of our timeout countdown, give the app a hint that they can resign. - if (movement_state.timeout_ticks == 0) { - event.event_type = EVENT_TIMEOUT; - } - // handle background tasks, if the alarm handler told us we need to if (movement_state.needs_background_tasks_handled) _movement_handle_background_tasks(); @@ -181,9 +176,18 @@ bool app_loop() { event.subsecond = movement_state.subsecond; can_sleep = watch_faces[movement_state.current_watch_face].loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_watch_face]); event.event_type = EVENT_NONE; - event.subsecond = 0; } + // if we have timed out of our timeout countdown, give the app a hint that they can resign. + if (movement_state.timeout_ticks == 0) { + event.event_type = EVENT_TIMEOUT; + event.subsecond = movement_state.subsecond; + watch_faces[movement_state.current_watch_face].loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_watch_face]); + event.event_type = EVENT_NONE; + } + + event.subsecond = 0; + return can_sleep && !movement_state.led_on; } diff --git a/movement/watch_faces/clock/simple_clock_face.c b/movement/watch_faces/clock/simple_clock_face.c index 9e279d95..72f7713f 100644 --- a/movement/watch_faces/clock/simple_clock_face.c +++ b/movement/watch_faces/clock/simple_clock_face.c @@ -28,7 +28,6 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting switch (event.event_type) { case EVENT_ACTIVATE: case EVENT_TICK: - case EVENT_TIMEOUT: case EVENT_LOW_ENERGY_UPDATE: date_time = watch_rtc_get_date_time(); previous_date_time = *((uint32_t *)context); |