From ff7d0b3989d5cc0014bbcaa549227625ae035b10 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 7 Jul 2023 11:57:00 +0200 Subject: [PATCH] compile fixes --- mission/controller/ThermalController.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index f0cf3bd2..be88b760 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1693,7 +1693,7 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) { if (sensorTemp < htrCtx.tempLimit.opLowerLimit and heaterCtrlAllowed()) { sif::info << "TCS: Heater " << static_cast(htrCtx.switchNr) << " for component " << static_cast(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(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(¤tTime); - 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(currThermalComponent), static_cast(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(currThermalComponent),