Merge pull request 'Health handling for SUS assy' (#418) from bugfix_sus_brd_assy into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #418
This commit is contained in:
Robin Müller 2023-03-02 18:26:55 +01:00
commit 21ed43614e
5 changed files with 30 additions and 3 deletions

View File

@ -395,7 +395,7 @@ LocalPoolDataSetBase* ImtqHandler::getDataSetHandle(sid_t sid) {
} else if (sid == negZselfTestDataset.getSid()) { } else if (sid == negZselfTestDataset.getSid()) {
return &negZselfTestDataset; return &negZselfTestDataset;
} else { } else {
sif::error << "IMTQHandler::getDataSetHandle: Invalid sid" << std::endl; sif::error << "ImtqHandler::getDataSetHandle: Invalid SID" << std::endl;
return nullptr; return nullptr;
} }
} }

View File

@ -37,7 +37,7 @@ void SusHandler::doShutDown() {
updatePeriodicReply(false, REPLY); updatePeriodicReply(false, REPLY);
commandExecuted = false; commandExecuted = false;
internalState = InternalState::NONE; internalState = InternalState::NONE;
setMode(_MODE_POWER_DOWN); setMode(MODE_OFF);
} }
} }

View File

@ -24,6 +24,12 @@ ReturnValue_t SusAssembly::commandChildren(Mode_t mode, Submode_t submode) {
modeTable[idx].setMode(MODE_OFF); modeTable[idx].setMode(MODE_OFF);
modeTable[idx].setSubmode(SUBMODE_NONE); modeTable[idx].setSubmode(SUBMODE_NONE);
} }
if (recoveryState == RecoveryState::RECOVERY_IDLE) {
result = checkAndHandleHealthStates(mode, submode);
if (result == NEED_TO_CHANGE_HEALTH) {
return returnvalue::OK;
}
}
if (recoveryState != RecoveryState::RECOVERY_STARTED) { if (recoveryState != RecoveryState::RECOVERY_STARTED) {
if (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) { if (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) {
result = handleNormalOrOnModeCmd(mode, submode); result = handleNormalOrOnModeCmd(mode, submode);
@ -148,3 +154,23 @@ void SusAssembly::refreshHelperModes() {
helper.susModes[idx] = childrenMap[helper.susIds[idx]].mode; helper.susModes[idx] = childrenMap[helper.susIds[idx]].mode;
} }
} }
ReturnValue_t SusAssembly::checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode) {
using namespace returnvalue;
ReturnValue_t status = returnvalue::OK;
auto overwriteHealthForOneDev = [&](object_id_t dev) {
HealthState health = healthHelper.healthTable->getHealth(dev);
if (health == FAULTY or health == PERMANENT_FAULTY) {
overwriteDeviceHealth(dev, health);
status = NEED_TO_CHANGE_HEALTH;
} else if (health == EXTERNAL_CONTROL) {
modeHelper.setForced(true);
}
};
if (deviceSubmode == duallane::DUAL_MODE) {
for (uint8_t idx = 0; idx < 12; idx++) {
overwriteHealthForOneDev(helper.susIds[idx]);
}
}
return status;
}

View File

@ -66,6 +66,7 @@ class SusAssembly : public DualLaneAssemblyBase {
void powerStateMachine(Mode_t mode, Submode_t submode); void powerStateMachine(Mode_t mode, Submode_t submode);
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode); ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
void refreshHelperModes(); void refreshHelperModes();
ReturnValue_t checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode);
}; };
#endif /* MISSION_SYSTEM_SUSASSEMBLY_H_ */ #endif /* MISSION_SYSTEM_SUSASSEMBLY_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit 68c46a299fd643a34510de315277a16e744999fe Subproject commit 77fbcede10d44fd15dc7d5d1b3965f06c6a8e7fc