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

@@ -41,11 +41,23 @@ namespace sta
* @param from The start we want to transition from.
* @param to The state we want to transition to.
* @param lockout An optional timer blocking state transition for a given time.
* @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_api
*/
void setState(uint32_t from, uint32_t to, uint32_t lockout = 0, bool force = false, bool publish = false);
void requestState(uint32_t from, uint32_t to, uint32_t lockout = 0, bool publish = true);
/**
* @brief Request a state transition. Invalid state transitions will be dismissed.
*
* @param from The start we want to transition from.
* @param to The state we want to transition to.
* @param lockout An optional timer blocking state transition for a given time.
* @param publish If true, the state transition will be published via CAN.
*
* @ingroup tacos_api
*/
void forceState(uint32_t from, uint32_t to, uint32_t lockout = 0, bool publish = true);
/**
* @brief Request a state transition after a given time has passed. Invalid state transitions will be dismissed.