From e5d5af68c148c5248bfc7e260fb2550a08c963fd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 21 Apr 2022 09:35:02 +0200 Subject: [PATCH 1/3] Important bugfix and improvement for PCDU Handler - Fixed out of bounds error - Handle multiple messages in queue handler - PCDU Handler now only called once in PST --- fsfw | 2 +- .../pollingSequenceFactory.cpp | 1 - mission/devices/PCDUHandler.cpp | 33 +++++++++++-------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/fsfw b/fsfw index e949368b..cec12c00 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e949368b062e8703c35d2043ece8d7258cd2608b +Subproject commit cec12c007336441ea0f5ce912c181c3f14e574ca diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 0f9232e0..942404d3 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -514,7 +514,6 @@ ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) { #if Q7S_EM != 1 // PCDU handlers receives two messages and both must be handled thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index bc302bac..10d12cf8 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -81,27 +81,34 @@ ReturnValue_t PCDUHandler::initialize() { void PCDUHandler::initializeSwitchStates() { using namespace pcdu; - for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { - if (idx < PDU::CHANNELS_LEN) { - switchStates[idx] = INIT_SWITCHES_PDU1[idx]; - } else { - switchStates[idx] = INIT_SWITCHES_PDU2[idx]; + try { + for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { + if (idx < PDU::CHANNELS_LEN) { + switchStates[idx] = INIT_SWITCHES_PDU1.at(idx); + } else { + switchStates[idx] = INIT_SWITCHES_PDU2.at(idx - PDU::CHANNELS_LEN); + } } + } catch (const std::out_of_range& err) { + sif::error << "PCDUHandler::initializeSwitchStates: " << err.what() << std::endl; } } void PCDUHandler::readCommandQueue() { - ReturnValue_t result; + ReturnValue_t result = RETURN_OK; CommandMessage command; - result = commandQueue->receiveMessage(&command); - if (result != RETURN_OK) { - return; - } + for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; + result = commandQueue->receiveMessage(&command)) { + result = commandQueue->receiveMessage(&command); + if (result != RETURN_OK) { + return; + } - result = poolManager.handleHousekeepingMessage(&command); - if (result == RETURN_OK) { - return; + result = poolManager.handleHousekeepingMessage(&command); + if (result == RETURN_OK) { + return; + } } } From 4a5ea4450f75b0d9975d9017f3a241185ac0227e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 22 Apr 2022 10:59:43 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d29e7b..7982b2ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ list yields a list of all related PRs for each release. ## Changed +- PCDU handler only called once in PST, but can handle multiple messages now - Update rootfs base of Linux, all related OBSW changes - Use gpsd version 3.17 now. Includes API changes - Add `/usr/local/bin` to PATH. All shell scripts are there now From ba2589c8d52200398886312bec6c12428769273c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Apr 2022 12:30:49 +0200 Subject: [PATCH 3/3] submodule updates --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 24ef96d1..280b641c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 24ef96d1b802e768d395f94b69f9f81a3c6d1e66 +Subproject commit 280b641cbc621d0c00c89851aaffbb64d5e5f40b diff --git a/tmtc b/tmtc index 28983d38..b1aaef90 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 28983d387b82578a73fbfe052cb53dec1910d021 +Subproject commit b1aaef90c72874f501c6524ec967827f17e8cedf