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 950e86ce4b - Show all commits

View File

@ -1643,21 +1643,22 @@ bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch re
HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr); HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr);
heater::SwitchState mainState = heaterHandler.getSwitchState(switchNr); heater::SwitchState mainState = heaterHandler.getSwitchState(switchNr);
HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr); HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr);
if (not(mainHealth == HasHealthIF::EXTERNAL_CONTROL and mainState == heater::SwitchState::ON)) { if (mainHealth == HasHealthIF::EXTERNAL_CONTROL and mainState == heater::SwitchState::ON) {
if (mainHealth != HasHealthIF::HEALTHY) { return false;
if (redHealth == HasHealthIF::HEALTHY) { }
switchNr = redSwitchNr; if (mainHealth != HasHealthIF::HEALTHY) {
ctrlCtx.redSwitchNrInUse = true; if (redHealth == HasHealthIF::HEALTHY) {
} else { switchNr = redSwitchNr;
heaterAvailable = false; ctrlCtx.redSwitchNrInUse = true;
// 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 { } else {
ctrlCtx.redSwitchNrInUse = 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);
}
} }
} else {
ctrlCtx.redSwitchNrInUse = false;
} }
return heaterAvailable; return heaterAvailable;
@ -1714,7 +1715,8 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) {
if (thermalStates[ctrlCtx.thermalComponent].heating) { if (thermalStates[ctrlCtx.thermalComponent].heating) {
// We are already in a heating cycle, so need to check whether heating task is complete. // We are already in a heating cycle, so need to check whether heating task is complete.
if (ctrlCtx.sensorTemp >= htrCtx.tempLimit.opLowerLimit + TEMP_OFFSET and if (ctrlCtx.sensorTemp >= htrCtx.tempLimit.opLowerLimit + TEMP_OFFSET and
heaterCtrlAllowed()) { heaterCtrlAllowed() /*and
heaterHandler.getHealth(htrCtx.switchNr) != HasHealthIF::EXTERNAL_CONTROL*/) {
sif::info << "TCS: Heater " << static_cast<int>(ctrlCtx.thermalComponent) << " OFF" sif::info << "TCS: Heater " << static_cast<int>(ctrlCtx.thermalComponent) << " OFF"
<< std::endl; << std::endl;
heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, ctrlCtx.thermalComponent); heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, ctrlCtx.thermalComponent);