Skip to content

Commit

Permalink
Merge PR #394 - keep LED lit while buttons held
Browse files Browse the repository at this point in the history
Keeps the LED turned on while the user is interacting with the watch.

Reviewed-by: Matheus Afonso Martins Moreira <[email protected]>
GitHub-Pull-Request: #394
  • Loading branch information
matheusmoreira committed Sep 7, 2024
2 parents b9dbc4e + 5f1a651 commit 99586f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions movement/movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,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;
}

Expand Down
1 change: 1 addition & 0 deletions watch-library/simulator/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 99586f8

Please sign in to comment.