]> git.earman.xyz Git - sensor-watch.git/commitdiff
Keep light on if interacting
authorJames Haggerty <james@gruemail.com>
Wed, 17 Apr 2024 10:54:46 +0000 (20:54 +1000)
committerJames Haggerty <james@gruemail.com>
Sat, 20 Jul 2024 22:25:54 +0000 (08:25 +1000)
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
watch-library/simulator/main.c

index cb3dcf78e9b215c6ce4aa8eff24be3a02c80c096..8f9a45d32b7f6fb426741a9a5918f1b982b0d20e 100644 (file)
@@ -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;
     }
 
index 6898fd06d590ab9acc85b98524db03d047f7c190..5e5070ffb7117d54fb9424b124e814167f7b29b9 100644 (file)
@@ -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) {