diff --git a/.cproject b/.cproject
index c112998..400127d 100644
--- a/.cproject
+++ b/.cproject
@@ -25,6 +25,7 @@
+
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index fa3c189..69eae04 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/App/Src/startup.cpp b/App/Src/startup.cpp
index 87dfde0..4fe3a2b 100644
--- a/App/Src/startup.cpp
+++ b/App/Src/startup.cpp
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include
@@ -39,6 +40,10 @@ namespace sta
Manager::instance()->registerThread(std::make_shared("State 2 - FAIL"), {2});
Manager::instance()->registerThread(std::make_shared(), {0, 1});
Manager::instance()->registerThread(std::make_shared(), {0, 1});
+
+ STA_DEBUG_PRINTF("The answer to everything is %d", 42);
+
+ STA_DEBUG_HEAP_STATS();
}
} // namespace tacos
} // namespace sta
diff --git a/App/Src/tasks/toggle.cpp b/App/Src/tasks/toggle.cpp
index e43b296..cdeb197 100644
--- a/App/Src/tasks/toggle.cpp
+++ b/App/Src/tasks/toggle.cpp
@@ -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);
+ }
}
}
diff --git a/Libs/rtos2-utils b/Libs/rtos2-utils
index 615900f..dccdaca 160000
--- a/Libs/rtos2-utils
+++ b/Libs/rtos2-utils
@@ -1 +1 @@
-Subproject commit 615900f16e246f3f33eebb9b022b7da3c62b7162
+Subproject commit dccdacae426f699405da195f7d6ddb283a12e632
diff --git a/Libs/sta-core b/Libs/sta-core
index 4da1f0b..fb17c11 160000
--- a/Libs/sta-core
+++ b/Libs/sta-core
@@ -1 +1 @@
-Subproject commit 4da1f0bb7dd48f89e9dd5ee0ec181638894e55e2
+Subproject commit fb17c11903d1e7c92a2de3ea08bbed8386a7f35a
diff --git a/Tacos/src/thread.cpp b/Tacos/src/thread.cpp
index d6a1226..49c6b14 100644
--- a/Tacos/src/thread.cpp
+++ b/Tacos/src/thread.cpp
@@ -81,21 +81,26 @@ namespace sta
// Infinite loop allowing quick restarts of this thread after termination.
while (true)
{
- // The thread has to wait until the startup has been completed.
+ // The thread has to wait until the system startup has been completed.
rtos::waitForStartupEvent();
// Wait for a thread start flag.
wait(STA_RTOS_THREAD_FLAG_START);
+ // Call user-defined initialization code.
running_ = true;
init();
- // Run the thread until the termination flag is set.
- while (!resetTerminationRequest())
+ // Run the thread until the termination flag is set. Reset this
+ while (!isTerminationRequested())
{
func();
}
+ // Clear the termination request flag for this thread.
+ deleteTerminationRequest();
+
+ // Call user-defined cleanup code.
cleanup();
running_ = false;
}