cleanup: separate functions for requesting and forcing state transitions, fix publishing behavior

This commit is contained in:
CarlWachter
2024-11-03 13:42:25 +01:00
parent 9f4d99191d
commit ca3f303293
5 changed files with 62 additions and 22 deletions

View File

@@ -174,11 +174,23 @@ namespace sta
* @param from The state which we want to leave. This is used to filter out obsolete transitions.
* @param to The state to transition to.
* @param lockout The minimum number of milliseconds we expect to stay in this state. This is used to block premature transitions.
* @param force If true, the state transition will be executed regardless of the current state.
* @param publish If true, the state transition will be published via CAN.
*
* @ingroup tacos_statemachine
*/
void requestStateTransition(uint32_t from, uint32_t to, uint32_t lockout = 0, bool force = false, bool publish = true);
void requestStateTransition(uint32_t from, uint32_t to, uint32_t lockout = 0, bool publish = true);
/**
* @brief Request a state transition from a state to another.
*
* @param from The state which we want to leave. This is used to filter out obsolete transitions.
* @param to The state to transition to.
* @param lockout The minimum number of milliseconds we expect to stay in this state. This is used to block premature transitions.
* @param publish If true, the state transition will be published via CAN.
*
* @ingroup tacos_statemachine
*/
void forceStateTransition(uint32_t from, uint32_t to, uint32_t lockout = 0, bool publish = true);
/**
* @brief Request a state transition after a given time has passed.
@@ -187,6 +199,7 @@ namespace sta
* @param to The state to transition to.
* @param millis the number of milliseconds to wait before triggering the transition.
* @param lockout The minimum number of milliseconds we expect to stay in this state. This is used to block premature transitions.
* @param publish If true, the state transition will be published via CAN.
*
* @ingroup tacos_statemachine
*/