From f03b7cd6600fcabe6e1969630e942e4e85e80b09 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Jul 2022 20:10:15 +0200 Subject: [PATCH] another bugfix in CSB --- src/fsfw/pus/Service1TelecommandVerification.cpp | 11 +++++++++++ src/fsfw/tmtcservices/CommandingServiceBase.cpp | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/fsfw/pus/Service1TelecommandVerification.cpp b/src/fsfw/pus/Service1TelecommandVerification.cpp index 46d7237c9..9d8ca1118 100644 --- a/src/fsfw/pus/Service1TelecommandVerification.cpp +++ b/src/fsfw/pus/Service1TelecommandVerification.cpp @@ -49,6 +49,17 @@ ReturnValue_t Service1TelecommandVerification::performOperation(uint8_t operatio ReturnValue_t Service1TelecommandVerification::sendVerificationReport( PusVerificationMessage* message) { ReturnValue_t result; + uint8_t reportId = message->getReportId(); + if(reportId == 0 or reportId > 8) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "Service1TelecommandVerification::sendVerificationReport: Invalid report ID " << + static_cast(reportId) << " detected" << std::endl; +#else + sif::printError("Service1TelecommandVerification::sendVerificationReport: Invalid report ID " + "%d detected\n", reportId); +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } if (message->getReportId() % 2 == 0) { result = generateFailureReport(message); } else { diff --git a/src/fsfw/tmtcservices/CommandingServiceBase.cpp b/src/fsfw/tmtcservices/CommandingServiceBase.cpp index 5278fc6c1..c12a47b2c 100644 --- a/src/fsfw/tmtcservices/CommandingServiceBase.cpp +++ b/src/fsfw/tmtcservices/CommandingServiceBase.cpp @@ -457,8 +457,8 @@ void CommandingServiceBase::prepareVerificationFailureWithFullInfo(uint8_t repor } void CommandingServiceBase::prepareVerificationSuccessWithFullInfo( uint8_t reportId, CommandingServiceBase::CommandInfo::TcInfo& tcInfo) { - failParams.reportId = reportId; - failParams.tcPacketId = tcInfo.tcPacketId; - failParams.tcPsc = tcInfo.tcSequenceControl; - failParams.ackFlags = tcInfo.ackFlags; + successParams.reportId = reportId; + successParams.tcPacketId = tcInfo.tcPacketId; + successParams.tcPsc = tcInfo.tcSequenceControl; + successParams.ackFlags = tcInfo.ackFlags; }