TCS CTRL bugfix #730

Merged
muellerr merged 6 commits from tcs-ctrl-bugfix into main 2023-07-07 11:44:39 +02:00
2 changed files with 10 additions and 4 deletions

View File

@ -29,6 +29,10 @@ will consitute of a breaking change warranting a new major release:
- TMP1075: Set dataset invalid on shutdown explicitely - TMP1075: Set dataset invalid on shutdown explicitely
- Small fixes for TMP1075 FDIR: Use strange and missed reply counters. - Small fixes for TMP1075 FDIR: Use strange and missed reply counters.
- TCS controller: A helper member to track the elapsed heater control cycles was not reset
properly, which could lead to switch transitions being completed immediately. This can
lead to weird bugs like heaters being commanded ON twice and can potentially lead to
other bugs.
- TMP1075: Devices did not go to OFF mode when being set faulty. - TMP1075: Devices did not go to OFF mode when being set faulty.
- Update PL PCDU 1 in TCS mode tree on the EM. - Update PL PCDU 1 in TCS mode tree on the EM.
- TMP1075: Possibly ignored health commands. - TMP1075: Possibly ignored health commands.

View File

@ -1687,7 +1687,8 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) {
// Heater off // Heater off
if (htrCtx.switchState == HeaterHandler::SwitchState::OFF) { if (htrCtx.switchState == HeaterHandler::SwitchState::OFF) {
if (sensorTemp < htrCtx.tempLimit.opLowerLimit and heaterCtrlAllowed()) { if (sensorTemp < htrCtx.tempLimit.opLowerLimit and heaterCtrlAllowed()) {
sif::info << "TCS: Heater " << static_cast<int>(currThermalComponent) << " ON" << std::endl; sif::info << "TCS: Heater " << static_cast<int>(htrCtx.switchNr) << " for component "
<< static_cast<int>(currThermalComponent) << " ON" << std::endl;
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::ON, currThermalComponent); heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::ON, currThermalComponent);
heaterStates[htrCtx.switchNr].switchTransition = true; heaterStates[htrCtx.switchNr].switchTransition = true;
heaterStates[htrCtx.switchNr].target = HeaterHandler::SwitchState::ON; heaterStates[htrCtx.switchNr].target = HeaterHandler::SwitchState::ON;
@ -1704,8 +1705,8 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) {
if (thermalStates[currThermalComponent].heating) { if (thermalStates[currThermalComponent].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 (sensorTemp >= htrCtx.tempLimit.opLowerLimit + TEMP_OFFSET and heaterCtrlAllowed()) { if (sensorTemp >= htrCtx.tempLimit.opLowerLimit + TEMP_OFFSET and heaterCtrlAllowed()) {
sif::info << "TCS: Heater " << static_cast<int>(currThermalComponent) << " OFF" sif::info << "TCS: Heater " << static_cast<int>(htrCtx.switchNr) << " for component "
<< std::endl; << static_cast<int>(currThermalComponent) << " OFF" << std::endl;
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent); heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
heaterStates[htrCtx.switchNr].switchTransition = true; heaterStates[htrCtx.switchNr].switchTransition = true;
heaterStates[htrCtx.switchNr].target = HeaterHandler::SwitchState::OFF; heaterStates[htrCtx.switchNr].target = HeaterHandler::SwitchState::OFF;
@ -1756,9 +1757,10 @@ void ThermalController::heaterTransitionControl(const HeaterSwitchStates& curren
if (heaterStates[i].switchTransition) { if (heaterStates[i].switchTransition) {
if (currentHeaterStates[i] == heaterStates[i].target) { if (currentHeaterStates[i] == heaterStates[i].target) {
heaterStates[i].switchTransition = false; heaterStates[i].switchTransition = false;
heaterStates[i].heaterSwitchControlCycles = 0;
continue; continue;
} }
if (heaterStates[i].heaterSwitchControlCycles > 3) { if (heaterStates[i].heaterSwitchControlCycles > 5) {
heaterStates[i].switchTransition = false; heaterStates[i].switchTransition = false;
heaterStates[i].heaterSwitchControlCycles = 0; heaterStates[i].heaterSwitchControlCycles = 0;
} }