jonblack/arduino-fsm

Allow dynamic time transitions

jonblack opened this issue · 1 comments

A user left a comment on the blog asking for the ability to set the timed transition interval dynamically. I need a good use case example for this.

This feature would be nice in my current project, my FSM stays in a state while playing sounds, I have a timed transition adjusted to longest sound duration that come back to previous state once played. It would be nice the ability to change timed transition timer into on_state() function to the length of the currently played sound.

Can be as easy as passing an interface to set current state properties as an on_state parameter.

Something like:

on_state(current_state){
   ...
   current_state.setTimeout(600);
   ...
}

This way even on_enter() and on_exit() events could be changed on the fly.