diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index d11eda72..b05b3a07 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1059,9 +1059,31 @@ void ThermalController::ctrlPcduP60Board() { } void ThermalController::ctrlPcduAcu() { - // TODO: check sensors (float,3) - // ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, - // deviceTemperatures.acu, deviceTemperatures.acu, sensorTemperatures.sensor_acu, &pcduAcuLimits); + heater::Switchers switchNr = heater::HEATER_3_PCDU_PDU; + heater::Switchers redSwitchNr = heater::HEATER_2_ACS_BRD; + + chooseHeater(switchNr, redSwitchNr); + + if (heaterAvailable) { + sensorTempAvailable = true; + + if (deviceTemperatures.acu.isValid()) { // TODO: how to check the different values + sensorTemp = deviceTemperatures.acu.value[0]; // TODO: check if right + } else if (deviceTemperatures.acu.isValid()) { + sensorTemp = deviceTemperatures.acu.value[1]; + } else if (sensorTemperatures.sensor_acu.isValid()) { + sensorTemp = sensorTemperatures.sensor_acu.value; + } else { + if (heaterHandler.checkSwitchState(switchNr)) { + heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); + } + triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr); + sensorTempAvailable = false; + if (sensorTempAvailable) { + ctrlHeater(switchNr, redSwitchNr, &pcduAcuLimits); + } + } + } } void ThermalController::ctrlPcduPdu() { @@ -1072,10 +1094,33 @@ void ThermalController::ctrlPcduPdu() { } void ThermalController::ctrlPlPcduBoard() { - // TODO: add sensor 4: sensorTemperatures.sensor_plpcdu_heatspreader - ctrlComponentTemperature(heater::HEATER_3_PCDU_PDU, heater::HEATER_2_ACS_BRD, - sensorTemperatures.tmp1075PlPcdu0, sensorTemperatures.tmp1075PlPcdu1, - deviceTemperatures.adcPayloadPcdu, &plPcduBoardLimits); + heater::Switchers switchNr = heater::HEATER_3_PCDU_PDU; + heater::Switchers redSwitchNr = heater::HEATER_2_ACS_BRD; + + chooseHeater(switchNr, redSwitchNr); + + if (heaterAvailable) { + sensorTempAvailable = true; + + if (sensorTemperatures.tmp1075PlPcdu0.isValid()) { + sensorTemp = sensorTemperatures.tmp1075PlPcdu0.value; + } else if (sensorTemperatures.tmp1075PlPcdu1.isValid()) { + sensorTemp = sensorTemperatures.tmp1075PlPcdu1.value; + } else if (deviceTemperatures.adcPayloadPcdu.isValid()) { + sensorTemp = deviceTemperatures.adcPayloadPcdu.value; + } else if (sensorTemperatures.sensor_plpcdu_heatspreader.isValid()) { + sensorTemp = sensorTemperatures.sensor_plpcdu_heatspreader.value; + } else { + if (heaterHandler.checkSwitchState(switchNr)) { + heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF); + } + triggerEvent(NO_VALID_SENSOR_TEMPERATURE, switchNr); + sensorTempAvailable = false; + if (sensorTempAvailable) { + ctrlHeater(switchNr, redSwitchNr, &plPcduBoardLimits); + } + } + } } void ThermalController::ctrlPlocMissionBoard() {