diff --git a/include/sta/tacos/thread.hpp b/include/sta/tacos/thread.hpp index 94b8aaf..1c9d929 100644 --- a/include/sta/tacos/thread.hpp +++ b/include/sta/tacos/thread.hpp @@ -98,6 +98,8 @@ namespace sta void loop() override; + void start() override; + /** * @brief This function is executed first when this thread is started. */ @@ -158,6 +160,8 @@ namespace sta * */ void resetStatus(); + + void watchdogIgnore(); #endif // STA_TACOS_WATCHDOG_ENABLED /** diff --git a/src/thread.cpp b/src/thread.cpp index 64b967d..9f1f301 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -38,6 +38,18 @@ namespace sta return running_; } + void TacosThread::start() + { + if (getInstance() == NULL) + { + RtosThread::start(); + } + else + { + sysNotify(STA_RTOS_THREAD_FLAG_START); + } + } + void TacosThread::init() {} void TacosThread::loop() @@ -59,8 +71,11 @@ namespace sta while (!isTerminationRequested()) { #ifdef STA_TACOS_WATCHDOG_ENABLED - // Send a fresh heartbeat signal. - heartbeat(); + if (status_ == ThreadStatus::UNKNOWN) + { + // Send a fresh heartbeat signal. + heartbeat(); + } #endif // STA_TACOS_WATCHDOG_ENABLED // Execute user-space implementation. @@ -116,6 +131,11 @@ namespace sta { status_ = ThreadStatus::UNKNOWN; } + + void TacosThread::watchdogIgnore() + { + status_ = ThreadStatus::IGNORED; + } #endif // STA_TACOS_WATCHDOG_ENABLED void TacosThread::requestTermination()