diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-11-22 17:35:50 -0500 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-11-22 17:35:50 -0500 |
commit | 7817e6696e438c8af74342ef10b576975a0e5448 (patch) | |
tree | 865dd18e9d77e404ed5bd44af87e33a2d7d44ef3 /movement/movement.c | |
parent | 0ca729eaba7cdca543bc563912095df98f2b3786 (diff) | |
parent | 25815ed4f649f3b908dbc40c926997eec2b095e8 (diff) | |
download | Sensor-Watch-7817e6696e438c8af74342ef10b576975a0e5448.tar.gz Sensor-Watch-7817e6696e438c8af74342ef10b576975a0e5448.tar.bz2 Sensor-Watch-7817e6696e438c8af74342ef10b576975a0e5448.zip |
Merge branch 'main' of github.com:joeycastillo/Sensor-Watch into main
Diffstat (limited to 'movement/movement.c')
-rw-r--r-- | movement/movement.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/movement/movement.c b/movement/movement.c index 5622f17f..797e75bf 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -105,7 +105,7 @@ void app_setup() { watch_faces[i].setup(&movement_state.settings, &watch_face_contexts[i]); } - watch_faces[0].activate(&movement_state.settings, watch_face_contexts[0]); + watch_faces[movement_state.current_watch_face].activate(&movement_state.settings, watch_face_contexts[movement_state.current_watch_face]); event.subsecond = 0; event.event_type = EVENT_ACTIVATE; } @@ -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; } |