add health handling for TCS ASSY
This commit is contained in:
parent
6aae94823e
commit
ca6556c000
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user