add health handling for TCS ASSY
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-06 15:41:56 +01:00
parent 6aae94823e
commit ca6556c000
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 26 additions and 2 deletions

View File

@ -41,6 +41,12 @@ ReturnValue_t TcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode)
modeTable[idx].setMode(MODE_OFF);
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 (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) {
result = handleNormalOrOnModeCmd(mode, submode);
@ -180,9 +186,26 @@ void TcsBoardAssembly::handleModeReached() {
}
void TcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) {
// TODO: Maybe try a reboot once here?
triggerEvent(CHILDREN_LOST_MODE, result);
return;
startTransition(mode, submode);
}
ReturnValue_t TcsBoardAssembly::checkAndHandleHealthStates(Mode_t deviceMode,
Submode_t deviceSubmode) {
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);
}
};
for (const auto& dev : helper.rtdInfos) {
overwriteHealthForOneDev(dev.first);
}
return returnvalue::OK;
}
void TcsBoardAssembly::handleModeTransitionFailed(ReturnValue_t result) {

View File

@ -52,6 +52,7 @@ class TcsBoardAssembly : public AssemblyBase, public ConfirmsFailuresIF {
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
void startTransition(Mode_t mode, Submode_t submode) override;
void handleModeReached() override;
ReturnValue_t checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode);
// These two overrides prevent a transition of the whole assembly back to off just because
// some devices are not working