proper fault/ext ctrl handling for dual side
This commit is contained in:
@ -158,18 +158,29 @@ void SusAssembly::refreshHelperModes() {
|
||||
ReturnValue_t SusAssembly::checkAndHandleHealthStates(Mode_t deviceMode, Submode_t deviceSubmode) {
|
||||
using namespace returnvalue;
|
||||
ReturnValue_t status = returnvalue::OK;
|
||||
auto overwriteHealthForOneDev = [&](object_id_t dev) {
|
||||
auto checkSusGroup = [&](object_id_t devNom, object_id_t devRed) {
|
||||
HealthState healthNom = healthHelper.healthTable->getHealth(devNom);
|
||||
HealthState healthRed = healthHelper.healthTable->getHealth(devRed);
|
||||
if ((healthNom == FAULTY or healthNom == PERMANENT_FAULTY) and
|
||||
(healthRed == FAULTY or healthRed == PERMANENT_FAULTY)) {
|
||||
overwriteDeviceHealth(devNom, healthNom);
|
||||
overwriteDeviceHealth(devRed, healthRed);
|
||||
}
|
||||
};
|
||||
auto checkHealthForOneDev = [&](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) {
|
||||
if (health == EXTERNAL_CONTROL) {
|
||||
modeHelper.setForced(true);
|
||||
}
|
||||
};
|
||||
if (deviceSubmode == duallane::DUAL_MODE) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
overwriteHealthForOneDev(helper.susIds[idx]);
|
||||
uint8_t idx = 0;
|
||||
for (idx = 0; idx < 6; idx++) {
|
||||
checkSusGroup(helper.susIds[idx], helper.susIds[idx + 6]);
|
||||
checkHealthForOneDev(helper.susIds[idx]);
|
||||
}
|
||||
for (idx = 6; idx < 12; idx++) {
|
||||
checkHealthForOneDev(helper.susIds[idx]);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
|
Reference in New Issue
Block a user