From a71c92e1f27a1ffe513bd0488011f3b6097455da Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 11 Nov 2018 16:00:12 -0700 Subject: Fixed the corner case of a button release when the previous state was already released. --- spaghetti-monster/fsm-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c index b36c9f4..72216ae 100644 --- a/spaghetti-monster/fsm-events.c +++ b/spaghetti-monster/fsm-events.c @@ -50,7 +50,7 @@ uint8_t push_event(uint8_t ev_type) { // handle button releases else if (ev_type == B_RELEASE) { // clear the press flag - current_event ^= B_PRESS; + current_event &= (~B_PRESS); // if a "hold" event just ended, set the timeout flag // to indicate that the event is done and can be cleared if (current_event & B_HOLD) { current_event |= B_TIMEOUT; } -- cgit v1.2.3