Merge remote-tracking branch 'origin/main' into scex-fs-usage-improvements

This commit is contained in:
Robin Müller 2023-08-02 09:29:04 +02:00
commit 833166cc78
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 54 additions and 10 deletions

View File

@ -25,6 +25,9 @@ will consitute of a breaking change warranting a new major release:
## Changed ## Changed
- SCEX: Only perform filesystem checks when not in OFF mode. - SCEX: Only perform filesystem checks when not in OFF mode.
- `EiveSystem`: Add a small delay between triggering an event for FDIR reboots and sending the
command to the core controller.
- The `EiveSystem` now only sends reboot commands targetting the same image.
# [v6.2.0] 2023-07-26 # [v6.2.0] 2023-07-26

View File

@ -195,10 +195,21 @@ 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.
TaskFactory::delayTask(500);
// We already tried an I2C recovery but the bus is still broken. // We already tried an I2C recovery but the bus is still broken.
// Send full reboot request to core controller. // Send reboot request to core controller.
sendFullRebootCommand(); 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.
return;
}
waitingForI2cReboot = true;
return; return;
} }
} }
@ -285,25 +296,38 @@ ReturnValue_t EiveSystem::sendFullRebootCommand() {
} }
void EiveSystem::pdecRecoveryLogic() { void EiveSystem::pdecRecoveryLogic() {
if (ptmeResetWasAttempted and ptmeResetWasAttemptedCd.hasTimedOut()) { if (pdecResetWasAttempted and pdecResetWasAttemptedCd.hasTimedOut()) {
ptmeResetWasAttempted = false; pdecResetWasAttempted = false;
} }
if (frameDirtyCheckCd.hasTimedOut()) { if (frameDirtyCheckCd.hasTimedOut()) {
if (frameDirtyErrorCounter >= FRAME_DIRTY_COM_REBOOT_LIMIT) { 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 (ptmeResetWasAttempted) { if (pdecResetWasAttempted) {
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.
TaskFactory::delayTask(500);
// Send reboot command. // Send reboot command.
sendFullRebootCommand(); 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 { } else {
// 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);
ptmeResetWasAttemptedCd.resetTimer(); pdecResetWasAttemptedCd.resetTimer();
ptmeResetWasAttempted = true; pdecResetWasAttempted = true;
} }
} }
frameDirtyErrorCounter = 0; frameDirtyErrorCounter = 0;
@ -329,3 +353,17 @@ ReturnValue_t EiveSystem::handleCommandMessage(CommandMessage* message) {
} }
return Subsystem::handleCommandMessage(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);
}

View File

@ -39,8 +39,10 @@ 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 ptmeResetWasAttemptedCd = Countdown(120000); Countdown pdecResetWasAttemptedCd = Countdown(120000);
bool ptmeResetWasAttempted = false; bool pdecResetWasAttempted = false;
bool waitingForI2cReboot = false;
bool waitingForPdecReboot = false;
ActionHelper actionHelper; ActionHelper actionHelper;
PowerSwitchIF* powerSwitcher = nullptr; PowerSwitchIF* powerSwitcher = nullptr;
@ -63,6 +65,7 @@ class EiveSystem : public Subsystem, public HasActionsIF {
ReturnValue_t handleCommandMessage(CommandMessage* message) override; ReturnValue_t handleCommandMessage(CommandMessage* message) override;
ReturnValue_t sendFullRebootCommand(); ReturnValue_t sendFullRebootCommand();
ReturnValue_t sendSelfRebootCommand();
void pdecRecoveryLogic(); void pdecRecoveryLogic();