TCS: Prevent spam #655
@ -1631,14 +1631,19 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
|
|||||||
bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch redSwitchNr) {
|
bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch redSwitchNr) {
|
||||||
bool heaterAvailable = true;
|
bool heaterAvailable = true;
|
||||||
|
|
||||||
if (heaterHandler.getHealth(switchNr) != HasHealthIF::HEALTHY) {
|
HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr);
|
||||||
if (heaterHandler.getHealth(redSwitchNr) == HasHealthIF::HEALTHY) {
|
HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr);
|
||||||
|
if (mainHealth != HasHealthIF::HEALTHY) {
|
||||||
|
if (redHealth == HasHealthIF::HEALTHY) {
|
||||||
switchNr = redSwitchNr;
|
switchNr = redSwitchNr;
|
||||||
redSwitchNrInUse = true;
|
redSwitchNrInUse = true;
|
||||||
} else {
|
} else {
|
||||||
heaterAvailable = false;
|
heaterAvailable = false;
|
||||||
|
// Special case: Ground might command/do something with the heaters, so prevent spam.
|
||||||
|
if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) {
|
||||||
triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr);
|
triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
redSwitchNrInUse = false;
|
redSwitchNrInUse = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user