From 504c8177e8b428818108b57e091b77ee1e0155a8 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 24 Apr 2020 17:05:34 +0200 Subject: [PATCH 1/7] uninitialized variable --- parameters/ParameterWrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parameters/ParameterWrapper.cpp b/parameters/ParameterWrapper.cpp index 8f661bb32..1dac70757 100644 --- a/parameters/ParameterWrapper.cpp +++ b/parameters/ParameterWrapper.cpp @@ -91,7 +91,7 @@ template ReturnValue_t ParameterWrapper::serializeData(uint8_t** buffer, uint32_t* size, const uint32_t max_size, bool bigEndian) const { const T *element = (const T*) readonlyData; - ReturnValue_t result; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; uint16_t dataSize = columns * rows; while (dataSize != 0) { result = SerializeAdapter::serialize(element, buffer, size, max_size, From 75da7a4c500e343b559406ecb1877d7ec750fd29 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:55:05 +0200 Subject: [PATCH 2/7] comment moved to header --- devicehandlers/FixedSlotSequence.cpp | 1 - devicehandlers/FixedSlotSequence.h | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index a65dd929e..9ff5a1404 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -89,7 +89,6 @@ uint32_t FixedSlotSequence::getLengthMs() const { } ReturnValue_t FixedSlotSequence::checkSequence() const { - //Iterate through slotList and check successful creation. Checks if timing is ok (must be ascending) and if all handlers were found. auto slotIt = slotList.begin(); uint32_t count = 0; uint32_t time = 0; diff --git a/devicehandlers/FixedSlotSequence.h b/devicehandlers/FixedSlotSequence.h index f8fd9a36f..1da9d3509 100644 --- a/devicehandlers/FixedSlotSequence.h +++ b/devicehandlers/FixedSlotSequence.h @@ -97,6 +97,11 @@ public: */ std::list::iterator current; + /** + * Iterate through slotList and check successful creation. + * Checks if timing is ok (must be ascending) and if all handlers were found. + * @return + */ ReturnValue_t checkSequence() const; protected: From a6b3cee898a8be16658cda04153e11829a5db372 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:56:45 +0200 Subject: [PATCH 3/7] class comment formatting --- devicehandlers/FixedSlotSequence.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/devicehandlers/FixedSlotSequence.h b/devicehandlers/FixedSlotSequence.h index 1da9d3509..64c68aeae 100644 --- a/devicehandlers/FixedSlotSequence.h +++ b/devicehandlers/FixedSlotSequence.h @@ -6,15 +6,21 @@ #include /** - * \brief This class is the representation of a Polling Sequence Table in software. + * @brief This class is the representation of a Polling Sequence Table in software. * - * \details The FixedSlotSequence object maintains the dynamic execution of device handler objects. - * The main idea is to create a list of device handlers, to announce all handlers to the - * polling sequence and to maintain a list of polling slot objects. This slot list represents the - * Polling Sequence Table in software. Each polling slot contains information to indicate when and - * which device handler shall be executed within a given polling period. - * The sequence is then executed by iterating through this slot list. - * Handlers are invoking by calling a certain function stored in the handler list. + * @details + * The FixedSlotSequence object maintains the dynamic execution of + * device handler objects. + * + * The main idea is to create a list of device handlers, to announce all + * handlers to thepolling sequence and to maintain a list of + * polling slot objects. This slot list represents the Polling Sequence Table + * in software. + * + * Each polling slot contains information to indicate when and + * which device handler shall be executed within a given polling period. + * The sequence is then executed by iterating through this slot list. + * Handlers are invoking by calling a certain function stored in the handler list. */ class FixedSlotSequence { public: From 432dbbd26eca201025d5d064425881f8b3f40222 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 18:57:30 +0200 Subject: [PATCH 4/7] removed sif --- devicehandlers/FixedSlotSequence.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index 9ff5a1404..bf9ff4fda 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -89,6 +89,10 @@ uint32_t FixedSlotSequence::getLengthMs() const { } ReturnValue_t FixedSlotSequence::checkSequence() const { + if(slotList.empty()) { + error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; + std::exit(0); + } auto slotIt = slotList.begin(); uint32_t count = 0; uint32_t time = 0; From 98e505c9ab3fc42513390e859bc98df201fe3cc0 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:03:00 +0200 Subject: [PATCH 5/7] todo removed --- osal/FreeRTOS/FixedTimeslotTask.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osal/FreeRTOS/FixedTimeslotTask.cpp b/osal/FreeRTOS/FixedTimeslotTask.cpp index e621d3121..74ce9b781 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.cpp +++ b/osal/FreeRTOS/FixedTimeslotTask.cpp @@ -59,8 +59,8 @@ ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { if (objectManager->get(componentId) != nullptr) { if(slotTimeMs == 0) { - // TODO: FreeRTOS throws errors for zero values. - // maybe there is a better solution than this. + // FreeRTOS throws a sanity error for zero values, so we set + // the time to one millisecond. slotTimeMs = 1; } pst.addSlot(componentId, slotTimeMs, executionStep, this); From c4486e79eca8fa258b744bf27cf364b5258fc2ba Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:30:26 +0200 Subject: [PATCH 6/7] removed exit for empty pst --- devicehandlers/FixedSlotSequence.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index bf9ff4fda..61959ac05 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -91,7 +91,6 @@ uint32_t FixedSlotSequence::getLengthMs() const { ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; - std::exit(0); } auto slotIt = slotList.begin(); uint32_t count = 0; From 119455f3fd7f65ebd4559c14e8e5a763a2870936 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 5 May 2020 19:33:06 +0200 Subject: [PATCH 7/7] replaced exit by returning failed --- devicehandlers/FixedSlotSequence.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/devicehandlers/FixedSlotSequence.cpp b/devicehandlers/FixedSlotSequence.cpp index 61959ac05..dae62bdde 100644 --- a/devicehandlers/FixedSlotSequence.cpp +++ b/devicehandlers/FixedSlotSequence.cpp @@ -91,6 +91,7 @@ uint32_t FixedSlotSequence::getLengthMs() const { ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { error << "Fixed Slot Sequence: Slot list is empty!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; } auto slotIt = slotList.begin(); uint32_t count = 0;