movement: fix unintended timeout short circuiting
Currently, movement drops time out events in case the previous loop indicates that sleep is not possible due to short circuiting behavior of logical and in C: if the left-hand side is false, the right hand side is not evaluated at all, which means the loop is not called. This was not intended to happen. Fix it by storing the result in a second boolean variable and working out the logic after the fact.
This commit is contained in:
parent
6ca553e648
commit
b1adbd548e
@ -533,7 +533,8 @@ bool app_loop(void) {
|
||||
// first trip | can sleep | cannot sleep | can sleep | cannot sleep
|
||||
// second trip | can sleep | cannot sleep | cannot sleep | can sleep
|
||||
// && | can sleep | cannot sleep | cannot sleep | cannot sleep
|
||||
can_sleep = can_sleep && wf->loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
|
||||
bool can_sleep2 = wf->loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
|
||||
can_sleep = can_sleep && can_sleep2;
|
||||
event.event_type = EVENT_NONE;
|
||||
if (movement_state.settings.bit.to_always && movement_state.current_face_idx != 0) {
|
||||
// ...but if the user has "timeout always" set, give it the boot.
|
||||
|
Loading…
x
Reference in New Issue
Block a user