this is the cleanest solution
Some checks are pending
EIVE/eive-obsw/pipeline/pr-main Build started...

This commit is contained in:
Robin Müller 2023-08-02 09:19:43 +02:00
parent 988da377b1
commit 4b4dd35b55
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 11 additions and 5 deletions

View File

@ -195,6 +195,9 @@ void EiveSystem::i2cRecoveryLogic() {
// Try recovery. // Try recovery.
executeAction(EXECUTE_I2C_REBOOT, MessageQueueIF::NO_QUEUE, nullptr, 0); executeAction(EXECUTE_I2C_REBOOT, MessageQueueIF::NO_QUEUE, nullptr, 0);
} else { } else {
if (waitingForI2cReboot) {
return;
}
triggerEvent(core::I2C_REBOOT); triggerEvent(core::I2C_REBOOT);
// Some delay to ensure that the event is stored in the persistent TM store as well. // Some delay to ensure that the event is stored in the persistent TM store as well.
TaskFactory::delayTask(500); TaskFactory::delayTask(500);
@ -206,8 +209,7 @@ void EiveSystem::i2cRecoveryLogic() {
// If the previous operation failed, it should be re-attempted the next task cycle. // If the previous operation failed, it should be re-attempted the next task cycle.
return; return;
} }
// Wait for reboot to be done. waitingForI2cReboot = true;
TaskFactory::delayTask(3000);
return; return;
} }
} }
@ -302,6 +304,9 @@ void EiveSystem::pdecRecoveryLogic() {
// If a PTME reset was already attempted and there is still an issue receiving TC frames, // If a PTME reset was already attempted and there is still an issue receiving TC frames,
// reboot the system. // reboot the system.
if (ptmeResetWasAttempted) { if (ptmeResetWasAttempted) {
if (waitingForPdecReboot) {
return;
}
triggerEvent(core::PDEC_REBOOT); triggerEvent(core::PDEC_REBOOT);
// Some delay to ensure that the event is stored in the persistent TM store as well. // Some delay to ensure that the event is stored in the persistent TM store as well.
TaskFactory::delayTask(500); TaskFactory::delayTask(500);
@ -312,9 +317,7 @@ void EiveSystem::pdecRecoveryLogic() {
// If the previous operation failed, it should be re-attempted the next task cycle. // If the previous operation failed, it should be re-attempted the next task cycle.
ptmeResetWasAttemptedCd.resetTimer(); ptmeResetWasAttemptedCd.resetTimer();
} }
// We are done / about to reboot. Delay the rest of the time, graceful reboot takes some waitingForPdecReboot = true;
// time.
TaskFactory::delayTask(3000);
return; return;
} else { } else {
// Try one full PDEC reset. // Try one full PDEC reset.
@ -324,6 +327,7 @@ void EiveSystem::pdecRecoveryLogic() {
commandQueue->sendMessage(pdecHandlerQueueId, &msg); commandQueue->sendMessage(pdecHandlerQueueId, &msg);
ptmeResetWasAttemptedCd.resetTimer(); ptmeResetWasAttemptedCd.resetTimer();
ptmeResetWasAttempted = true; ptmeResetWasAttempted = true;
return;
} }
} }
frameDirtyErrorCounter = 0; frameDirtyErrorCounter = 0;

View File

@ -41,6 +41,8 @@ class EiveSystem : public Subsystem, public HasActionsIF {
// only a full reboot will fix the issue. // only a full reboot will fix the issue.
Countdown ptmeResetWasAttemptedCd = Countdown(120000); Countdown ptmeResetWasAttemptedCd = Countdown(120000);
bool ptmeResetWasAttempted = false; bool ptmeResetWasAttempted = false;
bool waitingForI2cReboot = false;
bool waitingForPdecReboot = false;
ActionHelper actionHelper; ActionHelper actionHelper;
PowerSwitchIF* powerSwitcher = nullptr; PowerSwitchIF* powerSwitcher = nullptr;