From a884176773715887f20fd0d2af1c9c40a419ba6b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Aug 2023 09:26:06 +0200 Subject: [PATCH] improvements for reboot FDIR --- mission/system/EiveSystem.cpp | 24 +++++++++++++++++++++--- mission/system/EiveSystem.h | 1 + 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index f17b82cb..b58316d4 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -196,9 +196,11 @@ void EiveSystem::i2cRecoveryLogic() { executeAction(EXECUTE_I2C_REBOOT, MessageQueueIF::NO_QUEUE, nullptr, 0); } else { triggerEvent(core::I2C_REBOOT); + // Some delay to ensure that the event is stored in the persistent TM store as well. + TaskFactory::delayTask(500); // We already tried an I2C recovery but the bus is still broken. - // Send full reboot request to core controller. - sendFullRebootCommand(); + // Send reboot request to core controller. + sendSelfRebootCommand(); return; } } @@ -294,8 +296,10 @@ void EiveSystem::pdecRecoveryLogic() { // reboot the system. if (ptmeResetWasAttempted) { 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. - sendFullRebootCommand(); + sendSelfRebootCommand(); } else { // Try one full PDEC reset. CommandMessage msg; @@ -329,3 +333,17 @@ ReturnValue_t EiveSystem::handleCommandMessage(CommandMessage* message) { } return Subsystem::handleCommandMessage(message); } + +ReturnValue_t EiveSystem::sendSelfRebootCommand() { + CommandMessage msg; + uint8_t data[1]; + // This option is used to target the same image. + data[0] = true; + store_address_t storeId; + ReturnValue_t result = IPCStore->addData(&storeId, data, sizeof(data)); + if (result != returnvalue::OK) { + return result; + } + ActionMessage::setCommand(&msg, core::XSC_REBOOT_OBC, storeId); + return commandQueue->sendMessage(coreCtrlQueueId, &msg); +} diff --git a/mission/system/EiveSystem.h b/mission/system/EiveSystem.h index 67f11c3e..33b75151 100644 --- a/mission/system/EiveSystem.h +++ b/mission/system/EiveSystem.h @@ -63,6 +63,7 @@ class EiveSystem : public Subsystem, public HasActionsIF { ReturnValue_t handleCommandMessage(CommandMessage* message) override; ReturnValue_t sendFullRebootCommand(); + ReturnValue_t sendSelfRebootCommand(); void pdecRecoveryLogic();