From 5f1a6517320dabb13c65c8311e9a88281b15764e Mon Sep 17 00:00:00 2001 From: James Haggerty Date: Wed, 17 Apr 2024 20:54:46 +1000 Subject: [PATCH] Keep light on if interacting This makes it possible to do a bunch of things without having to keep touching the light button. I don't really see any downside with this. If you want the light to go off, just stop touching buttons. --- movement/movement.c | 11 +++++++++++ watch-library/simulator/main.c | 1 + 2 files changed, 12 insertions(+) diff --git a/movement/movement.c b/movement/movement.c index cb3dcf78e..8f9a45d32 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -543,6 +543,17 @@ bool app_loop(void) { event.subsecond = movement_state.subsecond; // the first trip through the loop overrides the can_sleep state can_sleep = wf->loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]); + + // Keep light on if user is still interacting with the watch. + if (movement_state.light_ticks > 0) { + switch (event.event_type) { + case EVENT_LIGHT_BUTTON_DOWN: + case EVENT_MODE_BUTTON_DOWN: + case EVENT_ALARM_BUTTON_DOWN: + movement_illuminate_led(); + } + } + event.event_type = EVENT_NONE; } diff --git a/watch-library/simulator/main.c b/watch-library/simulator/main.c index 6898fd06d..5e5070ffb 100644 --- a/watch-library/simulator/main.c +++ b/watch-library/simulator/main.c @@ -89,6 +89,7 @@ void main_loop_sleep(uint32_t ms) { main_loop_set_sleeping(true); emscripten_sleep(ms); main_loop_set_sleeping(false); + animation_frame_id = ANIMATION_FRAME_ID_INVALID; } bool main_loop_is_sleeping(void) {