Changed timer thread priority and fixed lockout and failsafe timers

This commit is contained in:
dario
2023-09-27 09:53:06 +02:00
parent 817db58a0e
commit 73bf55a0b4
4 changed files with 13 additions and 15 deletions

View File

@@ -15,7 +15,9 @@ namespace sta
namespace tacos
{
Statemachine::Statemachine()
: currentState_{STA_TACOS_INITIAL_STATE}, lockoutTimer_{[](void *){}, NULL}, failsafeTimer_{[](void *){}, NULL}
: currentState_{STA_TACOS_INITIAL_STATE},
lockoutTimer_{[](void *){}, nullptr},
failsafeTimer_{[](void *){}, nullptr}
{
STA_ASSERT(STA_TACOS_INITIAL_STATE < STA_TACOS_NUM_STATES);
}
@@ -24,23 +26,18 @@ namespace sta
{
STA_DEBUG_PRINTLN("INITIALIZING STATEMACHINE");
/*
lockoutTimer_.setCallback([](void *) { STA_DEBUG_PRINTLN("Lockout timer triggered!"); }, NULL);
lockoutTimer_.start(1000);
lockoutTimer_.setCallback([](void *) { STA_DEBUG_PRINTLN("[LOCKOUT TIMEOUT]"); }, nullptr);
lockoutTimer_.start(5000);
failsafeTimer_.setCallback([](void *) { STA_DEBUG_PRINTLN("Failsafe timer triggered!"); }, NULL);
failsafeTimer_.start(2000);
*/
failsafeTimer_.setCallback([](void *) { STA_DEBUG_PRINTLN("[FAILSAFE TIMEOUT]"); }, nullptr);
failsafeTimer_.start(10000);
}
void Statemachine::func()
{
// STA_DEBUG_PRINTLN("LOOPY LOOP IN STATEMACHINE");
STA_DEBUG_PRINTLN("LOOPY LOOP IN STATEMACHINE.");
STA_DEBUG_PRINT("Failsafe timer is running: ");
STA_DEBUG_PRINTLN(failsafeTimer_.isRunning());
osDelay(1000);
osDelay(3000);
}
uint16_t Statemachine::getCurrentState() const