diff --git a/src/fsfw/osal/freertos/PeriodicTask.cpp b/src/fsfw/osal/freertos/PeriodicTask.cpp index 89c98a89c..37d8fc72c 100644 --- a/src/fsfw/osal/freertos/PeriodicTask.cpp +++ b/src/fsfw/osal/freertos/PeriodicTask.cpp @@ -6,14 +6,14 @@ PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStackSize setStack, TaskPeriod setPeriod, TaskDeadlineMissedFunction dlmFunc_) - : PeriodicTaskBase(setStack, dlmFunc_), started(false), handle(nullptr), period(setPeriod) { + : PeriodicTaskBase(setPeriod, dlmFunc_), started(false), handle(nullptr) { configSTACK_DEPTH_TYPE stackSize = setStack / sizeof(configSTACK_DEPTH_TYPE); BaseType_t status = xTaskCreate(taskEntryPoint, name, stackSize, this, setPriority, &handle); if (status != pdPASS) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "PeriodicTask Insufficient heap memory remaining. " - "Status: " - << status << std::endl; + sif::debug << "PeriodicTask::PeriodicTask Insufficient heap memory remaining. Status: " << status << std::endl; +#else + sif::printDebug("PeriodicTask::PeriodicTask: Insufficient heap memory remaining. Status: %d\n", status); #endif } } @@ -65,9 +65,7 @@ ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) { TickType_t xLastWakeTime; const TickType_t xPeriod = pdMS_TO_TICKS(this->period * 1000.); - for (auto const& object : objectList) { - object->initializeAfterTaskCreation(); - } + initObjsAfterTaskCreation(); /* The xLastWakeTime variable needs to be initialized with the current tick count. Note that this is the only time the variable is written to @@ -76,8 +74,8 @@ ReturnValue_t PeriodicTask::sleepFor(uint32_t ms) { xLastWakeTime = xTaskGetTickCount(); /* Enter the loop that defines the task behavior. */ for (;;) { - for (auto const& object : objectList) { - object->performOperation(); + for (auto const& objectPair : objectList) { + objectPair.first->performOperation(objectPair.second); } #if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || tskKERNEL_VERSION_MAJOR > 10 diff --git a/src/fsfw/osal/freertos/PeriodicTask.h b/src/fsfw/osal/freertos/PeriodicTask.h index 30a79b88e..c3fb9d70d 100644 --- a/src/fsfw/osal/freertos/PeriodicTask.h +++ b/src/fsfw/osal/freertos/PeriodicTask.h @@ -62,20 +62,6 @@ class PeriodicTask : public PeriodicTaskBase, public FreeRTOSTaskIF { bool started; TaskHandle_t handle; - //! Typedef for the List of objects. - typedef std::vector ObjectList; - /** - * @brief This attribute holds a list of objects to be executed. - */ - ObjectList objectList; - /** - * @brief The period of the task. - * @details - * The period determines the frequency of the task's execution. - * It is expressed in clock ticks. - */ - TaskPeriod period; - /** * @brief This is the function executed in the new task's context. * @details diff --git a/tests/src/fsfw_tests/integration/task/TestTask.cpp b/tests/src/fsfw_tests/integration/task/TestTask.cpp index 765f780e6..a6a4a30b0 100644 --- a/tests/src/fsfw_tests/integration/task/TestTask.cpp +++ b/tests/src/fsfw_tests/integration/task/TestTask.cpp @@ -12,7 +12,7 @@ TestTask::TestTask(object_id_t objectId) : SystemObject(objectId), testMode(test IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); } -TestTask::~TestTask() {} +TestTask::~TestTask() = default; ReturnValue_t TestTask::performOperation(uint8_t operationCode) { ReturnValue_t result = RETURN_OK; diff --git a/tests/src/fsfw_tests/integration/task/TestTask.h b/tests/src/fsfw_tests/integration/task/TestTask.h index cd630ee3a..038355c32 100644 --- a/tests/src/fsfw_tests/integration/task/TestTask.h +++ b/tests/src/fsfw_tests/integration/task/TestTask.h @@ -13,9 +13,9 @@ */ class TestTask : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF { public: - TestTask(object_id_t objectId); - virtual ~TestTask(); - virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; + explicit TestTask(object_id_t objectId); + ~TestTask() override; + ReturnValue_t performOperation(uint8_t operationCode) override; protected: virtual ReturnValue_t performOneShotAction();