]> git.earman.xyz Git - sensor-watch.git/commit
movement: fix unintended timeout short circuiting
authorMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Wed, 6 Mar 2024 00:49:32 +0000 (21:49 -0300)
committerMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Wed, 6 Mar 2024 00:49:32 +0000 (21:49 -0300)
commitb1adbd548eabbf3212e9a53dbb8830d030b15fa7
tree7714ae461474d8c2033de157a211835018eabee2
parent6ca553e648ff0b4e72520057f1e353759949dcbe
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.
movement/movement.c