backup heater will not be chosen if heater is on ext ctrl and on
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Marius Eggert 2024-03-18 10:34:21 +01:00
parent 36edd3e324
commit 096328aadc

View File

@ -1641,21 +1641,25 @@ bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch re
bool heaterAvailable = true; bool heaterAvailable = true;
HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr); HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr);
heater::SwitchState mainState = heaterHandler.getSwitchState(switchNr);
HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr); HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr);
if (mainHealth != HasHealthIF::HEALTHY) { if (not(mainHealth == HasHealthIF::EXTERNAL_CONTROL and mainState == heater::SwitchState::ON)) {
if (redHealth == HasHealthIF::HEALTHY) { if (mainHealth != HasHealthIF::HEALTHY) {
switchNr = redSwitchNr; if (redHealth == HasHealthIF::HEALTHY) {
ctrlCtx.redSwitchNrInUse = true; switchNr = redSwitchNr;
} else { ctrlCtx.redSwitchNrInUse = true;
heaterAvailable = false; } else {
// Special case: Ground might command/do something with the heaters, so prevent spam. heaterAvailable = false;
if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) { // Special case: Ground might command/do something with the heaters, so prevent spam.
triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) {
triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr);
}
} }
} else {
ctrlCtx.redSwitchNrInUse = false;
} }
} else {
ctrlCtx.redSwitchNrInUse = false;
} }
return heaterAvailable; return heaterAvailable;
} }