joeycastillo / Sensor-Watch

A board replacement for the classic Casio F-91W wristwatch
Other
1.02k stars 210 forks source link

Timeout event and sleep logic #376

Closed matheusmoreira closed 3 months ago

matheusmoreira commented 4 months ago

Currently, movement drops timeout events in case the previous loop indicates that sleep is not possible. This is due to unintended short circuiting behavior of && and is fixed by using a temporary variable.

The static qualifier of can_sleep is also removed, apparently with no ill effects. Its value is set every time app_loop runs and its scope is limited to that function, there's apparently no need for it to be in static storage.