From 669c3630a9c819c4b3d30f7cb4487f7ff2bc79cd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 4 Aug 2023 14:23:10 +0200 Subject: [PATCH 01/23] reworked PDEC FDIR --- mission/system/EiveSystem.cpp | 59 +++++++++++++++++------------------ mission/system/EiveSystem.h | 5 +-- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 41f52cde..8461b528 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -296,39 +296,38 @@ ReturnValue_t EiveSystem::sendFullRebootCommand() { } void EiveSystem::pdecRecoveryLogic() { - if (pdecResetWasAttempted and pdecResetWasAttemptedCd.hasTimedOut()) { - pdecResetWasAttempted = false; + if (pdecResetCounter >= PDEC_RESET_MAX_COUNT_BEFORE_REBOOT) { + // If a PTME reset was already attempted and there is still an issue receiving TC frames, + // reboot the system. + if (waitingForPdecReboot) { + return; + } + triggerEvent(core::PDEC_REBOOT); + // Some delay to ensure that the event is stored in the persistent TM store as well. + TaskFactory::delayTask(500); + // Send reboot command. + ReturnValue_t result = sendSelfRebootCommand(); + if (result != returnvalue::OK) { + sif::error << "Sending a reboot command has failed" << std::endl; + // If the previous operation failed, it should be re-attempted the next task cycle. + pdecResetCounterResetCd.resetTimer(); + return; + } + waitingForPdecReboot = true; + return; + } + if (pdecResetCounterResetCd.hasTimedOut()) { + pdecResetCounter = 0; } if (frameDirtyCheckCd.hasTimedOut()) { if (frameDirtyErrorCounter >= FRAME_DIRTY_COM_REBOOT_LIMIT) { - // If a PTME reset was already attempted and there is still an issue receiving TC frames, - // reboot the system. - if (pdecResetWasAttempted) { - if (waitingForPdecReboot) { - return; - } - triggerEvent(core::PDEC_REBOOT); - // Some delay to ensure that the event is stored in the persistent TM store as well. - TaskFactory::delayTask(500); - // Send reboot command. - ReturnValue_t result = sendSelfRebootCommand(); - if (result != returnvalue::OK) { - sif::error << "Sending a reboot command has failed" << std::endl; - // If the previous operation failed, it should be re-attempted the next task cycle. - pdecResetWasAttemptedCd.resetTimer(); - return; - } - waitingForPdecReboot = true; - return; - } else { - // Try one full PDEC reset. - CommandMessage msg; - store_address_t dummy{}; - ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy); - commandQueue->sendMessage(pdecHandlerQueueId, &msg); - pdecResetWasAttemptedCd.resetTimer(); - pdecResetWasAttempted = true; - } + // Try one full PDEC reset. + CommandMessage msg; + store_address_t dummy{}; + ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy); + commandQueue->sendMessage(pdecHandlerQueueId, &msg); + pdecResetCounterResetCd.resetTimer(); + pdecResetCounter++; } frameDirtyErrorCounter = 0; frameDirtyCheckCd.resetTimer(); diff --git a/mission/system/EiveSystem.h b/mission/system/EiveSystem.h index c724ba34..e6ff19b9 100644 --- a/mission/system/EiveSystem.h +++ b/mission/system/EiveSystem.h @@ -10,6 +10,7 @@ class EiveSystem : public Subsystem, public HasActionsIF { public: static constexpr uint8_t FRAME_DIRTY_COM_REBOOT_LIMIT = 4; + static constexpr uint32_t PDEC_RESET_MAX_COUNT_BEFORE_REBOOT = 10; static constexpr ActionId_t EXECUTE_I2C_REBOOT = 10; @@ -39,11 +40,11 @@ class EiveSystem : public Subsystem, public HasActionsIF { Countdown frameDirtyCheckCd = Countdown(10000); // If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that // only a full reboot will fix the issue. - Countdown pdecResetWasAttemptedCd = Countdown(120000); - bool pdecResetWasAttempted = false; + Countdown pdecResetCounterResetCd = Countdown(120000); bool waitingForI2cReboot = false; bool waitingForPdecReboot = false; + uint32_t pdecResetCounter = 0; ActionHelper actionHelper; PowerSwitchIF* powerSwitcher = nullptr; std::atomic_uint16_t& i2cErrors; From e4632b2538d917e64e9add8ee3ae081772ada560 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 4 Aug 2023 14:26:13 +0200 Subject: [PATCH 02/23] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18ba4097..5f7b7788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,13 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +- PDEC FDIR rework: A full PDEC reboot will now only be performed after a regular PDEC reset has + failed 10 times. The mechanism will reset after no PDEC reset has happended for 2 minutes. + The PDEC reset will be performed when counting 4 dirty frame events in 10 seconds just like done + before. + # [v6.3.0] 2023-08-03 ## Fixed From 9f176e19599ae3f3ba016530022e1611cda30f46 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 4 Aug 2023 14:28:58 +0200 Subject: [PATCH 03/23] doc correction --- mission/system/EiveSystem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 8461b528..eb5b3529 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -296,9 +296,8 @@ ReturnValue_t EiveSystem::sendFullRebootCommand() { } void EiveSystem::pdecRecoveryLogic() { + // PDEC reset has happened too often in the last time. Perform reboot to same image. if (pdecResetCounter >= PDEC_RESET_MAX_COUNT_BEFORE_REBOOT) { - // If a PTME reset was already attempted and there is still an issue receiving TC frames, - // reboot the system. if (waitingForPdecReboot) { return; } From c3bca9bb5426607042631b7b40df17e395656ff2 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 7 Aug 2023 17:08:33 +0200 Subject: [PATCH 04/23] added event which is triggered when config of pdec is corrupted --- linux/ipcore/PdecConfig.cpp | 90 +++++++++++++++++++++--------------- linux/ipcore/PdecConfig.h | 32 ++++++++++++- linux/ipcore/PdecHandler.cpp | 10 ++++ linux/ipcore/PdecHandler.h | 5 ++ linux/ipcore/pdec.h | 4 ++ 5 files changed, 103 insertions(+), 38 deletions(-) diff --git a/linux/ipcore/PdecConfig.cpp b/linux/ipcore/PdecConfig.cpp index a41c5ba6..3bc478a8 100644 --- a/linux/ipcore/PdecConfig.cpp +++ b/linux/ipcore/PdecConfig.cpp @@ -22,11 +22,11 @@ ReturnValue_t PdecConfig::write() { if (result != returnvalue::OK) { return result; } - result = writeFrameHeaderFirstOctet(); + result = writeFrameHeaderFirstWord(); if (result != returnvalue::OK) { return result; } - result = writeFrameHeaderSecondOctet(); + result = writeFrameHeaderSecondWord(); if (result != returnvalue::OK) { return result; } @@ -77,7 +77,7 @@ ReturnValue_t PdecConfig::setPositiveWindow(uint8_t pw) { return result; } // Rewrite second config word which contains the positive window parameter - writeFrameHeaderSecondOctet(); + writeFrameHeaderSecondWord(); return returnvalue::OK; } @@ -92,7 +92,7 @@ ReturnValue_t PdecConfig::setNegativeWindow(uint8_t nw) { return result; } // Rewrite second config word which contains the negative window parameter - writeFrameHeaderSecondOctet(); + writeFrameHeaderSecondWord(); return returnvalue::OK; } @@ -114,42 +114,14 @@ ReturnValue_t PdecConfig::getNegativeWindow(uint8_t& negativeWindow) { return returnvalue::OK; } -ReturnValue_t PdecConfig::writeFrameHeaderFirstOctet() { - uint32_t word = 0; - word |= (VERSION_ID << 30); - - // Setting the bypass flag and the control command flag should not have any - // implication on the operation of the PDEC IP Core - word |= (BYPASS_FLAG << 29); - word |= (CONTROL_COMMAND_FLAG << 28); - - word |= (RESERVED_FIELD_A << 26); - word |= (SPACECRAFT_ID << 16); - word |= (VIRTUAL_CHANNEL << 10); - word |= (DUMMY_BITS << 8); - uint8_t positiveWindow = 0; - ReturnValue_t result = - localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow); - if (result != returnvalue::OK) { - return result; - } - word |= static_cast(positiveWindow); +ReturnValue_t PdecConfig::writeFrameHeaderFirstWord() { + uint32_t word = createFirstWord(); *(memoryBaseAddress + FRAME_HEADER_OFFSET) = word; return returnvalue::OK; } -ReturnValue_t PdecConfig::writeFrameHeaderSecondOctet() { - uint8_t negativeWindow = 0; - ReturnValue_t result = - localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow); - if (result != returnvalue::OK) { - return result; - } - uint32_t word = 0; - word = 0; - word |= (static_cast(negativeWindow) << 24); - word |= (HIGH_AU_MAP_ID << 16); - word |= (ENABLE_DERANDOMIZER << 8); +ReturnValue_t PdecConfig::writeFrameHeaderSecondWord() { + uint32_t word = createSecondWord(); *(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = word; return returnvalue::OK; } @@ -189,3 +161,49 @@ uint8_t PdecConfig::getOddParity(uint8_t number) { parityBit = ~(countBits & 0x1) & 0x1; return parityBit; } + +uint32_t PdecConfig::createFirstWord() { + uint32_t word = 0; + word |= (VERSION_ID << 30); + + // Setting the bypass flag and the control command flag should not have any + // implication on the operation of the PDEC IP Core + word |= (BYPASS_FLAG << 29); + word |= (CONTROL_COMMAND_FLAG << 28); + + word |= (RESERVED_FIELD_A << 26); + word |= (SPACECRAFT_ID << 16); + word |= (VIRTUAL_CHANNEL << 10); + word |= (DUMMY_BITS << 8); + uint8_t positiveWindow = 0; + ReturnValue_t result = + localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow); + if (result != returnvalue::OK) { + return result; + } + word |= static_cast(positiveWindow); + return word; +} + +uint32_t PdecConfig::createSecondWord() { + uint8_t negativeWindow = 0; + ReturnValue_t result = + localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow); + if (result != returnvalue::OK) { + return result; + } + uint32_t word = 0; + word = 0; + word |= (static_cast(negativeWindow) << 24); + word |= (HIGH_AU_MAP_ID << 16); + word |= (ENABLE_DERANDOMIZER << 8); + return word; +} + +uint32_t PdecConfig::readbackFirstWord() { + return *(memoryBaseAddress + FRAME_HEADER_OFFSET); +} + +uint32_t PdecConfig::readbackSecondWord() { + return *(memoryBaseAddress + FRAME_HEADER_OFFSET + 1); +} diff --git a/linux/ipcore/PdecConfig.h b/linux/ipcore/PdecConfig.h index f7203eec..3f17f08f 100644 --- a/linux/ipcore/PdecConfig.h +++ b/linux/ipcore/PdecConfig.h @@ -48,6 +48,34 @@ class PdecConfig { ReturnValue_t getPositiveWindow(uint8_t& positiveWindow); ReturnValue_t getNegativeWindow(uint8_t& negativeWindow); + /** + * @brief Creates the first word of the PDEC configuration + * + * @return The created config word + */ + uint32_t createFirstWord(); + + /** + * @brief Creates the second word of the PDEC configuration + * + * @return The created config word + */ + uint32_t createSecondWord(); + + /** + * @brief Reads first config word from the config memory + * + * @return The config word + */ + uint32_t readbackFirstWord(); + + /** + * @brief Reads the second config word from the config memory + * + * @return The config word + */ + uint32_t readbackSecondWord(); + private: // TC transfer frame configuration parameters static const uint8_t VERSION_ID = 0; @@ -102,8 +130,8 @@ class PdecConfig { */ ReturnValue_t createPersistentConfig(); - ReturnValue_t writeFrameHeaderFirstOctet(); - ReturnValue_t writeFrameHeaderSecondOctet(); + ReturnValue_t writeFrameHeaderFirstWord(); + ReturnValue_t writeFrameHeaderSecondWord(); void writeMapConfig(); /** diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index cc074ddd..86df3ad2 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -478,6 +478,7 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) { } case (FrameAna_t::FRAME_DIRTY): { triggerEvent(INVALID_TC_FRAME, FRAME_DIRTY_RETVAL); + checkConfig(); sif::warning << "PdecHandler::checkFrameAna: Frame dirty" << std::endl; break; } @@ -577,6 +578,15 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) { } } +void PdecHandler::checkConfig() { + uint32_t firstWord = pdecConfig.createFirstWord(); + uint32_t secondWord = pdecConfig.createSecondWord(); + if (firstWord != pdecConfig.readbackFirstWord() or + secondWord != pdecConfig.readbackSecondWord()) { + triggerEvent(PDEC_CONFIG_CORRUPTED, firstWord, secondWord); + } +} + void PdecHandler::handleNewTc() { ReturnValue_t result = returnvalue::OK; diff --git a/linux/ipcore/PdecHandler.h b/linux/ipcore/PdecHandler.h index 882dca50..11ae4de3 100644 --- a/linux/ipcore/PdecHandler.h +++ b/linux/ipcore/PdecHandler.h @@ -282,6 +282,11 @@ class PdecHandler : public SystemObject, */ void handleIReason(uint32_t pdecFar, ReturnValue_t parameter1); + /** + * @brief Checks if PDEC configuration is still correct + */ + void checkConfig(); + /** * @brief Handles the reception of new TCs. Reads the pointer to the storage location of the * new TC segment, extracts the PUS packet and forwards the data to the object diff --git a/linux/ipcore/pdec.h b/linux/ipcore/pdec.h index 0574ee73..de703c5a 100644 --- a/linux/ipcore/pdec.h +++ b/linux/ipcore/pdec.h @@ -71,6 +71,10 @@ static constexpr Event OPEN_IRQ_FILE_FAILED = event::makeEvent(SUBSYSTEM_ID, 13, //! [EXPORT] : [COMMENT] PDEC initialization failed. This might also be due to the persistent //! confiuration never becoming available, for example due to SD card issues. static constexpr Event PDEC_INIT_FAILED = event::makeEvent(SUBSYSTEM_ID, 14, severity::HIGH); +//! [EXPORT] : [COMMENT] The PDEC configuration area has been corrupted +//! P1: The first configuration word +//! P2: The second configuration word +static constexpr Event PDEC_CONFIG_CORRUPTED = event::makeEvent(SUBSYSTEM_ID, 15, severity::HIGH); // Action IDs static constexpr ActionId_t PRINT_CLCW = 0; From d28ec2c31a872dd7c56d9f798cc7e545a3b949e8 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 11 Aug 2023 16:15:56 +0200 Subject: [PATCH 05/23] config word functions pass value now by reference and return returnvalue --- linux/ipcore/PdecConfig.cpp | 56 ++++++++++++++++++++---------------- linux/ipcore/PdecConfig.h | 15 +++++++--- linux/ipcore/PdecHandler.cpp | 20 +++++++++++-- 3 files changed, 61 insertions(+), 30 deletions(-) diff --git a/linux/ipcore/PdecConfig.cpp b/linux/ipcore/PdecConfig.cpp index 3bc478a8..8399f6d3 100644 --- a/linux/ipcore/PdecConfig.cpp +++ b/linux/ipcore/PdecConfig.cpp @@ -115,14 +115,22 @@ ReturnValue_t PdecConfig::getNegativeWindow(uint8_t& negativeWindow) { } ReturnValue_t PdecConfig::writeFrameHeaderFirstWord() { - uint32_t word = createFirstWord(); - *(memoryBaseAddress + FRAME_HEADER_OFFSET) = word; + uint32_t word = 0; + ReturnValue_t result = createFirstWord(&word); + if (result != returnvalue::OK) { + return result; + } + *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD) = word; return returnvalue::OK; } ReturnValue_t PdecConfig::writeFrameHeaderSecondWord() { - uint32_t word = createSecondWord(); - *(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = word; + uint32_t word = 0; + ReturnValue_t result = createSecondWord(&word); + if (result != returnvalue::OK) { + return result; + } + *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD) = word; return returnvalue::OK; } @@ -162,48 +170,48 @@ uint8_t PdecConfig::getOddParity(uint8_t number) { return parityBit; } -uint32_t PdecConfig::createFirstWord() { - uint32_t word = 0; - word |= (VERSION_ID << 30); +ReturnValue_t PdecConfig::createFirstWord(uint32_t* word) { + *word = 0; + *word |= (VERSION_ID << 30); // Setting the bypass flag and the control command flag should not have any // implication on the operation of the PDEC IP Core - word |= (BYPASS_FLAG << 29); - word |= (CONTROL_COMMAND_FLAG << 28); + *word |= (BYPASS_FLAG << 29); + *word |= (CONTROL_COMMAND_FLAG << 28); - word |= (RESERVED_FIELD_A << 26); - word |= (SPACECRAFT_ID << 16); - word |= (VIRTUAL_CHANNEL << 10); - word |= (DUMMY_BITS << 8); + *word |= (RESERVED_FIELD_A << 26); + *word |= (SPACECRAFT_ID << 16); + *word |= (VIRTUAL_CHANNEL << 10); + *word |= (DUMMY_BITS << 8); uint8_t positiveWindow = 0; ReturnValue_t result = localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow); if (result != returnvalue::OK) { return result; } - word |= static_cast(positiveWindow); - return word; + *word |= static_cast(positiveWindow); + return returnvalue::OK; } -uint32_t PdecConfig::createSecondWord() { +ReturnValue_t PdecConfig::createSecondWord(uint32_t* word) { uint8_t negativeWindow = 0; ReturnValue_t result = localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow); if (result != returnvalue::OK) { return result; } - uint32_t word = 0; - word = 0; - word |= (static_cast(negativeWindow) << 24); - word |= (HIGH_AU_MAP_ID << 16); - word |= (ENABLE_DERANDOMIZER << 8); - return word; + *word = 0; + *word = 0; + *word |= (static_cast(negativeWindow) << 24); + *word |= (HIGH_AU_MAP_ID << 16); + *word |= (ENABLE_DERANDOMIZER << 8); + return returnvalue::OK; } uint32_t PdecConfig::readbackFirstWord() { - return *(memoryBaseAddress + FRAME_HEADER_OFFSET); + return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD); } uint32_t PdecConfig::readbackSecondWord() { - return *(memoryBaseAddress + FRAME_HEADER_OFFSET + 1); + return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD); } diff --git a/linux/ipcore/PdecConfig.h b/linux/ipcore/PdecConfig.h index 3f17f08f..e3faee4d 100644 --- a/linux/ipcore/PdecConfig.h +++ b/linux/ipcore/PdecConfig.h @@ -51,16 +51,21 @@ class PdecConfig { /** * @brief Creates the first word of the PDEC configuration * - * @return The created config word + * @param word The created word will be written to this pointer + * + * @return OK if successful, otherwise error return value + * */ - uint32_t createFirstWord(); + ReturnValue_t createFirstWord(uint32_t* word); /** * @brief Creates the second word of the PDEC configuration * - * @return The created config word + * @param word The created word will be written to this pointer + * + * @return OK if successful, otherwise error return value */ - uint32_t createSecondWord(); + ReturnValue_t createSecondWord(uint32_t* word); /** * @brief Reads first config word from the config memory @@ -94,6 +99,8 @@ class PdecConfig { // 0x200 / 4 = 0x80 static const uint32_t FRAME_HEADER_OFFSET = 0x80; + static const uint32_t OFFSET_FIRST_CONFIG_WORD = 0; + static const uint32_t OFFSET_SECOND_CONFIG_WORD = 1; static const uint32_t MAP_ADDR_LUT_OFFSET = 0xA0; static const uint32_t MAP_CLK_FREQ_OFFSET = 0x90; diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index 86df3ad2..91aec623 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -579,8 +579,24 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) { } void PdecHandler::checkConfig() { - uint32_t firstWord = pdecConfig.createFirstWord(); - uint32_t secondWord = pdecConfig.createSecondWord(); + uint32_t firstWord = 0; + ReturnValue_t result = pdecConfig.createFirstWord(&firstWord); + if (result != returnvalue::OK) { + // This should normally never happen during runtime. So here is just + // output a warning + sif::warning << "PdecHandler::checkConfig: Failed to create first word" + << std::endl; + return; + } + uint32_t secondWord = 0; + result = pdecConfig.createSecondWord(&secondWord); + if (result != returnvalue::OK) { + // This should normally never happen during runtime. So here is just + // output a warning + sif::warning << "PdecHandler::checkConfig: Failed to create second word" + << std::endl; + return; + } if (firstWord != pdecConfig.readbackFirstWord() or secondWord != pdecConfig.readbackSecondWord()) { triggerEvent(PDEC_CONFIG_CORRUPTED, firstWord, secondWord); From 0095397b4f65b99958abae570963ad5c653a5c34 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Aug 2023 10:30:46 +0200 Subject: [PATCH 06/23] that should do the job --- mission/system/EiveSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index eb5b3529..8271b179 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -133,6 +133,7 @@ void EiveSystem::handleEventMessages() { case pdec::INVALID_TC_FRAME: { if (event.getParameter1() == pdec::FRAME_DIRTY_RETVAL) { frameDirtyErrorCounter++; + frameDirtyCheckCd.resetTimer(); } break; } @@ -318,7 +319,7 @@ void EiveSystem::pdecRecoveryLogic() { if (pdecResetCounterResetCd.hasTimedOut()) { pdecResetCounter = 0; } - if (frameDirtyCheckCd.hasTimedOut()) { + if (frameDirtyCheckCd.hasTimedOut() and frameDirtyErrorCounter > 0) { if (frameDirtyErrorCounter >= FRAME_DIRTY_COM_REBOOT_LIMIT) { // Try one full PDEC reset. CommandMessage msg; @@ -329,7 +330,6 @@ void EiveSystem::pdecRecoveryLogic() { pdecResetCounter++; } frameDirtyErrorCounter = 0; - frameDirtyCheckCd.resetTimer(); } } From da25d650d982e4f95b519185c509e055f34da1b4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Aug 2023 10:34:06 +0200 Subject: [PATCH 07/23] bugfix --- mission/system/EiveSystem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 8271b179..84b4edf7 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -133,7 +133,10 @@ void EiveSystem::handleEventMessages() { case pdec::INVALID_TC_FRAME: { if (event.getParameter1() == pdec::FRAME_DIRTY_RETVAL) { frameDirtyErrorCounter++; - frameDirtyCheckCd.resetTimer(); + // Check whether threshold was reached after 10 seconds. + if(frameDirtyErrorCounter == 1) { + frameDirtyCheckCd.resetTimer(); + } } break; } From 567d68107da39fcba4f791b74ec066624c826b22 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Aug 2023 15:06:22 +0200 Subject: [PATCH 08/23] auto-formatting --- linux/ipcore/PdecConfig.cpp | 80 ++++++++++++++++++------------------ linux/ipcore/PdecConfig.h | 56 ++++++++++++------------- linux/ipcore/PdecHandler.cpp | 30 +++++++------- 3 files changed, 82 insertions(+), 84 deletions(-) diff --git a/linux/ipcore/PdecConfig.cpp b/linux/ipcore/PdecConfig.cpp index 8399f6d3..19423862 100644 --- a/linux/ipcore/PdecConfig.cpp +++ b/linux/ipcore/PdecConfig.cpp @@ -116,20 +116,20 @@ ReturnValue_t PdecConfig::getNegativeWindow(uint8_t& negativeWindow) { ReturnValue_t PdecConfig::writeFrameHeaderFirstWord() { uint32_t word = 0; - ReturnValue_t result = createFirstWord(&word); - if (result != returnvalue::OK) { - return result; - } + ReturnValue_t result = createFirstWord(&word); + if (result != returnvalue::OK) { + return result; + } *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD) = word; return returnvalue::OK; } ReturnValue_t PdecConfig::writeFrameHeaderSecondWord() { uint32_t word = 0; - ReturnValue_t result = createSecondWord(&word); - if (result != returnvalue::OK) { - return result; - } + ReturnValue_t result = createSecondWord(&word); + if (result != returnvalue::OK) { + return result; + } *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD) = word; return returnvalue::OK; } @@ -171,47 +171,47 @@ uint8_t PdecConfig::getOddParity(uint8_t number) { } ReturnValue_t PdecConfig::createFirstWord(uint32_t* word) { - *word = 0; - *word |= (VERSION_ID << 30); + *word = 0; + *word |= (VERSION_ID << 30); - // Setting the bypass flag and the control command flag should not have any - // implication on the operation of the PDEC IP Core - *word |= (BYPASS_FLAG << 29); - *word |= (CONTROL_COMMAND_FLAG << 28); + // Setting the bypass flag and the control command flag should not have any + // implication on the operation of the PDEC IP Core + *word |= (BYPASS_FLAG << 29); + *word |= (CONTROL_COMMAND_FLAG << 28); - *word |= (RESERVED_FIELD_A << 26); - *word |= (SPACECRAFT_ID << 16); - *word |= (VIRTUAL_CHANNEL << 10); - *word |= (DUMMY_BITS << 8); - uint8_t positiveWindow = 0; - ReturnValue_t result = - localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow); - if (result != returnvalue::OK) { - return result; - } - *word |= static_cast(positiveWindow); - return returnvalue::OK; + *word |= (RESERVED_FIELD_A << 26); + *word |= (SPACECRAFT_ID << 16); + *word |= (VIRTUAL_CHANNEL << 10); + *word |= (DUMMY_BITS << 8); + uint8_t positiveWindow = 0; + ReturnValue_t result = + localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow); + if (result != returnvalue::OK) { + return result; + } + *word |= static_cast(positiveWindow); + return returnvalue::OK; } ReturnValue_t PdecConfig::createSecondWord(uint32_t* word) { - uint8_t negativeWindow = 0; - ReturnValue_t result = - localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow); - if (result != returnvalue::OK) { - return result; - } - *word = 0; - *word = 0; - *word |= (static_cast(negativeWindow) << 24); - *word |= (HIGH_AU_MAP_ID << 16); - *word |= (ENABLE_DERANDOMIZER << 8); - return returnvalue::OK; + uint8_t negativeWindow = 0; + ReturnValue_t result = + localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow); + if (result != returnvalue::OK) { + return result; + } + *word = 0; + *word = 0; + *word |= (static_cast(negativeWindow) << 24); + *word |= (HIGH_AU_MAP_ID << 16); + *word |= (ENABLE_DERANDOMIZER << 8); + return returnvalue::OK; } uint32_t PdecConfig::readbackFirstWord() { - return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD); + return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD); } uint32_t PdecConfig::readbackSecondWord() { - return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD); + return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD); } diff --git a/linux/ipcore/PdecConfig.h b/linux/ipcore/PdecConfig.h index e3faee4d..1f2ed9c8 100644 --- a/linux/ipcore/PdecConfig.h +++ b/linux/ipcore/PdecConfig.h @@ -49,37 +49,37 @@ class PdecConfig { ReturnValue_t getNegativeWindow(uint8_t& negativeWindow); /** - * @brief Creates the first word of the PDEC configuration - * - * @param word The created word will be written to this pointer - * - * @return OK if successful, otherwise error return value - * - */ - ReturnValue_t createFirstWord(uint32_t* word); + * @brief Creates the first word of the PDEC configuration + * + * @param word The created word will be written to this pointer + * + * @return OK if successful, otherwise error return value + * + */ + ReturnValue_t createFirstWord(uint32_t* word); - /** - * @brief Creates the second word of the PDEC configuration - * - * @param word The created word will be written to this pointer - * - * @return OK if successful, otherwise error return value - */ - ReturnValue_t createSecondWord(uint32_t* word); + /** + * @brief Creates the second word of the PDEC configuration + * + * @param word The created word will be written to this pointer + * + * @return OK if successful, otherwise error return value + */ + ReturnValue_t createSecondWord(uint32_t* word); - /** - * @brief Reads first config word from the config memory - * - * @return The config word - */ - uint32_t readbackFirstWord(); + /** + * @brief Reads first config word from the config memory + * + * @return The config word + */ + uint32_t readbackFirstWord(); - /** - * @brief Reads the second config word from the config memory - * - * @return The config word - */ - uint32_t readbackSecondWord(); + /** + * @brief Reads the second config word from the config memory + * + * @return The config word + */ + uint32_t readbackSecondWord(); private: // TC transfer frame configuration parameters diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index 91aec623..189dfca8 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -579,28 +579,26 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) { } void PdecHandler::checkConfig() { - uint32_t firstWord = 0; + uint32_t firstWord = 0; ReturnValue_t result = pdecConfig.createFirstWord(&firstWord); if (result != returnvalue::OK) { - // This should normally never happen during runtime. So here is just - // output a warning - sif::warning << "PdecHandler::checkConfig: Failed to create first word" - << std::endl; - return; + // This should normally never happen during runtime. So here is just + // output a warning + sif::warning << "PdecHandler::checkConfig: Failed to create first word" << std::endl; + return; } - uint32_t secondWord = 0; + uint32_t secondWord = 0; result = pdecConfig.createSecondWord(&secondWord); if (result != returnvalue::OK) { - // This should normally never happen during runtime. So here is just - // output a warning - sif::warning << "PdecHandler::checkConfig: Failed to create second word" - << std::endl; - return; + // This should normally never happen during runtime. So here is just + // output a warning + sif::warning << "PdecHandler::checkConfig: Failed to create second word" << std::endl; + return; + } + if (firstWord != pdecConfig.readbackFirstWord() or + secondWord != pdecConfig.readbackSecondWord()) { + triggerEvent(PDEC_CONFIG_CORRUPTED, firstWord, secondWord); } - if (firstWord != pdecConfig.readbackFirstWord() or - secondWord != pdecConfig.readbackSecondWord()) { - triggerEvent(PDEC_CONFIG_CORRUPTED, firstWord, secondWord); - } } void PdecHandler::handleNewTc() { From 424f3c5247baf54d0a232d37ca867927dc72b6ca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Aug 2023 15:09:45 +0200 Subject: [PATCH 09/23] changelog and re-run generators --- CHANGELOG.md | 3 +++ bsp_hosted/fsfwconfig/events/translateEvents.cpp | 7 +++++-- bsp_hosted/fsfwconfig/objects/translateObjects.cpp | 2 +- generators/bsp_hosted_events.csv | 1 + generators/bsp_q7s_events.csv | 1 + generators/events/translateEvents.cpp | 7 +++++-- generators/objects/translateObjects.cpp | 2 +- linux/fsfwconfig/events/translateEvents.cpp | 7 +++++-- linux/fsfwconfig/objects/translateObjects.cpp | 2 +- tmtc | 2 +- 10 files changed, 24 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd4cb9cb..8958a80c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ will consitute of a breaking change warranting a new major release: ## Added - Skyview dataset for more GPS TM has been added +- `PDEC_CONFIG_CORRUPTED` event which is triggered when the PDEC configuration does not match the + expected configuration. P1 will contain the readback of the first word and P2 will contain the + readback of the second word. ## Fixed - The handling function of the GPS data is only called once per GPS read. This should remove diff --git a/bsp_hosted/fsfwconfig/events/translateEvents.cpp b/bsp_hosted/fsfwconfig/events/translateEvents.cpp index 3a53a4fb..51186d86 100644 --- a/bsp_hosted/fsfwconfig/events/translateEvents.cpp +++ b/bsp_hosted/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 302 translations. + * @brief Auto-generated event translation file. Contains 303 translations. * @details - * Generated on: 2023-08-02 09:40:31 + * Generated on: 2023-08-14 15:09:10 */ #include "translateEvents.h" @@ -167,6 +167,7 @@ const char *PDEC_TRYING_RESET_NO_INIT_STRING = "PDEC_TRYING_RESET_NO_INIT"; const char *PDEC_RESET_FAILED_STRING = "PDEC_RESET_FAILED"; const char *OPEN_IRQ_FILE_FAILED_STRING = "OPEN_IRQ_FILE_FAILED"; const char *PDEC_INIT_FAILED_STRING = "PDEC_INIT_FAILED"; +const char *PDEC_CONFIG_CORRUPTED_STRING = "PDEC_CONFIG_CORRUPTED"; const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED"; const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED"; const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL"; @@ -634,6 +635,8 @@ const char *translateEvents(Event event) { return OPEN_IRQ_FILE_FAILED_STRING; case (12414): return PDEC_INIT_FAILED_STRING; + case (12415): + return PDEC_CONFIG_CORRUPTED_STRING; case (12500): return IMAGE_UPLOAD_FAILED_STRING; case (12501): diff --git a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp index 8a6f23a0..ca561e5a 100644 --- a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp +++ b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 171 translations. - * Generated on: 2023-08-02 09:40:31 + * Generated on: 2023-08-14 15:09:10 */ #include "translateObjects.h" diff --git a/generators/bsp_hosted_events.csv b/generators/bsp_hosted_events.csv index 1c6f646d..ecdf9534 100644 --- a/generators/bsp_hosted_events.csv +++ b/generators/bsp_hosted_events.csv @@ -161,6 +161,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12412;0x307c;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/pdec.h 12413;0x307d;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/pdec.h 12414;0x307e;PDEC_INIT_FAILED;HIGH;PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues.;linux/ipcore/pdec.h +12415;0x307f;PDEC_CONFIG_CORRUPTED;HIGH;The PDEC configuration area has been corrupted P1: The first configuration word P2: The second configuration word;linux/ipcore/pdec.h 12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/acs/StrComHandler.h 12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/acs/StrComHandler.h 12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/acs/StrComHandler.h diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 1c6f646d..ecdf9534 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -161,6 +161,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12412;0x307c;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/pdec.h 12413;0x307d;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/pdec.h 12414;0x307e;PDEC_INIT_FAILED;HIGH;PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues.;linux/ipcore/pdec.h +12415;0x307f;PDEC_CONFIG_CORRUPTED;HIGH;The PDEC configuration area has been corrupted P1: The first configuration word P2: The second configuration word;linux/ipcore/pdec.h 12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/acs/StrComHandler.h 12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/acs/StrComHandler.h 12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/acs/StrComHandler.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 3a53a4fb..51186d86 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 302 translations. + * @brief Auto-generated event translation file. Contains 303 translations. * @details - * Generated on: 2023-08-02 09:40:31 + * Generated on: 2023-08-14 15:09:10 */ #include "translateEvents.h" @@ -167,6 +167,7 @@ const char *PDEC_TRYING_RESET_NO_INIT_STRING = "PDEC_TRYING_RESET_NO_INIT"; const char *PDEC_RESET_FAILED_STRING = "PDEC_RESET_FAILED"; const char *OPEN_IRQ_FILE_FAILED_STRING = "OPEN_IRQ_FILE_FAILED"; const char *PDEC_INIT_FAILED_STRING = "PDEC_INIT_FAILED"; +const char *PDEC_CONFIG_CORRUPTED_STRING = "PDEC_CONFIG_CORRUPTED"; const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED"; const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED"; const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL"; @@ -634,6 +635,8 @@ const char *translateEvents(Event event) { return OPEN_IRQ_FILE_FAILED_STRING; case (12414): return PDEC_INIT_FAILED_STRING; + case (12415): + return PDEC_CONFIG_CORRUPTED_STRING; case (12500): return IMAGE_UPLOAD_FAILED_STRING; case (12501): diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index f4779490..8430ac93 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 175 translations. - * Generated on: 2023-08-02 09:40:31 + * Generated on: 2023-08-14 15:09:10 */ #include "translateObjects.h" diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 3a53a4fb..51186d86 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 302 translations. + * @brief Auto-generated event translation file. Contains 303 translations. * @details - * Generated on: 2023-08-02 09:40:31 + * Generated on: 2023-08-14 15:09:10 */ #include "translateEvents.h" @@ -167,6 +167,7 @@ const char *PDEC_TRYING_RESET_NO_INIT_STRING = "PDEC_TRYING_RESET_NO_INIT"; const char *PDEC_RESET_FAILED_STRING = "PDEC_RESET_FAILED"; const char *OPEN_IRQ_FILE_FAILED_STRING = "OPEN_IRQ_FILE_FAILED"; const char *PDEC_INIT_FAILED_STRING = "PDEC_INIT_FAILED"; +const char *PDEC_CONFIG_CORRUPTED_STRING = "PDEC_CONFIG_CORRUPTED"; const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED"; const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED"; const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL"; @@ -634,6 +635,8 @@ const char *translateEvents(Event event) { return OPEN_IRQ_FILE_FAILED_STRING; case (12414): return PDEC_INIT_FAILED_STRING; + case (12415): + return PDEC_CONFIG_CORRUPTED_STRING; case (12500): return IMAGE_UPLOAD_FAILED_STRING; case (12501): diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index f4779490..8430ac93 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 175 translations. - * Generated on: 2023-08-02 09:40:31 + * Generated on: 2023-08-14 15:09:10 */ #include "translateObjects.h" diff --git a/tmtc b/tmtc index 4b054b76..8042f360 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 4b054b7628e43975e2401c7db10c358824f7a2d3 +Subproject commit 8042f3607d3a09da89114f30eba525dc166b6fc0 From 693c183dcc9c896ddeaff054b76c0d19c580f12f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Aug 2023 16:07:16 +0200 Subject: [PATCH 10/23] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 8042f360..fd3a7990 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8042f3607d3a09da89114f30eba525dc166b6fc0 +Subproject commit fd3a799019f6910cbbb4447cc9605340d66c2703 From d82a6ece5a0c824476ffd8306f0dc9ed658acb53 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 15 Aug 2023 09:11:57 +0200 Subject: [PATCH 11/23] use safeCtrl even if SUS and MGM vectors are too close --- mission/controller/AcsController.cpp | 6 ++--- mission/controller/acs/control/SafeCtrl.cpp | 29 ++++++++++++++------- mission/controller/acs/control/SafeCtrl.h | 8 +++--- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index febe385a..1350bcf0 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -204,8 +204,7 @@ void AcsController::performSafe() { acs::SafeModeStrategy safeCtrlStrat = safeCtrl.safeCtrlStrategy( mgmDataProcessed.mgmVecTot.isValid(), not mekfInvalidFlag, gyrDataProcessed.gyrVecTot.isValid(), susDataProcessed.susVecTot.isValid(), - fusedRotRateData.rotRateOrthogonal.isValid(), fusedRotRateData.rotRateTotal.isValid(), - acsParameters.safeModeControllerParameters.useMekf, + fusedRotRateData.rotRateTotal.isValid(), acsParameters.safeModeControllerParameters.useMekf, acsParameters.safeModeControllerParameters.useGyr, acsParameters.safeModeControllerParameters.dampingDuringEclipse); switch (safeCtrlStrat) { @@ -223,7 +222,8 @@ void AcsController::performSafe() { safeCtrlFailureCounter = 0; break; case (acs::SafeModeStrategy::SAFECTRL_SUSMGM): - safeCtrl.safeSusMgm(mgmDataProcessed.mgmVecTot.value, fusedRotRateData.rotRateParallel.value, + safeCtrl.safeSusMgm(mgmDataProcessed.mgmVecTot.value, fusedRotRateData.rotRateTotal.value, + fusedRotRateData.rotRateParallel.value, fusedRotRateData.rotRateOrthogonal.value, susDataProcessed.susVecTot.value, sunTargetDir, magMomMtq, errAng); safeCtrlFailureFlag = false; diff --git a/mission/controller/acs/control/SafeCtrl.cpp b/mission/controller/acs/control/SafeCtrl.cpp index 8ad8b578..de0cd197 100644 --- a/mission/controller/acs/control/SafeCtrl.cpp +++ b/mission/controller/acs/control/SafeCtrl.cpp @@ -9,10 +9,12 @@ SafeCtrl::SafeCtrl(AcsParameters *acsParameters_) { acsParameters = acsParameter SafeCtrl::~SafeCtrl() {} -acs::SafeModeStrategy SafeCtrl::safeCtrlStrategy( - const bool magFieldValid, const bool mekfValid, const bool satRotRateValid, - const bool sunDirValid, const bool fusedRateSplitValid, const bool fusedRateTotalValid, - const uint8_t mekfEnabled, const uint8_t gyrEnabled, const uint8_t dampingEnabled) { +acs::SafeModeStrategy SafeCtrl::safeCtrlStrategy(const bool magFieldValid, const bool mekfValid, + const bool satRotRateValid, const bool sunDirValid, + const bool fusedRateTotalValid, + const uint8_t mekfEnabled, + const uint8_t gyrEnabled, + const uint8_t dampingEnabled) { if (not magFieldValid) { return acs::SafeModeStrategy::SAFECTRL_NO_MAG_FIELD_FOR_CONTROL; } else if (mekfEnabled and mekfValid) { @@ -20,7 +22,7 @@ acs::SafeModeStrategy SafeCtrl::safeCtrlStrategy( } else if (sunDirValid) { if (gyrEnabled and satRotRateValid) { return acs::SafeModeStrategy::SAFECTRL_GYR; - } else if (not gyrEnabled and fusedRateSplitValid) { + } else if (not gyrEnabled and fusedRateTotalValid) { return acs::SafeModeStrategy::SAFECTRL_SUSMGM; } else { return acs::SafeModeStrategy::SAFECTRL_NO_SENSORS_FOR_CONTROL; @@ -95,9 +97,10 @@ void SafeCtrl::safeGyr(const double *magFieldB, const double *satRotRateB, const calculateMagneticMoment(magMomB); } -void SafeCtrl::safeSusMgm(const double *magFieldB, const double *rotRateParallelB, - const double *rotRateOrthogonalB, const double *sunDirB, - const double *sunDirRefB, double *magMomB, double &errorAngle) { +void SafeCtrl::safeSusMgm(const double *magFieldB, const double *rotRateTotalB, + const double *rotRateParallelB, const double *rotRateOrthogonalB, + const double *sunDirB, const double *sunDirRefB, double *magMomB, + double &errorAngle) { // convert magFieldB from uT to T VectorOperations::mulScalar(magFieldB, 1e-6, magFieldBT, 3); @@ -105,8 +108,14 @@ void SafeCtrl::safeSusMgm(const double *magFieldB, const double *rotRateParallel double dotSun = VectorOperations::dot(sunDirRefB, sunDirB); errorAngle = acos(dotSun); - std::memcpy(satRotRateParallelB, rotRateParallelB, sizeof(satRotRateParallelB)); - std::memcpy(satRotRateOrthogonalB, rotRateOrthogonalB, sizeof(satRotRateOrthogonalB)); + if (VectorOperations::norm(rotRateParallelB, 3) != 0 and + VectorOperations::norm(rotRateOrthogonalB, 3) != 0) { + std::memcpy(satRotRateParallelB, rotRateParallelB, sizeof(satRotRateParallelB)); + std::memcpy(satRotRateOrthogonalB, rotRateOrthogonalB, sizeof(satRotRateOrthogonalB)); + } else { + splitRotationalRate(rotRateTotalB, sunDirB); + } + calculateRotationalRateTorque(acsParameters->safeModeControllerParameters.k_parallelSusMgm, acsParameters->safeModeControllerParameters.k_orthoSusMgm); calculateAngleErrorTorque(sunDirB, sunDirRefB, diff --git a/mission/controller/acs/control/SafeCtrl.h b/mission/controller/acs/control/SafeCtrl.h index 55bcbf08..d35d5d04 100644 --- a/mission/controller/acs/control/SafeCtrl.h +++ b/mission/controller/acs/control/SafeCtrl.h @@ -14,7 +14,6 @@ class SafeCtrl { acs::SafeModeStrategy safeCtrlStrategy(const bool magFieldValid, const bool mekfValid, const bool satRotRateValid, const bool sunDirValid, - const bool fusedRateSplitValid, const bool fusedRateTotalValid, const uint8_t mekfEnabled, const uint8_t gyrEnabled, const uint8_t dampingEnabled); @@ -25,9 +24,10 @@ class SafeCtrl { void safeGyr(const double *magFieldB, const double *satRotRateB, const double *sunDirB, const double *sunDirRefB, double *magMomB, double &errorAngle); - void safeSusMgm(const double *magFieldB, const double *rotRateParallelB, - const double *rotRateOrthogonalB, const double *sunDirB, const double *sunDirRefB, - double *magMomB, double &errorAngle); + void safeSusMgm(const double *magFieldB, const double *rotRateTotalB, + const double *rotRateParallelB, const double *rotRateOrthogonalB, + const double *sunDirB, const double *sunDirRefB, double *magMomB, + double &errorAngle); void safeRateDampingGyr(const double *magFieldB, const double *satRotRateB, const double *sunDirRefB, double *magMomB, double &errorAngle); From 0a42093de34de91550cec89a0c8f1abe4014f09a Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 15 Aug 2023 09:20:00 +0200 Subject: [PATCH 12/23] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41d1b480..9d287dd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ will consitute of a breaking change warranting a new major release: return the actual GPS data will be ignored once SPG4 is running. However, by setting the according parameter, the ACS Controller can be directed to ignore the SGP4 solution. - Skyview dataset for more GPS TM has been added +- The MGM and SUS vectors being too close together does not prevent the usage of the safe + mode controller anymore. ## Fixed From 7ab8fb8cb9f29b2e971a99adae5fe67ba5051ce8 Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 15 Aug 2023 09:37:54 +0200 Subject: [PATCH 13/23] added parameter to disable usage of mgm4 --- mission/controller/acs/AcsParameters.cpp | 3 +++ mission/controller/acs/AcsParameters.h | 1 + mission/controller/acs/SensorProcessing.cpp | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mission/controller/acs/AcsParameters.cpp b/mission/controller/acs/AcsParameters.cpp index 2c97fa99..7b867a46 100644 --- a/mission/controller/acs/AcsParameters.cpp +++ b/mission/controller/acs/AcsParameters.cpp @@ -113,6 +113,9 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId, case 0x13: parameterWrapper->set(mgmHandlingParameters.mgmDerivativeFilterWeight); break; + case 0x14: + parameterWrapper->set(mgmHandlingParameters.useMgm4); + break; default: return INVALID_IDENTIFIER_ID; } diff --git a/mission/controller/acs/AcsParameters.h b/mission/controller/acs/AcsParameters.h index ae33ac43..0fb1daa9 100644 --- a/mission/controller/acs/AcsParameters.h +++ b/mission/controller/acs/AcsParameters.h @@ -80,6 +80,7 @@ class AcsParameters : public HasParametersIF { float mgm4variance[3] = {pow(1.7e-6, 2), pow(1.7e-6, 2), pow(1.7e-6, 2)}; float mgmVectorFilterWeight = 0.85; float mgmDerivativeFilterWeight = 0.85; + uint8_t useMgm4 = false; } mgmHandlingParameters; struct SusHandlingParameters { diff --git a/mission/controller/acs/SensorProcessing.cpp b/mission/controller/acs/SensorProcessing.cpp index a683aada..686a2fcf 100644 --- a/mission/controller/acs/SensorProcessing.cpp +++ b/mission/controller/acs/SensorProcessing.cpp @@ -101,7 +101,7 @@ void SensorProcessing::processMgm(const float *mgm0Value, bool mgm0valid, const sensorFusionDenominator[i] += 1 / mgmParameters->mgm13variance[i]; } } - if (mgm4valid) { + if (mgm4valid and mgmParameters->useMgm4) { float mgm4ValueUT[3]; VectorOperations::mulScalar(mgm4Value, 1e-3, mgm4ValueUT, 3); // nT to uT MatrixOperations::multiply(mgmParameters->mgm4orientationMatrix[0], mgm4ValueUT, From 196781ed4aeff86bfadb1d1193b87d827fd1af1f Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 15 Aug 2023 09:39:59 +0200 Subject: [PATCH 14/23] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41d1b480..033ec315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ will consitute of a breaking change warranting a new major release: return the actual GPS data will be ignored once SPG4 is running. However, by setting the according parameter, the ACS Controller can be directed to ignore the SGP4 solution. - Skyview dataset for more GPS TM has been added +- Parameter to disable usage of MGM4, which is part of the MTQ and therefore cannot be + disabled without disabling the MTQ itself. ## Fixed From 181d3557417c9a483d4706f213be21df5bc780d5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 13:17:08 +0200 Subject: [PATCH 15/23] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 4b054b76..40365711 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 4b054b7628e43975e2401c7db10c358824f7a2d3 +Subproject commit 403657110b1555b0e15702cb96d7fe43e815a036 From fb2995575b592cc785a5abd2557605c57b93c0aa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 13:26:45 +0200 Subject: [PATCH 16/23] prep next version --- CHANGELOG.md | 4 +++- CMakeLists.txt | 2 +- mission/system/EiveSystem.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a41a7d..c04b24c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,9 @@ will consitute of a breaking change warranting a new major release: # [unreleased] -- `eive-tmtc`: +# [v6.4.0] 2023-08-15 + +- `eive-tmtc`: v5.4.0 ## Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 6610b0a6..058c99fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR 6) -set(OBSW_VERSION_MINOR 3) +set(OBSW_VERSION_MINOR 4) set(OBSW_VERSION_REVISION 0) # set(CMAKE_VERBOSE TRUE) diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 84b4edf7..6519806e 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -134,7 +134,7 @@ void EiveSystem::handleEventMessages() { if (event.getParameter1() == pdec::FRAME_DIRTY_RETVAL) { frameDirtyErrorCounter++; // Check whether threshold was reached after 10 seconds. - if(frameDirtyErrorCounter == 1) { + if (frameDirtyErrorCounter == 1) { frameDirtyCheckCd.resetTimer(); } } From e4545d0515d67f2c81021f0c9939a8269a88c332 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 13:29:46 +0200 Subject: [PATCH 17/23] new event, bump tmtc --- bsp_hosted/fsfwconfig/events/translateEvents.cpp | 7 +++++-- bsp_hosted/fsfwconfig/objects/translateObjects.cpp | 2 +- generators/bsp_hosted_events.csv | 1 + generators/bsp_q7s_events.csv | 1 + generators/events/translateEvents.cpp | 7 +++++-- generators/objects/translateObjects.cpp | 2 +- linux/fsfwconfig/events/translateEvents.cpp | 7 +++++-- linux/fsfwconfig/objects/translateObjects.cpp | 2 +- tmtc | 2 +- 9 files changed, 21 insertions(+), 10 deletions(-) diff --git a/bsp_hosted/fsfwconfig/events/translateEvents.cpp b/bsp_hosted/fsfwconfig/events/translateEvents.cpp index 51186d86..55158be2 100644 --- a/bsp_hosted/fsfwconfig/events/translateEvents.cpp +++ b/bsp_hosted/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 303 translations. + * @brief Auto-generated event translation file. Contains 304 translations. * @details - * Generated on: 2023-08-14 15:09:10 + * Generated on: 2023-08-15 13:27:11 */ #include "translateEvents.h" @@ -100,6 +100,7 @@ const char *MEKF_RECOVERY_STRING = "MEKF_RECOVERY"; const char *MEKF_AUTOMATIC_RESET_STRING = "MEKF_AUTOMATIC_RESET"; const char *MEKF_INVALID_MODE_VIOLATION_STRING = "MEKF_INVALID_MODE_VIOLATION"; const char *SAFE_MODE_CONTROLLER_FAILURE_STRING = "SAFE_MODE_CONTROLLER_FAILURE"; +const char *TLE_TOO_OLD_STRING = "TLE_TOO_OLD"; const char *SWITCH_CMD_SENT_STRING = "SWITCH_CMD_SENT"; const char *SWITCH_HAS_CHANGED_STRING = "SWITCH_HAS_CHANGED"; const char *SWITCHING_Q7S_DENIED_STRING = "SWITCHING_Q7S_DENIED"; @@ -501,6 +502,8 @@ const char *translateEvents(Event event) { return MEKF_INVALID_MODE_VIOLATION_STRING; case (11207): return SAFE_MODE_CONTROLLER_FAILURE_STRING; + case (11208): + return TLE_TOO_OLD_STRING; case (11300): return SWITCH_CMD_SENT_STRING; case (11301): diff --git a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp index ca561e5a..c7eb075d 100644 --- a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp +++ b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 171 translations. - * Generated on: 2023-08-14 15:09:10 + * Generated on: 2023-08-15 13:27:11 */ #include "translateObjects.h" diff --git a/generators/bsp_hosted_events.csv b/generators/bsp_hosted_events.csv index ecdf9534..b00c56b2 100644 --- a/generators/bsp_hosted_events.csv +++ b/generators/bsp_hosted_events.csv @@ -94,6 +94,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 11205;0x2bc5;MEKF_AUTOMATIC_RESET;INFO;MEKF performed an automatic reset after detection of nonfinite values.;mission/acs/defs.h 11206;0x2bc6;MEKF_INVALID_MODE_VIOLATION;HIGH;MEKF was not able to compute a solution during any pointing ACS mode for a prolonged time.;mission/acs/defs.h 11207;0x2bc7;SAFE_MODE_CONTROLLER_FAILURE;HIGH;The ACS safe mode controller was not able to compute a solution and has failed. P1: Missing information about magnetic field, P2: Missing information about rotational rate;mission/acs/defs.h +11208;0x2bc8;TLE_TOO_OLD;INFO;The TLE for the SGP4 Propagator has become too old.;mission/acs/defs.h 11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/power/defs.h 11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/power/defs.h 11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;No description;mission/power/defs.h diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index ecdf9534..b00c56b2 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -94,6 +94,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 11205;0x2bc5;MEKF_AUTOMATIC_RESET;INFO;MEKF performed an automatic reset after detection of nonfinite values.;mission/acs/defs.h 11206;0x2bc6;MEKF_INVALID_MODE_VIOLATION;HIGH;MEKF was not able to compute a solution during any pointing ACS mode for a prolonged time.;mission/acs/defs.h 11207;0x2bc7;SAFE_MODE_CONTROLLER_FAILURE;HIGH;The ACS safe mode controller was not able to compute a solution and has failed. P1: Missing information about magnetic field, P2: Missing information about rotational rate;mission/acs/defs.h +11208;0x2bc8;TLE_TOO_OLD;INFO;The TLE for the SGP4 Propagator has become too old.;mission/acs/defs.h 11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/power/defs.h 11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/power/defs.h 11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;No description;mission/power/defs.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 51186d86..55158be2 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 303 translations. + * @brief Auto-generated event translation file. Contains 304 translations. * @details - * Generated on: 2023-08-14 15:09:10 + * Generated on: 2023-08-15 13:27:11 */ #include "translateEvents.h" @@ -100,6 +100,7 @@ const char *MEKF_RECOVERY_STRING = "MEKF_RECOVERY"; const char *MEKF_AUTOMATIC_RESET_STRING = "MEKF_AUTOMATIC_RESET"; const char *MEKF_INVALID_MODE_VIOLATION_STRING = "MEKF_INVALID_MODE_VIOLATION"; const char *SAFE_MODE_CONTROLLER_FAILURE_STRING = "SAFE_MODE_CONTROLLER_FAILURE"; +const char *TLE_TOO_OLD_STRING = "TLE_TOO_OLD"; const char *SWITCH_CMD_SENT_STRING = "SWITCH_CMD_SENT"; const char *SWITCH_HAS_CHANGED_STRING = "SWITCH_HAS_CHANGED"; const char *SWITCHING_Q7S_DENIED_STRING = "SWITCHING_Q7S_DENIED"; @@ -501,6 +502,8 @@ const char *translateEvents(Event event) { return MEKF_INVALID_MODE_VIOLATION_STRING; case (11207): return SAFE_MODE_CONTROLLER_FAILURE_STRING; + case (11208): + return TLE_TOO_OLD_STRING; case (11300): return SWITCH_CMD_SENT_STRING; case (11301): diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 8430ac93..53be3a34 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 175 translations. - * Generated on: 2023-08-14 15:09:10 + * Generated on: 2023-08-15 13:27:11 */ #include "translateObjects.h" diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 51186d86..55158be2 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 303 translations. + * @brief Auto-generated event translation file. Contains 304 translations. * @details - * Generated on: 2023-08-14 15:09:10 + * Generated on: 2023-08-15 13:27:11 */ #include "translateEvents.h" @@ -100,6 +100,7 @@ const char *MEKF_RECOVERY_STRING = "MEKF_RECOVERY"; const char *MEKF_AUTOMATIC_RESET_STRING = "MEKF_AUTOMATIC_RESET"; const char *MEKF_INVALID_MODE_VIOLATION_STRING = "MEKF_INVALID_MODE_VIOLATION"; const char *SAFE_MODE_CONTROLLER_FAILURE_STRING = "SAFE_MODE_CONTROLLER_FAILURE"; +const char *TLE_TOO_OLD_STRING = "TLE_TOO_OLD"; const char *SWITCH_CMD_SENT_STRING = "SWITCH_CMD_SENT"; const char *SWITCH_HAS_CHANGED_STRING = "SWITCH_HAS_CHANGED"; const char *SWITCHING_Q7S_DENIED_STRING = "SWITCHING_Q7S_DENIED"; @@ -501,6 +502,8 @@ const char *translateEvents(Event event) { return MEKF_INVALID_MODE_VIOLATION_STRING; case (11207): return SAFE_MODE_CONTROLLER_FAILURE_STRING; + case (11208): + return TLE_TOO_OLD_STRING; case (11300): return SWITCH_CMD_SENT_STRING; case (11301): diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 8430ac93..53be3a34 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 175 translations. - * Generated on: 2023-08-14 15:09:10 + * Generated on: 2023-08-15 13:27:11 */ #include "translateObjects.h" diff --git a/tmtc b/tmtc index 40365711..f76cd945 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 403657110b1555b0e15702cb96d7fe43e815a036 +Subproject commit f76cd9453593375974bc67fa7ce3906c6eb4443a From af5f51928b2fbb44ccf12cfb8fb70e00843713f7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 13:49:06 +0200 Subject: [PATCH 18/23] PLOC SUPV periodic HK --- CHANGELOG.md | 1 + linux/payload/PlocSupervisorHandler.cpp | 9 +++++++++ mission/system/EiveSystem.cpp | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a41a7d..8a5aa945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ will consitute of a breaking change warranting a new major release: ## Added +- The PLOC SUPV HK set is requested and downlinked periodically if the SUPV is on now. - SGP4 Propagator is now used for propagating the position of EIVE. It will only work once a TLE has been uploaded with the newly added action command for the ACS Controller. In return the actual GPS data will be ignored once SPG4 is running. However, by setting the diff --git a/linux/payload/PlocSupervisorHandler.cpp b/linux/payload/PlocSupervisorHandler.cpp index 682b8020..5bb68d9d 100644 --- a/linux/payload/PlocSupervisorHandler.cpp +++ b/linux/payload/PlocSupervisorHandler.cpp @@ -155,12 +155,15 @@ void PlocSupervisorHandler::doStartUp() { startupState = StartupState::ON; } if (startupState == StartupState::ON) { + hkset.setReportingEnabled(true); setMode(_MODE_TO_ON); } } void PlocSupervisorHandler::doShutDown() { setMode(_MODE_POWER_DOWN); + hkset.setReportingEnabled(false); + hkset.setValidity(false, true); shutdownCmdSent = false; packetInBuffer = false; nextReplyId = supv::NONE; @@ -170,6 +173,10 @@ void PlocSupervisorHandler::doShutDown() { } ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { + if (not commandIsExecuting(GET_HK_REPORT)) { + *id = GET_HK_REPORT; + return OK; + } return NOTHING_TO_SEND; } @@ -790,6 +797,8 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool localDataPoolMap.emplace(supv::ADC_ENG_14, new PoolEntry({0})); localDataPoolMap.emplace(supv::ADC_ENG_15, new PoolEntry({0})); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(hkset.getSid(), false, 10.0)); return returnvalue::OK; } diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 84b4edf7..6519806e 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -134,7 +134,7 @@ void EiveSystem::handleEventMessages() { if (event.getParameter1() == pdec::FRAME_DIRTY_RETVAL) { frameDirtyErrorCounter++; // Check whether threshold was reached after 10 seconds. - if(frameDirtyErrorCounter == 1) { + if (frameDirtyErrorCounter == 1) { frameDirtyCheckCd.resetTimer(); } } From 2d18ce4ff16a8a1415434921eb88c1c5de213a65 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 13:59:59 +0200 Subject: [PATCH 19/23] adapt changelog --- CHANGELOG.md | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9d51ae4..1c2e5fdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ will consitute of a breaking change warranting a new major release: # [v6.4.0] 2023-08-15 -- `eive-tmtc`: v5.4.0 +- `eive-tmtc`: v5.4.2 ## Fixed diff --git a/tmtc b/tmtc index f76cd945..bc1a1774 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f76cd9453593375974bc67fa7ce3906c6eb4443a +Subproject commit bc1a1774a6ace986ec6a3acecb150b7c1d813fce From 963ca0c9393bd2a6363454cdf46994308e7b0824 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 14:34:10 +0200 Subject: [PATCH 20/23] PLOC SUPV --- linux/payload/PlocSupervisorHandler.cpp | 4 ++-- linux/payload/plocSupvDefs.h | 1 - tmtc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/linux/payload/PlocSupervisorHandler.cpp b/linux/payload/PlocSupervisorHandler.cpp index 5bb68d9d..6bd57a70 100644 --- a/linux/payload/PlocSupervisorHandler.cpp +++ b/linux/payload/PlocSupervisorHandler.cpp @@ -175,7 +175,7 @@ void PlocSupervisorHandler::doShutDown() { ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { if (not commandIsExecuting(GET_HK_REPORT)) { *id = GET_HK_REPORT; - return OK; + return buildCommandFromCommand(*id, nullptr, 0); } return NOTHING_TO_SEND; } @@ -927,7 +927,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) { ReturnValue_t result = returnvalue::OK; - result = verifyPacket(data, supv::SIZE_HK_REPORT); + result = verifyPacket(data, tmReader.getFullPacketLen()); if (result == result::CRC_FAILURE) { sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" << std::endl; diff --git a/linux/payload/plocSupvDefs.h b/linux/payload/plocSupvDefs.h index d3fda3da..907bfe0c 100644 --- a/linux/payload/plocSupvDefs.h +++ b/linux/payload/plocSupvDefs.h @@ -139,7 +139,6 @@ enum ReplyId : DeviceCommandId_t { // Size of complete space packet (6 byte header + size of data + 2 byte CRC) static const uint16_t SIZE_ACK_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14; -static const uint16_t SIZE_HK_REPORT = 52; static const uint16_t SIZE_BOOT_STATUS_REPORT = 24; static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31; static const uint16_t SIZE_LOGGING_REPORT = 73; diff --git a/tmtc b/tmtc index bc1a1774..2f8bed45 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit bc1a1774a6ace986ec6a3acecb150b7c1d813fce +Subproject commit 2f8bed4581e05628a3945756cef57ea1602514cb From e64e9daed111dca6f82b4cf6763baeea647b97d0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 14:42:12 +0200 Subject: [PATCH 21/23] bump eive-tmtc --- CHANGELOG.md | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c2e5fdc..233f1562 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ will consitute of a breaking change warranting a new major release: # [v6.4.0] 2023-08-15 -- `eive-tmtc`: v5.4.2 +- `eive-tmtc`: v5.4.3 ## Fixed diff --git a/tmtc b/tmtc index 2f8bed45..b50c75c1 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 2f8bed4581e05628a3945756cef57ea1602514cb +Subproject commit b50c75c13cdbbc3d34d2f072d2bf1cb2fbe734b5 From d1a446d445422ca3f973f7e1cb40d5dba036dbe8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Aug 2023 14:43:23 +0200 Subject: [PATCH 22/23] hopefully dont need this const --- linux/payload/PlocSupervisorHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/payload/PlocSupervisorHandler.cpp b/linux/payload/PlocSupervisorHandler.cpp index 6bd57a70..940785af 100644 --- a/linux/payload/PlocSupervisorHandler.cpp +++ b/linux/payload/PlocSupervisorHandler.cpp @@ -437,7 +437,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() { insertInReplyMap(MEMORY_CHECK, 5, nullptr, 0, false); // TM replies - insertInReplyMap(HK_REPORT, 3, &hkset, SIZE_HK_REPORT); + insertInReplyMap(HK_REPORT, 3, &hkset); insertInReplyMap(BOOT_STATUS_REPORT, 3, &bootStatusReport, SIZE_BOOT_STATUS_REPORT); insertInReplyMap(LATCHUP_REPORT, 3, &latchupStatusReport, SIZE_LATCHUP_STATUS_REPORT); insertInReplyMap(LOGGING_REPORT, 3, &loggingReport, SIZE_LOGGING_REPORT); From 72fc99dc49fca07519d7e6a38d8e5563d5640da9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 16 Aug 2023 10:54:02 +0200 Subject: [PATCH 23/23] date correction --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 233f1562..5357e831 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ will consitute of a breaking change warranting a new major release: # [unreleased] -# [v6.4.0] 2023-08-15 +# [v6.4.0] 2023-08-16 - `eive-tmtc`: v5.4.3