Important bugfix and improvement for PCDU Handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

- Fixed out of bounds error
- Handle multiple messages in queue handler
- PCDU Handler now only called once in PST
This commit is contained in:
Robin Müller 2022-04-21 09:35:02 +02:00
parent 23730349b0
commit e5d5af68c1
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 21 additions and 15 deletions

2
fsfw

@ -1 +1 @@
Subproject commit e949368b062e8703c35d2043ece8d7258cd2608b Subproject commit cec12c007336441ea0f5ce912c181c3f14e574ca

View File

@ -514,7 +514,6 @@ ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
#if Q7S_EM != 1 #if Q7S_EM != 1
// PCDU handlers receives two messages and both must be handled // 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::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::P60DOCK_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); thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);

View File

@ -81,27 +81,34 @@ ReturnValue_t PCDUHandler::initialize() {
void PCDUHandler::initializeSwitchStates() { void PCDUHandler::initializeSwitchStates() {
using namespace pcdu; using namespace pcdu;
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) { try {
if (idx < PDU::CHANNELS_LEN) { for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
switchStates[idx] = INIT_SWITCHES_PDU1[idx]; if (idx < PDU::CHANNELS_LEN) {
} else { switchStates[idx] = INIT_SWITCHES_PDU1.at(idx);
switchStates[idx] = INIT_SWITCHES_PDU2[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() { void PCDUHandler::readCommandQueue() {
ReturnValue_t result; ReturnValue_t result = RETURN_OK;
CommandMessage command; CommandMessage command;
result = commandQueue->receiveMessage(&command); for (result = commandQueue->receiveMessage(&command); result == RETURN_OK;
if (result != RETURN_OK) { result = commandQueue->receiveMessage(&command)) {
return; result = commandQueue->receiveMessage(&command);
} if (result != RETURN_OK) {
return;
}
result = poolManager.handleHousekeepingMessage(&command); result = poolManager.handleHousekeepingMessage(&command);
if (result == RETURN_OK) { if (result == RETURN_OK) {
return; return;
}
} }
} }