diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index a202b8d6..78791159 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -195,6 +195,9 @@ void EiveSystem::i2cRecoveryLogic() { // Try recovery. executeAction(EXECUTE_I2C_REBOOT, MessageQueueIF::NO_QUEUE, nullptr, 0); } else { + if (waitingForI2cReboot) { + return; + } triggerEvent(core::I2C_REBOOT); // Some delay to ensure that the event is stored in the persistent TM store as well. TaskFactory::delayTask(500); @@ -206,8 +209,7 @@ void EiveSystem::i2cRecoveryLogic() { // If the previous operation failed, it should be re-attempted the next task cycle. return; } - // Wait for reboot to be done. - TaskFactory::delayTask(3000); + waitingForI2cReboot = true; return; } } @@ -302,6 +304,9 @@ void EiveSystem::pdecRecoveryLogic() { // If a PTME reset was already attempted and there is still an issue receiving TC frames, // reboot the system. if (ptmeResetWasAttempted) { + 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); @@ -312,9 +317,7 @@ void EiveSystem::pdecRecoveryLogic() { // If the previous operation failed, it should be re-attempted the next task cycle. ptmeResetWasAttemptedCd.resetTimer(); } - // We are done / about to reboot. Delay the rest of the time, graceful reboot takes some - // time. - TaskFactory::delayTask(3000); + waitingForPdecReboot = true; return; } else { // Try one full PDEC reset. @@ -324,6 +327,7 @@ void EiveSystem::pdecRecoveryLogic() { commandQueue->sendMessage(pdecHandlerQueueId, &msg); ptmeResetWasAttemptedCd.resetTimer(); ptmeResetWasAttempted = true; + return; } } frameDirtyErrorCounter = 0; diff --git a/mission/system/EiveSystem.h b/mission/system/EiveSystem.h index 33b75151..486b13c5 100644 --- a/mission/system/EiveSystem.h +++ b/mission/system/EiveSystem.h @@ -41,6 +41,8 @@ class EiveSystem : public Subsystem, public HasActionsIF { // only a full reboot will fix the issue. Countdown ptmeResetWasAttemptedCd = Countdown(120000); bool ptmeResetWasAttempted = false; + bool waitingForI2cReboot = false; + bool waitingForPdecReboot = false; ActionHelper actionHelper; PowerSwitchIF* powerSwitcher = nullptr;