diff --git a/src/statemachine.cpp b/src/statemachine.cpp index 4116f45..6df4e93 100644 --- a/src/statemachine.cpp +++ b/src/statemachine.cpp @@ -72,7 +72,8 @@ namespace sta transition.event = EventFlags::NORMAL; transition.lockout = lockout; - if (force){ + // Force the transition if requested, but only if the requested state is different from the current one. + if (force && transition.to != currentState_){ // Perform the transition and notify the threads. The event flags are set // here in order to allow threads to react immediately. currentState_ = transition.to;