Added state publishing to TACOS state transition

This commit is contained in:
dario
2024-10-04 13:32:30 +02:00
parent c784e37eab
commit d1f7063912
4 changed files with 34 additions and 18 deletions

View File

@@ -119,7 +119,9 @@ namespace sta
/// Event that triggered the transition
EventFlags event;
/// Lockout time after transition
uint32_t lockout;
uint32_t lockout;
/// Whether to publish the transition via CAN.
bool publish = false;
};
/**
@@ -164,7 +166,7 @@ namespace sta
* @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.
*/
void requestStateTransition(uint32_t from, uint32_t to, uint32_t lockout = 0, bool force = false);
void requestStateTransition(uint32_t from, uint32_t to, uint32_t lockout = 0, bool force = false, bool publish = true);
/**
* @brief Request a state transition after a given time has passed.
@@ -174,7 +176,7 @@ namespace sta
* @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.
*/
void requestTimedStateTransition(uint32_t from, uint32_t to, uint32_t millis, uint32_t lockout = 0);
void requestTimedStateTransition(uint32_t from, uint32_t to, uint32_t millis, uint32_t lockout = 0, bool publish = true);
void init() override;
void func() override;