The state machine can get locked where it continually reenters a state.
I suggest rewriting the state machine to instead change a state variable which, then gets switched to in a higher level function, rather than entering the next state function directly from another state.
The state machine can get locked where it continually reenters a state. I suggest rewriting the state machine to instead change a state variable which, then gets switched to in a higher level function, rather than entering the next state function directly from another state.