Skip to content

Conversation

@corna
Copy link

@corna corna commented Feb 28, 2016

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

@corna
Copy link
Author

corna commented Mar 2, 2016

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

@Thelmos Thelmos mentioned this pull request Mar 12, 2016
@MartijnvdB
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants