Fixed a few problem due to the events rework

This commit is contained in:
dario 2025-03-24 20:22:09 +01:00
parent 93c70de8d7
commit 6526139de7
3 changed files with 16 additions and 16 deletions

View File

@ -35,40 +35,40 @@ namespace sta
if (tickTimer == nullptr) if (tickTimer == nullptr)
{ {
tickTimer = new sta::RtosTimer([]() { tickTimer = new sta::RtosTimer([](void * args) {
uint32_t flags = 0x00; uint32_t flags = 0x00;
flags |= Types::TICK_100Hz; flags |= (uint32_t)Types::TICK_100Hz;
if (tickCounter % 20 == 0) { if (tickCounter % 20 == 0) {
flags |= Types::TICK_50Hz; flags |= (uint32_t)Types::TICK_50Hz;
} else { } else {
flags |= Types::TOCK_50Hz; flags |= (uint32_t)Types::TOCK_50Hz;
} }
if (tickCounter % 50 == 0) { if (tickCounter % 50 == 0) {
flags |= Types::TICK_20Hz; flags |= (uint32_t)Types::TICK_20Hz;
} else if (tickCounter % 25 == 0) { } else if (tickCounter % 25 == 0) {
flags |= Types::TOCK_20Hz; flags |= (uint32_t)Types::TOCK_20Hz;
} }
if (tickCounter % 100) { if (tickCounter % 100) {
flags |= Types::TICK_10Hz; flags |= (uint32_t)Types::TICK_10Hz;
} else if (tickCounter % 50 == 0) { } else if (tickCounter % 50 == 0) {
flags |= Types::TOCK_10Hz; flags |= (uint32_t)Types::TOCK_10Hz;
} }
if (tickCounter % 1000) { if (tickCounter % 1000) {
flags |= Types::TICK_1Hz; flags |= (uint32_t)Types::TICK_1Hz;
} else if (tickCounter % 500 == 0) { } else if (tickCounter % 500 == 0) {
flags |= Types::TOCK_1Hz; flags |= (uint32_t)Types::TOCK_1Hz;
} }
tickCounter = (tickCounter + 10) % 1000; tickCounter = (tickCounter + 10) % 1000;
signal(flags); signal(flags);
systemEvents->clear(0xFFFFFFFF); systemEvents->clear(0xFFFFFFFF);
}, true); }, nullptr, true);
tickTimer->start(10); tickTimer->start(10);
} }
@ -88,12 +88,12 @@ namespace sta
void signalStartup() void signalStartup()
{ {
signalSystemEvents(STA_TACOS_SYSTEM_EVENTS_STARTUP); signal(STA_TACOS_SYSTEM_EVENTS_STARTUP);
} }
void waitForStartup() void waitForStartup()
{ {
waitForSystemEvents(STA_TACOS_SYSTEM_EVENTS_STARTUP, osFlagsWaitAll, osWaitForever); wait(STA_TACOS_SYSTEM_EVENTS_STARTUP, osFlagsWaitAll, osWaitForever);
} }
} // namespace events } // namespace events
} // namespace tacos } // namespace tacos

View File

@ -158,13 +158,13 @@ void startTACOS(void * arg)
sta::initHAL(); sta::initHAL();
// Initialize RTOS system events // Initialize RTOS system events
sta::tacos::initSystemEvents(); sta::tacos::events::init();
// Call further initialization code // Call further initialization code
sta::tacos::startupExtras(arg); sta::tacos::startupExtras(arg);
// Wake threads // Wake threads
sta::tacos::signalStartupEvent(); sta::tacos::events::signalStartup();
// Check if called from thread // Check if called from thread
if (osThreadGetId() != nullptr) if (osThreadGetId() != nullptr)

View File

@ -64,7 +64,7 @@ namespace sta
while (true) while (true)
{ {
// The thread has to wait until the system startup has been completed. // The thread has to wait until the system startup has been completed.
sta::tacos::waitForStartupEvent(); sta::tacos::events::waitForStartup();
// Wait for a thread start flag. // Wait for a thread start flag.
wait(STA_RTOS_THREAD_FLAG_START); wait(STA_RTOS_THREAD_FLAG_START);