From 7f1fe3a2d82c9cd7fd13b855a187b595e45b6dae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 19:58:22 +0200 Subject: [PATCH] bugfix --- linux/ipcore/PdecHandler.cpp | 9 ++++++++- linux/ipcore/PdecHandler.h | 32 +++----------------------------- linux/ipcore/pdec.h | 28 ++++++++++++++++++++++++++++ mission/system/EiveSystem.cpp | 3 ++- 4 files changed, 41 insertions(+), 31 deletions(-) diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index 70eaf3e6..7506dd11 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -459,7 +459,14 @@ bool PdecHandler::newTcReceived() { return true; } -void PdecHandler::doPeriodicWork() { checkLocks(); } +void PdecHandler::doPeriodicWork() { + // scuffed test code + // if(testCntr < 30) { + // triggerEvent(pdec::INVALID_TC_FRAME, FRAME_DIRTY_RETVAL); + // testCntr++; + // } + checkLocks(); +} bool PdecHandler::checkFrameAna(uint32_t pdecFar) { bool frameValid = false; diff --git a/linux/ipcore/PdecHandler.h b/linux/ipcore/PdecHandler.h index fd3c7362..882dca50 100644 --- a/linux/ipcore/PdecHandler.h +++ b/linux/ipcore/PdecHandler.h @@ -82,37 +82,8 @@ class PdecHandler : public SystemObject, uint16_t startAtIndex) override; private: - static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER; - static constexpr Modes OP_MODE = Modes::IRQ; - static const ReturnValue_t ABANDONED_CLTU_RETVAL = MAKE_RETURN_CODE(0xA0); - static const ReturnValue_t FRAME_DIRTY_RETVAL = MAKE_RETURN_CODE(0xA1); - static const ReturnValue_t FRAME_ILLEGAL_ONE_REASON = MAKE_RETURN_CODE(0xA2); - static const ReturnValue_t FRAME_ILLEGAL_MULTIPLE_REASONS = MAKE_RETURN_CODE(0xA2); - static const ReturnValue_t AD_DISCARDED_LOCKOUT_RETVAL = MAKE_RETURN_CODE(0xA3); - static const ReturnValue_t AD_DISCARDED_WAIT_RETVAL = MAKE_RETURN_CODE(0xA4); - static const ReturnValue_t AD_DISCARDED_NS_VS = MAKE_RETURN_CODE(0xA5); - - //! [EXPORT] : [COMMENT] Received action message with unknown action id - static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xB0); - - static const ReturnValue_t NO_REPORT_RETVAL = MAKE_RETURN_CODE(0xA6); - //! Error in version number and reserved A and B fields - static const ReturnValue_t ERROR_VERSION_NUMBER_RETVAL = MAKE_RETURN_CODE(0xA7); - //! Illegal combination of bypass and control command flag - static const ReturnValue_t ILLEGAL_COMBINATION_RETVAL = MAKE_RETURN_CODE(0xA8); - //! Spacecraft identifier did not match - static const ReturnValue_t INVALID_SC_ID_RETVAL = MAKE_RETURN_CODE(0xA9); - //! VC identifier bits 0 to 4 did not match - static const ReturnValue_t INVALID_VC_ID_MSB_RETVAL = MAKE_RETURN_CODE(0xAA); - //! VC identifier bit 5 did not match - static const ReturnValue_t INVALID_VC_ID_LSB_RETVAL = MAKE_RETURN_CODE(0xAB); - //! N(S) of BC or BD frame not set to all zeros - static const ReturnValue_t NS_NOT_ZERO_RETVAL = MAKE_RETURN_CODE(0xAC); - //! Invalid BC control command - static const ReturnValue_t INVALID_BC_CC = MAKE_RETURN_CODE(0xAE); - static const uint32_t QUEUE_SIZE = config::CCSDS_HANDLER_QUEUE_SIZE; #ifdef TE0720_1CFA @@ -228,6 +199,9 @@ class PdecHandler : public SystemObject, uint32_t initTries = 0; + // scuffed test counter. + uint8_t testCntr = 0; + /** * @brief Performs initialization stuff which must be performed in first * loop of running task diff --git a/linux/ipcore/pdec.h b/linux/ipcore/pdec.h index f0d5ebed..e0e61e10 100644 --- a/linux/ipcore/pdec.h +++ b/linux/ipcore/pdec.h @@ -7,6 +7,34 @@ namespace pdec { +static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER; +static const ReturnValue_t ABANDONED_CLTU_RETVAL = MAKE_RETURN_CODE(0xA0); +static const ReturnValue_t FRAME_DIRTY_RETVAL = MAKE_RETURN_CODE(0xA1); +static const ReturnValue_t FRAME_ILLEGAL_ONE_REASON = MAKE_RETURN_CODE(0xA2); +static const ReturnValue_t FRAME_ILLEGAL_MULTIPLE_REASONS = MAKE_RETURN_CODE(0xA2); +static const ReturnValue_t AD_DISCARDED_LOCKOUT_RETVAL = MAKE_RETURN_CODE(0xA3); +static const ReturnValue_t AD_DISCARDED_WAIT_RETVAL = MAKE_RETURN_CODE(0xA4); +static const ReturnValue_t AD_DISCARDED_NS_VS = MAKE_RETURN_CODE(0xA5); + +//! [EXPORT] : [COMMENT] Received action message with unknown action id +static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xB0); + +static const ReturnValue_t NO_REPORT_RETVAL = MAKE_RETURN_CODE(0xA6); +//! Error in version number and reserved A and B fields +static const ReturnValue_t ERROR_VERSION_NUMBER_RETVAL = MAKE_RETURN_CODE(0xA7); +//! Illegal combination of bypass and control command flag +static const ReturnValue_t ILLEGAL_COMBINATION_RETVAL = MAKE_RETURN_CODE(0xA8); +//! Spacecraft identifier did not match +static const ReturnValue_t INVALID_SC_ID_RETVAL = MAKE_RETURN_CODE(0xA9); +//! VC identifier bits 0 to 4 did not match +static const ReturnValue_t INVALID_VC_ID_MSB_RETVAL = MAKE_RETURN_CODE(0xAA); +//! VC identifier bit 5 did not match +static const ReturnValue_t INVALID_VC_ID_LSB_RETVAL = MAKE_RETURN_CODE(0xAB); +//! N(S) of BC or BD frame not set to all zeros +static const ReturnValue_t NS_NOT_ZERO_RETVAL = MAKE_RETURN_CODE(0xAC); +//! Invalid BC control command +static const ReturnValue_t INVALID_BC_CC = MAKE_RETURN_CODE(0xAE); + static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PDEC_HANDLER; //! [EXPORT] : [COMMENT] Frame acceptance report signals an invalid frame diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index b12f95f4..6e4564f5 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -126,7 +126,7 @@ void EiveSystem::handleEventMessages() { case EventMessage::EVENT_MESSAGE: switch (event.getEvent()) { case pdec::INVALID_TC_FRAME: { - if (event.getParameter1() == static_cast(pdec::FrameAna_t::FRAME_DIRTY)) { + if (event.getParameter1() == pdec::FRAME_DIRTY_RETVAL) { frameDirtyErrorCounter++; } break; @@ -299,6 +299,7 @@ void EiveSystem::pdecRecoveryLogic() { } } frameDirtyErrorCounter = 0; + frameDirtyCheckCd.resetTimer(); } }