jonblack / arduino-fsm

Arduino library for implementing a finite state machine.
MIT License
200 stars 97 forks source link

Light Example doesn't work unless run_machine() is called #25

Open WayneKeenan opened 6 years ago

WayneKeenan commented 6 years ago

Internally m_initilaised is never set unless aforementioned function is called prior to entering loop()

JanHendrikStam commented 6 years ago

There are two ways around this,

The dirty way being: changing something in the the fsm.cpp file for now.

The nice way to have function like 'on_light_off_run(){}' which is inserted in the code:

State state_light_off(&on_light_off_enter, &on_light_off_run, &on_light_off_exit);

does nothing, but still ensures that m_initialised is set to true.

The fsm library assumes that the start state, referenced in the declaration of the state, is run first

fkromer commented 3 years ago

https://github.com/jonblack/arduino-fsm/pull/38