Changed TacosThread termination to work correctly; fixed bugs in the testing

This commit is contained in:
dario
2023-11-29 20:12:45 +01:00
committed by carlwachter
parent a70dc00f4c
commit 2b4e634179
7 changed files with 22 additions and 15 deletions

View File

@@ -16,6 +16,7 @@
#include <tasks/disturb.hpp>
#include <gpio.h>
#include <sta/devices/stm32/gpio_pin.hpp>
#include <sta/rtos/debug/heap_stats.hpp>
#include <memory>
@@ -39,6 +40,10 @@ namespace sta
Manager::instance()->registerThread(std::make_shared<demo::DummyTask>("State 2 - FAIL"), {2});
Manager::instance()->registerThread(std::make_shared<demo::Toggle>(), {0, 1});
Manager::instance()->registerThread(std::make_shared<demo::DisturbTask>(), {0, 1});
STA_DEBUG_PRINTF("The answer to everything is %d", 42);
STA_DEBUG_HEAP_STATS();
}
} // namespace tacos
} // namespace sta

View File

@@ -27,7 +27,7 @@ namespace demo
osDelay(5000);
// Have we been requested to terminate while waiting?
if (!isRunning())
if (isTerminationRequested())
return;
// Do some important stuff...
@@ -38,14 +38,10 @@ namespace demo
if (state != 2)
{
next = 1 - state;
}
else
{
next = 0;
}
STA_DEBUG_PRINTLN("Toggle!");
sta::tacos::Statemachine::instance()->requestStateTransition(state, next, 0);
STA_DEBUG_PRINTLN("Toggle!");
sta::tacos::Statemachine::instance()->requestStateTransition(state, next, 0);
}
}
}