mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-09-28 18:57:33 +00:00
Changed statemachine to only check for transitions if the lockout timer is not running
This commit is contained in:
@@ -33,25 +33,28 @@ namespace sta
|
|||||||
|
|
||||||
void Statemachine::func()
|
void Statemachine::func()
|
||||||
{
|
{
|
||||||
uint16_t next = transitionFunc_(currentState_);
|
if (!lockoutTimer_.isRunning())
|
||||||
|
|
||||||
STA_ASSERT(next < STA_TACOS_NUM_STATES);
|
|
||||||
|
|
||||||
// Check if a state change is desired. Block if the lockoutTimer is still running.
|
|
||||||
if (next != currentState_ && !lockoutTimer_.isRunning())
|
|
||||||
{
|
{
|
||||||
if (failsafeTimer_.isRunning())
|
uint16_t next = transitionFunc_(currentState_);
|
||||||
|
|
||||||
|
STA_ASSERT(next < STA_TACOS_NUM_STATES);
|
||||||
|
|
||||||
|
// Check if a state change is desired. Block if the lockoutTimer is still running.
|
||||||
|
if (next != currentState_)
|
||||||
{
|
{
|
||||||
failsafeTimer_.stop();
|
if (failsafeTimer_.isRunning())
|
||||||
|
{
|
||||||
|
failsafeTimer_.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call user space code to set the timers again.
|
||||||
|
timerFunc_(next, currentState_, EventFlags::NORMAL);
|
||||||
|
|
||||||
|
// Update the state and trigger the global state changed event.
|
||||||
|
currentState_ = next;
|
||||||
|
Statemachine::stateChangeEvent.set(EventFlags::NORMAL);
|
||||||
|
Statemachine::stateChangeEvent.clear(EventFlags::ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call user space code to set the timers again.
|
|
||||||
timerFunc_(next, currentState_, EventFlags::NORMAL);
|
|
||||||
|
|
||||||
// Update the state and trigger the global state changed event.
|
|
||||||
currentState_ = next;
|
|
||||||
Statemachine::stateChangeEvent.set(EventFlags::NORMAL);
|
|
||||||
Statemachine::stateChangeEvent.clear(EventFlags::ALL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osThreadYield();
|
osThreadYield();
|
||||||
|
Reference in New Issue
Block a user