TCS heater upper burn limit #732

Merged
muellerr merged 18 commits from tcs-heater-upper-limit into main 2023-07-11 10:56:44 +02:00
Showing only changes of commit ff7d0b3989 - Show all commits

View File

@ -1693,7 +1693,7 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) {
if (sensorTemp < htrCtx.tempLimit.opLowerLimit and heaterCtrlAllowed()) {
sif::info << "TCS: Heater " << static_cast<int>(htrCtx.switchNr) << " for component "
<< static_cast<int>(currThermalComponent) << " ON" << std::endl;
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::ON, thermalComponent);
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::ON, currThermalComponent);
} else {
// Even if heater control is now allowed, we can update the state.
thermalStates[currThermalComponent].heating = false;
@ -1790,6 +1790,8 @@ void ThermalController::heaterMaxDurationControl(const HeaterSwitchStates& curre
// The heater might still be one for some thermal components, so cross-check
// those components
crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i));
} else if (currentHeaterStates[i] == HeaterHandler::SwitchState::OFF) {
heaterStates[i].heaterOnPeriod.resetTimer();
}
}
}
@ -1841,8 +1843,8 @@ void ThermalController::heaterSwitchHelper(heater::Switch switchNr,
unsigned componentIdx) {
timeval currentTime;
Clock::getClockMonotonic(&currentTime);
if (state == HeaterHandler::SwitchState::ON) {
heaterHandler.switchHeater(switchNr, state);
if (targetState == HeaterHandler::SwitchState::ON) {
heaterHandler.switchHeater(switchNr, targetState);
heaterStates[switchNr].target = HeaterHandler::SwitchState::ON;
heaterStates[switchNr].switchTransition = true;
thermalStates[componentIdx].sensorIndex = currentSensorIndex;
@ -1852,7 +1854,7 @@ void ThermalController::heaterSwitchHelper(heater::Switch switchNr,
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_ON, static_cast<uint32_t>(currThermalComponent),
static_cast<uint32_t>(switchNr));
} else {
heaterHandler.switchHeater(switchNr, state);
heaterHandler.switchHeater(switchNr, targetState);
thermalStates[componentIdx].heating = false;
thermalStates[componentIdx].heaterEndTime = currentTime.tv_sec;
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_OFF, static_cast<uint32_t>(currThermalComponent),