added rest of necessary logic
This commit is contained in:
@ -63,11 +63,8 @@ void EiveSystem::performChildOperation() {
|
||||
performSafeRecovery = false;
|
||||
return;
|
||||
}
|
||||
if (frameDirtyCheckCd.hasTimedOut()) {
|
||||
if (frameDirtyErrorCounter >= 4) {
|
||||
}
|
||||
frameDirtyErrorCounter = 0;
|
||||
}
|
||||
pdecRecoveryLogic();
|
||||
|
||||
i2cRecoveryLogic();
|
||||
}
|
||||
|
||||
@ -92,6 +89,12 @@ ReturnValue_t EiveSystem::initialize() {
|
||||
}
|
||||
coreCtrlQueueId = coreCtrl->getCommandQueue();
|
||||
|
||||
auto* pdecHandler = ObjectManager::instance()->get<HasActionsIF>(objects::PDEC_HANDLER);
|
||||
if (pdecHandler == nullptr) {
|
||||
return ObjectManager::CHILD_INIT_FAILED;
|
||||
}
|
||||
pdecHandlerQueueId = pdecHandler->getCommandQueue();
|
||||
|
||||
auto* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||
if (manager == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
@ -188,9 +191,8 @@ void EiveSystem::i2cRecoveryLogic() {
|
||||
} else {
|
||||
// We already tried an I2C recovery but the bus is still broken.
|
||||
// Send full reboot request to core controller.
|
||||
CommandMessage msg;
|
||||
ActionMessage::setCommand(&msg, core::REBOOT_OBC, store_address_t());
|
||||
result = commandQueue->sendMessage(coreCtrlQueueId, &msg);
|
||||
sendFullRebootCommand();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,6 +271,33 @@ void EiveSystem::i2cRecoveryLogic() {
|
||||
|
||||
void EiveSystem::commandSelfToSafe() { startTransition(satsystem::Mode::SAFE, 0); }
|
||||
|
||||
ReturnValue_t EiveSystem::sendFullRebootCommand() {
|
||||
CommandMessage msg;
|
||||
ActionMessage::setCommand(&msg, core::REBOOT_OBC, store_address_t());
|
||||
return commandQueue->sendMessage(coreCtrlQueueId, &msg);
|
||||
}
|
||||
|
||||
void EiveSystem::pdecRecoveryLogic() {
|
||||
if (frameDirtyCheckCd.hasTimedOut()) {
|
||||
if (frameDirtyErrorCounter >= 4) {
|
||||
// If a PTME reset was already attempted and there is still an issue receiving TC frames,
|
||||
// reboot the system.
|
||||
if (ptmeResetWasAttemptedCd.isBusy()) {
|
||||
// Send reboot command.
|
||||
sendFullRebootCommand();
|
||||
} else {
|
||||
// Try one full PDEC reset.
|
||||
CommandMessage msg;
|
||||
store_address_t dummy{};
|
||||
ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy);
|
||||
commandQueue->sendMessage(pdecHandlerQueueId, &msg);
|
||||
ptmeResetWasAttemptedCd.resetTimer();
|
||||
}
|
||||
}
|
||||
frameDirtyErrorCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EiveSystem::commonI2cRecoverySequenceFinish() {
|
||||
alreadyTriedI2cRecovery = true;
|
||||
performI2cReboot = false;
|
||||
|
@ -37,11 +37,14 @@ class EiveSystem : public Subsystem, public HasActionsIF {
|
||||
|
||||
uint8_t frameDirtyErrorCounter = 0;
|
||||
Countdown frameDirtyCheckCd = Countdown(10000);
|
||||
Countdown ptmeResetWasAttemptedCd = Countdown(60000);
|
||||
|
||||
ActionHelper actionHelper;
|
||||
PowerSwitchIF* powerSwitcher = nullptr;
|
||||
std::atomic_uint16_t& i2cErrors;
|
||||
|
||||
MessageQueueId_t pdecHandlerQueueId = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
MessageQueueId_t bpxBattQueueId = MessageQueueIF::NO_QUEUE;
|
||||
MessageQueueId_t coreCtrlQueueId = MessageQueueIF::NO_QUEUE;
|
||||
MessageQueueId_t actionCommandedBy = MessageQueueIF::NO_QUEUE;
|
||||
@ -56,6 +59,10 @@ class EiveSystem : public Subsystem, public HasActionsIF {
|
||||
const uint8_t* data, size_t size) override;
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
|
||||
ReturnValue_t sendFullRebootCommand();
|
||||
|
||||
void pdecRecoveryLogic();
|
||||
|
||||
void i2cRecoveryLogic();
|
||||
void handleEventMessages();
|
||||
void commandSelfToSafe();
|
||||
|
Reference in New Issue
Block a user