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

View File

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

View File

@ -64,7 +64,7 @@ namespace sta
while (true)
{
// 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(STA_RTOS_THREAD_FLAG_START);