mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-09-29 02:57:33 +00:00
Working manager & statemachine tasks; timers still bugged; statemachine init bugged
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <sta/tacos/manager.hpp>
|
||||
#include <sta/tacos/statemachine.hpp>
|
||||
#include <sta/debug/debug.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
@@ -69,11 +70,20 @@ namespace sta
|
||||
|
||||
void Manager::init()
|
||||
{
|
||||
STA_DEBUG_PRINTLN("INITIALIZING MANAGER!");
|
||||
|
||||
startThreads(Statemachine::instance()->getCurrentState());
|
||||
}
|
||||
|
||||
void Manager::func()
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
// STA_DEBUG_PRINTLN("LOOPY LOOP IN MANAGER TASK");
|
||||
osDelay(1000);
|
||||
}
|
||||
|
||||
|
||||
// Wait for either the termination request or the state change flag.
|
||||
uint32_t flags = osEventFlagsWait(getInstance(), STA_RTOS_THREAD_FLAG_TERMINATE, osFlagsWaitAny, osWaitForever);
|
||||
|
||||
|
@@ -69,7 +69,7 @@ namespace sta
|
||||
{
|
||||
onManagerInit();
|
||||
|
||||
Statemachine::instance()->start();
|
||||
Manager::instance()->start();
|
||||
}
|
||||
} // namespace tacos
|
||||
|
||||
|
@@ -7,23 +7,43 @@
|
||||
|
||||
#include <sta/tacos/statemachine.hpp>
|
||||
|
||||
#include <sta/debug/debug.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace tacos
|
||||
{
|
||||
Statemachine::Statemachine(){}
|
||||
Statemachine::Statemachine()
|
||||
: currentState_{STA_TACOS_INITIAL_STATE}, lockoutTimer_{[](void *){}, NULL}, failsafeTimer_{[](void *){}, NULL}
|
||||
{
|
||||
STA_ASSERT(STA_TACOS_INITIAL_STATE < STA_TACOS_NUM_STATES);
|
||||
}
|
||||
|
||||
void Statemachine::init()
|
||||
{
|
||||
STA_DEBUG_PRINTLN("INITIALIZING STATEMACHINE");
|
||||
|
||||
/*
|
||||
lockoutTimer_.setCallback([](void *) { STA_DEBUG_PRINTLN("Lockout timer triggered!"); }, NULL);
|
||||
lockoutTimer_.start(1000);
|
||||
|
||||
failsafeTimer_.setCallback([](void *) { STA_DEBUG_PRINTLN("Failsafe timer triggered!"); }, NULL);
|
||||
failsafeTimer_.start(2000);
|
||||
*/
|
||||
}
|
||||
|
||||
void Statemachine::func()
|
||||
{
|
||||
// STA_DEBUG_PRINTLN("LOOPY LOOP IN STATEMACHINE");
|
||||
|
||||
STA_DEBUG_PRINT("Failsafe timer is running: ");
|
||||
STA_DEBUG_PRINTLN(failsafeTimer_.isRunning());
|
||||
|
||||
osDelay(1000);
|
||||
}
|
||||
|
||||
uint16_t Statemachine::getCurrentState()
|
||||
uint16_t Statemachine::getCurrentState() const
|
||||
{
|
||||
return currentState_;
|
||||
}
|
||||
|
@@ -19,11 +19,14 @@ namespace sta
|
||||
{
|
||||
TacosThread::TacosThread(const char* name, osPriority_t prio)
|
||||
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
|
||||
instance_{ NULL },
|
||||
attribs_{ .name = name, .priority = prio }
|
||||
{}
|
||||
|
||||
TacosThread::TacosThread()
|
||||
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_)))
|
||||
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
|
||||
instance_{ NULL },
|
||||
attribs_{ }
|
||||
{}
|
||||
|
||||
void TacosThread::entry_point(void* arg)
|
||||
@@ -85,6 +88,7 @@ namespace sta
|
||||
}
|
||||
|
||||
void TacosThread::init(){}
|
||||
|
||||
void TacosThread::func(){}
|
||||
|
||||
TacosThread::~TacosThread(){}
|
||||
|
Reference in New Issue
Block a user