Working manager & statemachine tasks; timers still bugged; statemachine init bugged

This commit is contained in:
dario
2023-09-27 00:07:23 +02:00
parent 5bf6cca3b1
commit 817db58a0e
10 changed files with 83 additions and 31 deletions

View File

@@ -11,6 +11,20 @@
#include <sta/config.hpp>
#include <sta/tacos/thread.hpp>
#include <sta/rtos/timer.hpp>
#include <sta/debug/assert.hpp>
#ifndef STA_TACOS_NUM_STATES
# error "Number of states wasn't defined in config.hpp"
#else
#ifndef STA_TACOS_INITIAL_STATE
# define STA_TACOS_INITIAL_STATE 0
#endif
namespace sta
{
@@ -27,9 +41,6 @@ namespace sta
{
// Create a the manager singleton instance.
Statemachine::_instance = new Statemachine();
// Start the manager task as a tacos task.
Statemachine::_instance->start();
}
return _instance;
@@ -39,7 +50,7 @@ namespace sta
void func() override;
uint16_t getCurrentState();
uint16_t getCurrentState() const;
private:
static Statemachine * _instance;
@@ -63,11 +74,17 @@ namespace sta
~Statemachine() {}
private:
static void forceStateChange(void * arg);
private:
uint16_t currentState_;
RtosTimer lockoutTimer_;
RtosTimer failsafeTimer_;
};
} // namespace tacos
} // namespace sta
#endif // STA_TACOS_NUM_STATES
#endif /* INCLUDE_TACOS_STATEMACHINE_HPP_ */