Open corna opened 8 years ago
I force-pushed a small fix: now millis() is called only once at the beginning of update_timed_transitions_starts() and its result is saved in millis_value
Thanks for this commit. It solves an issue where, if I return from one timed transition to another timed transition before the timer interval has expired, the next timed transition would happen immediately.
Hi I am using arduino-fsm for a two-button system, where I have to detect multiple events (single click, double click, muliple clicks...). In one of the states I had 2 possible transitions, one timed (the user keeps the button pressed and the transition "times out") and one "standard" (the user releases the button before the timeout). If the "standard" transition is triggered the timed transition start time is not updated and remains at the previous value during the next iteration, resulting in a lower (if not even 0) interval. I've corrected this bug moving the update after every state change; this also has the advantage of a more precise start time, as the user doesn't have to call check_timer in order to update start to millis().
In this pull request I've also added the fix for bug #4