reworked PDEC FDIR

This commit is contained in:
Robin Müller 2023-08-04 14:23:10 +02:00
parent b2d9582a46
commit 669c3630a9
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
2 changed files with 32 additions and 32 deletions

View File

@ -296,14 +296,9 @@ ReturnValue_t EiveSystem::sendFullRebootCommand() {
} }
void EiveSystem::pdecRecoveryLogic() { void EiveSystem::pdecRecoveryLogic() {
if (pdecResetWasAttempted and pdecResetWasAttemptedCd.hasTimedOut()) { if (pdecResetCounter >= PDEC_RESET_MAX_COUNT_BEFORE_REBOOT) {
pdecResetWasAttempted = false;
}
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, // If a PTME reset was already attempted and there is still an issue receiving TC frames,
// reboot the system. // reboot the system.
if (pdecResetWasAttempted) {
if (waitingForPdecReboot) { if (waitingForPdecReboot) {
return; return;
} }
@ -315,20 +310,24 @@ void EiveSystem::pdecRecoveryLogic() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "Sending a reboot command has failed" << std::endl; sif::error << "Sending a reboot command has failed" << std::endl;
// 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.
pdecResetWasAttemptedCd.resetTimer(); pdecResetCounterResetCd.resetTimer();
return; return;
} }
waitingForPdecReboot = true; waitingForPdecReboot = true;
return; return;
} else { }
if (pdecResetCounterResetCd.hasTimedOut()) {
pdecResetCounter = 0;
}
if (frameDirtyCheckCd.hasTimedOut()) {
if (frameDirtyErrorCounter >= FRAME_DIRTY_COM_REBOOT_LIMIT) {
// Try one full PDEC reset. // Try one full PDEC reset.
CommandMessage msg; CommandMessage msg;
store_address_t dummy{}; store_address_t dummy{};
ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy); ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy);
commandQueue->sendMessage(pdecHandlerQueueId, &msg); commandQueue->sendMessage(pdecHandlerQueueId, &msg);
pdecResetWasAttemptedCd.resetTimer(); pdecResetCounterResetCd.resetTimer();
pdecResetWasAttempted = true; pdecResetCounter++;
}
} }
frameDirtyErrorCounter = 0; frameDirtyErrorCounter = 0;
frameDirtyCheckCd.resetTimer(); frameDirtyCheckCd.resetTimer();

View File

@ -10,6 +10,7 @@
class EiveSystem : public Subsystem, public HasActionsIF { class EiveSystem : public Subsystem, public HasActionsIF {
public: public:
static constexpr uint8_t FRAME_DIRTY_COM_REBOOT_LIMIT = 4; 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; static constexpr ActionId_t EXECUTE_I2C_REBOOT = 10;
@ -39,11 +40,11 @@ class EiveSystem : public Subsystem, public HasActionsIF {
Countdown frameDirtyCheckCd = Countdown(10000); Countdown frameDirtyCheckCd = Countdown(10000);
// If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that // 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. // only a full reboot will fix the issue.
Countdown pdecResetWasAttemptedCd = Countdown(120000); Countdown pdecResetCounterResetCd = Countdown(120000);
bool pdecResetWasAttempted = false;
bool waitingForI2cReboot = false; bool waitingForI2cReboot = false;
bool waitingForPdecReboot = false; bool waitingForPdecReboot = false;
uint32_t pdecResetCounter = 0;
ActionHelper actionHelper; ActionHelper actionHelper;
PowerSwitchIF* powerSwitcher = nullptr; PowerSwitchIF* powerSwitcher = nullptr;
std::atomic_uint16_t& i2cErrors; std::atomic_uint16_t& i2cErrors;