From 118a829420ab55a9fcec7a925a8d2e04f4f40dc3 Mon Sep 17 00:00:00 2001 From: CarlWachter Date: Fri, 22 Sep 2023 19:56:19 +0200 Subject: [PATCH] Fixed compiler errors --- .cproject | 14 ++++++------- .settings/language.settings.xml | 4 ++-- .settings/stm32cubeide.project.prefs | 4 ++-- App/Inc/tasks/dummy.hpp | 1 + App/Src/tasks/dummy.cpp | 2 ++ Libs/rtos2-utils | 2 +- Libs/sta-core | 2 +- Tacos/include/sta/tacos/manager.hpp | 31 ++++++++++++++-------------- Tacos/include/sta/tacos/thread.hpp | 4 ++++ Tacos/src/manager.cpp | 4 ++++ Tacos/src/statemachine.cpp | 5 +++++ Tacos/src/thread.cpp | 14 ++++++++++--- 12 files changed, 55 insertions(+), 32 deletions(-) diff --git a/.cproject b/.cproject index 178b7ac..ad382b7 100644 --- a/.cproject +++ b/.cproject @@ -216,20 +216,20 @@ + - - - - - - + + + + + + - \ No newline at end of file diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 4089cb2..c21b7c1 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/.settings/stm32cubeide.project.prefs b/.settings/stm32cubeide.project.prefs index 0ad0f8c..7d34349 100644 --- a/.settings/stm32cubeide.project.prefs +++ b/.settings/stm32cubeide.project.prefs @@ -1,5 +1,5 @@ 635E684B79701B039C64EA45C3F84D30=C96BA6CC9F20E1205A6EBDFF40205165 66BE74F758C12D739921AEA421D593D3=4 -8DF89ED150041C4CBC7CB9A9CAA90856=D6E44E0C9E8538D2672E3627575EB9A7 -DC22A860405A8BF2F2C095E5B6529F12=D6E44E0C9E8538D2672E3627575EB9A7 +8DF89ED150041C4CBC7CB9A9CAA90856=C37D8D153607683CBCB65A289104E87E +DC22A860405A8BF2F2C095E5B6529F12=D2A4E69D593A17CDA189062ADCC0CBF3 eclipse.preferences.version=1 diff --git a/App/Inc/tasks/dummy.hpp b/App/Inc/tasks/dummy.hpp index aea9df6..0c7de2b 100644 --- a/App/Inc/tasks/dummy.hpp +++ b/App/Inc/tasks/dummy.hpp @@ -15,6 +15,7 @@ namespace demo class DummyTask : public sta::tacos::TacosThread { public: DummyTask(const char* name); + ~DummyTask() override; void init() override; diff --git a/App/Src/tasks/dummy.cpp b/App/Src/tasks/dummy.cpp index 90bb5f2..c93f329 100644 --- a/App/Src/tasks/dummy.cpp +++ b/App/Src/tasks/dummy.cpp @@ -19,6 +19,8 @@ namespace demo } + DummyTask::~DummyTask(){} + void DummyTask::init() { STA_DEBUG_PRINTLN("Initialized dummy task!"); diff --git a/Libs/rtos2-utils b/Libs/rtos2-utils index ad6c4fd..f813e7b 160000 --- a/Libs/rtos2-utils +++ b/Libs/rtos2-utils @@ -1 +1 @@ -Subproject commit ad6c4fd297865cb697037052d3b354b6d2405fe1 +Subproject commit f813e7b6eacdde978bf77ed9a1bce7fb38ab4c1d diff --git a/Libs/sta-core b/Libs/sta-core index 8e93db1..1498bcc 160000 --- a/Libs/sta-core +++ b/Libs/sta-core @@ -1 +1 @@ -Subproject commit 8e93db18174937562f246af4b1e8d99bd6bbf632 +Subproject commit 1498bcc449bd1c0756aaa1b1e33251288091f9ab diff --git a/Tacos/include/sta/tacos/manager.hpp b/Tacos/include/sta/tacos/manager.hpp index 3de94c7..e59ffba 100644 --- a/Tacos/include/sta/tacos/manager.hpp +++ b/Tacos/include/sta/tacos/manager.hpp @@ -48,27 +48,13 @@ namespace sta void func() override; - private: - class CGuard - { - public: - ~CGuard() - { - if( NULL != Manager::_instance ) - { - delete Manager::_instance; - Manager::_instance = NULL; - } - } - }; - static Manager* _instance; - + private: Manager(); Manager(const Manager&); - ~Manager() {} + //~Manager(); void updateThreads(); @@ -77,6 +63,19 @@ namespace sta void stopThreads(uint16_t state); std::set threads_[STA_TACOS_NUM_STATES]; + + class CGuard + { + public: + ~CGuard() + { + if( NULL != Manager::_instance ) + { + delete Manager::_instance; + Manager::_instance = NULL; + } + } + }; }; } // namespace tacos } // namespace sta diff --git a/Tacos/include/sta/tacos/thread.hpp b/Tacos/include/sta/tacos/thread.hpp index 94d1a1a..0b9bf4f 100644 --- a/Tacos/include/sta/tacos/thread.hpp +++ b/Tacos/include/sta/tacos/thread.hpp @@ -25,6 +25,8 @@ namespace sta */ TacosThread(const char* name, osPriority_t prio); + TacosThread(); + virtual ~TacosThread(); /** @@ -62,7 +64,9 @@ namespace sta * @brief The body of the thread's loop. Has to be implemented by the user. */ virtual void func(); + private: + /** * @brief Static function to pass to RTOS to run as a thread. Calls the loop function implemented here. */ diff --git a/Tacos/src/manager.cpp b/Tacos/src/manager.cpp index f95054f..e44ae79 100644 --- a/Tacos/src/manager.cpp +++ b/Tacos/src/manager.cpp @@ -93,6 +93,10 @@ namespace sta } + //Manager::~Manager(){} + + Manager* Manager::_instance = nullptr; + } // namespace tacos } // namespace sta diff --git a/Tacos/src/statemachine.cpp b/Tacos/src/statemachine.cpp index 9388863..3cc017e 100644 --- a/Tacos/src/statemachine.cpp +++ b/Tacos/src/statemachine.cpp @@ -11,6 +11,8 @@ namespace sta { namespace tacos { + Statemachine::Statemachine(){} + void Statemachine::init() { @@ -25,6 +27,9 @@ namespace sta { return currentState_; } + + Statemachine* Statemachine::_instance = nullptr; + } // namespace tacos } // namespace sta diff --git a/Tacos/src/thread.cpp b/Tacos/src/thread.cpp index 4a8e94b..09ab927 100644 --- a/Tacos/src/thread.cpp +++ b/Tacos/src/thread.cpp @@ -20,11 +20,13 @@ namespace sta TacosThread::TacosThread(const char* name, osPriority_t prio) : RtosThread(RtosHandle(Handle::Deferred(&instance_))), attribs_{ .name = name, .priority = prio } - { + {} - } + TacosThread::TacosThread() + : RtosThread(RtosHandle(Handle::Deferred(&instance_))) + {} - static void entry_point(void* arg) + void TacosThread::entry_point(void* arg) { STA_ASSERT(arg != nullptr); @@ -81,6 +83,12 @@ namespace sta { return std::strcmp(this->getName(), other.getName()) < 0; } + + void TacosThread::init(){} + void TacosThread::func(){} + + TacosThread::~TacosThread(){} + } // namespace tacos } // namespace sta