TCS Ctrl Time Limit not for Heaters in External Control #878

Merged
meggert merged 8 commits from tcs-ctrl-ignores-ext-ctrl into main 2024-03-18 11:36:33 +01:00
Showing only changes of commit 096328aadc - Show all commits

View File

@ -1641,21 +1641,25 @@ bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch re
bool heaterAvailable = true;
HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr);
heater::SwitchState mainState = heaterHandler.getSwitchState(switchNr);
HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr);
if (mainHealth != HasHealthIF::HEALTHY) {
if (redHealth == HasHealthIF::HEALTHY) {
switchNr = redSwitchNr;
ctrlCtx.redSwitchNrInUse = true;
} else {
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);
if (not(mainHealth == HasHealthIF::EXTERNAL_CONTROL and mainState == heater::SwitchState::ON)) {
if (mainHealth != HasHealthIF::HEALTHY) {
if (redHealth == HasHealthIF::HEALTHY) {
switchNr = redSwitchNr;
ctrlCtx.redSwitchNrInUse = true;
} else {
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);
}
}
} else {
ctrlCtx.redSwitchNrInUse = false;
}
} else {
ctrlCtx.redSwitchNrInUse = false;
}
return heaterAvailable;
}