diff --git a/src/fsfw/osal/host/FixedTimeslotTask.cpp b/src/fsfw/osal/host/FixedTimeslotTask.cpp index 931e6a220..198152412 100644 --- a/src/fsfw/osal/host/FixedTimeslotTask.cpp +++ b/src/fsfw/osal/host/FixedTimeslotTask.cpp @@ -74,8 +74,10 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) { return HasReturnvaluesIF::RETURN_OK; } -[[noreturn]] void FixedTimeslotTask::taskFunctionality() { - pollingSeqTable.intializeSequenceAfterTaskCreation(); +void FixedTimeslotTask::taskFunctionality() { + ReturnValue_t result = pollingSeqTable.intializeSequenceAfterTaskCreation(); + // Ignore returnvalue for now + static_cast(result); // A local iterator for the Polling Sequence Table is created to // find the start time for the first entry. diff --git a/src/fsfw/osal/host/FixedTimeslotTask.h b/src/fsfw/osal/host/FixedTimeslotTask.h index d85ad34c5..2823f6242 100644 --- a/src/fsfw/osal/host/FixedTimeslotTask.h +++ b/src/fsfw/osal/host/FixedTimeslotTask.h @@ -93,7 +93,7 @@ class FixedTimeslotTask : public FixedTimeslotTaskBase { * the checkAndRestartPeriod system call blocks the task until the next * period. On missing the deadline, the deadlineMissedFunction is executed. */ - [[noreturn]] void taskFunctionality(); + void taskFunctionality(); static bool delayForInterval(chron_ms* previousWakeTimeMs, chron_ms interval); }; diff --git a/src/fsfw/tasks/FixedSlotSequence.cpp b/src/fsfw/tasks/FixedSlotSequence.cpp index 62c0e99c8..9305b4416 100644 --- a/src/fsfw/tasks/FixedSlotSequence.cpp +++ b/src/fsfw/tasks/FixedSlotSequence.cpp @@ -29,7 +29,7 @@ void FixedSlotSequence::executeAndAdvance() { uint32_t FixedSlotSequence::getIntervalToNextSlotMs() { uint32_t oldTime; - SlotListIter slotListIter = current; + auto slotListIter = current; // Get the pollingTimeMs of the current slot object. oldTime = slotListIter->pollingTimeMs; // Advance to the next object. @@ -51,7 +51,7 @@ uint32_t FixedSlotSequence::getIntervalToNextSlotMs() { uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() { uint32_t currentTime; - SlotListIter slotListIter = current; + auto slotListIter = current; // Get the pollingTimeMs of the current slot object. currentTime = slotListIter->pollingTimeMs; @@ -67,7 +67,7 @@ uint32_t FixedSlotSequence::getIntervalToPreviousSlotMs() { bool FixedSlotSequence::slotFollowsImmediately() { uint32_t currentTime = current->pollingTimeMs; - SlotListIter fixedSequenceIter = this->current; + auto fixedSequenceIter = this->current; // Get the pollingTimeMs of the current slot object. if (fixedSequenceIter == slotList.begin()) return false; fixedSequenceIter--; @@ -96,8 +96,8 @@ ReturnValue_t FixedSlotSequence::checkSequence() const { return FixedTimeslotTaskIF::SLOT_LIST_EMPTY; } - if (customCheckFunction != nullptr) { - ReturnValue_t result = customCheckFunction(slotList); + if (customChecker != nullptr) { + ReturnValue_t result = customChecker(slotList, customCheckArgs); if (result != HasReturnvaluesIF::RETURN_OK) { // Continue for now but print error output. #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -161,8 +161,9 @@ ReturnValue_t FixedSlotSequence::intializeSequenceAfterTaskCreation() const { return HasReturnvaluesIF::RETURN_OK; } -void FixedSlotSequence::addCustomCheck(ReturnValue_t (*customCheckFunction)(const SlotList&)) { - this->customCheckFunction = customCheckFunction; +void FixedSlotSequence::addCustomCheck(CustomCheckFunc customChecker_, void* checkerArgs_) { + customChecker = customChecker_; + customCheckArgs = checkerArgs_; } bool FixedSlotSequence::isEmpty() const { return slotList.empty(); } diff --git a/src/fsfw/tasks/FixedSlotSequence.h b/src/fsfw/tasks/FixedSlotSequence.h index 838963c1c..2e38ee4b4 100644 --- a/src/fsfw/tasks/FixedSlotSequence.h +++ b/src/fsfw/tasks/FixedSlotSequence.h @@ -30,7 +30,7 @@ class FixedSlotSequence { public: using SlotList = std::multiset; using SlotListIter = std::multiset::iterator; - + using CustomCheckFunc = ReturnValue_t (*)(const SlotList&, void* args); /** * @brief The constructor of the FixedSlotSequence object. * @param setLength The period length, expressed in ms. @@ -106,7 +106,7 @@ class FixedSlotSequence { /** * @brief This method returns the length of this FixedSlotSequence instance. */ - uint32_t getLengthMs() const; + [[nodiscard]] uint32_t getLengthMs() const; /** * @brief The method to execute the device handler entered in the current @@ -137,7 +137,7 @@ class FixedSlotSequence { * @return * - SLOT_LIST_EMPTY if the slot list is empty */ - ReturnValue_t checkSequence() const; + [[nodiscard]] ReturnValue_t checkSequence() const; /** * @brief A custom check can be injected for the respective slot list. @@ -149,7 +149,7 @@ class FixedSlotSequence { * @param customCheckFunction * */ - void addCustomCheck(ReturnValue_t (*customCheckFunction)(const SlotList&)); + void addCustomCheck(CustomCheckFunc func, void* userArgs); /** * @brief Perform any initialization steps required after the executing @@ -157,9 +157,9 @@ class FixedSlotSequence { * executing task! * @return */ - ReturnValue_t intializeSequenceAfterTaskCreation() const; + [[nodiscard]] ReturnValue_t intializeSequenceAfterTaskCreation() const; - bool isEmpty() const; + [[nodiscard]] bool isEmpty() const; protected: /** @@ -175,7 +175,8 @@ class FixedSlotSequence { */ SlotList slotList; - ReturnValue_t (*customCheckFunction)(const SlotList&) = nullptr; + CustomCheckFunc customChecker = nullptr; + void* customCheckArgs = nullptr; uint32_t lengthMs; };