heater events for TCS ctrl
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...

This commit is contained in:
Robin Müller 2023-07-06 18:58:57 +02:00
parent ee4285075a
commit 3c9eec7b3f
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
4 changed files with 57 additions and 48 deletions

View File

@ -1008,7 +1008,7 @@ void ThermalController::ctrlAcsBoard() {
heater::Switch redSwitchNr = heater::HEATER_3_OBC_BRD; heater::Switch redSwitchNr = heater::HEATER_3_OBC_BRD;
// A side // A side
thermalComponent = ACS_BOARD; currThermalComponent = ACS_BOARD;
sensors[0].first = deviceTemperatures.gyro0SideA.isValid(); sensors[0].first = deviceTemperatures.gyro0SideA.isValid();
sensors[0].second = deviceTemperatures.gyro0SideA.value; sensors[0].second = deviceTemperatures.gyro0SideA.value;
sensors[1].first = deviceTemperatures.gyro2SideB.isValid(); sensors[1].first = deviceTemperatures.gyro2SideB.isValid();
@ -1052,7 +1052,7 @@ void ThermalController::ctrlAcsBoard() {
if (chooseHeater(switchNr, redSwitchNr)) { if (chooseHeater(switchNr, redSwitchNr)) {
if (heaterHandler.getSwitchState(switchNr)) { if (heaterHandler.getSwitchState(switchNr)) {
if (submode != SUBMODE_NO_HEATER_CTRL) { if (submode != SUBMODE_NO_HEATER_CTRL) {
heaterSwitchHelper(switchNr, HeaterHandler::SwitchState::OFF, thermalComponent); heaterSwitchHelper(switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
} }
} }
} }
@ -1062,7 +1062,7 @@ void ThermalController::ctrlAcsBoard() {
} }
void ThermalController::ctrlMgt() { void ThermalController::ctrlMgt() {
thermalComponent = MGT; currThermalComponent = MGT;
sensors[0].first = sensorTemperatures.mgt.isValid(); sensors[0].first = sensorTemperatures.mgt.isValid();
sensors[0].second = sensorTemperatures.mgt.value; sensors[0].second = sensorTemperatures.mgt.value;
sensors[1].first = deviceTemperatures.mgt.isValid(); sensors[1].first = deviceTemperatures.mgt.isValid();
@ -1087,7 +1087,7 @@ void ThermalController::ctrlRw() {
std::array<uint32_t, 4> sensorTemps{}; std::array<uint32_t, 4> sensorTemps{};
// RW1 // RW1
thermalComponent = RW; currThermalComponent = RW;
sensors[0].first = sensorTemperatures.rw1.isValid(); sensors[0].first = sensorTemperatures.rw1.isValid();
sensors[0].second = sensorTemperatures.rw1.value; sensors[0].second = sensorTemperatures.rw1.value;
sensors[1].first = deviceTemperatures.rw1.isValid(); sensors[1].first = deviceTemperatures.rw1.isValid();
@ -1108,7 +1108,7 @@ void ThermalController::ctrlRw() {
} }
// RW2 // RW2
thermalComponent = RW; currThermalComponent = RW;
sensors[0].first = deviceTemperatures.rw2.isValid(); sensors[0].first = deviceTemperatures.rw2.isValid();
sensors[0].second = deviceTemperatures.rw2.value; sensors[0].second = deviceTemperatures.rw2.value;
sensors[1].first = deviceTemperatures.rw3.isValid(); sensors[1].first = deviceTemperatures.rw3.isValid();
@ -1130,7 +1130,7 @@ void ThermalController::ctrlRw() {
} }
} }
// RW3 // RW3
thermalComponent = RW; currThermalComponent = RW;
sensors[0].first = deviceTemperatures.rw3.isValid(); sensors[0].first = deviceTemperatures.rw3.isValid();
sensors[0].second = deviceTemperatures.rw3.value; sensors[0].second = deviceTemperatures.rw3.value;
sensors[1].first = deviceTemperatures.rw4.isValid(); sensors[1].first = deviceTemperatures.rw4.isValid();
@ -1153,7 +1153,7 @@ void ThermalController::ctrlRw() {
} }
// RW4 // RW4
thermalComponent = RW; currThermalComponent = RW;
sensors[0].first = deviceTemperatures.rw4.isValid(); sensors[0].first = deviceTemperatures.rw4.isValid();
sensors[0].second = deviceTemperatures.rw4.value; sensors[0].second = deviceTemperatures.rw4.value;
sensors[1].first = deviceTemperatures.rw1.isValid(); sensors[1].first = deviceTemperatures.rw1.isValid();
@ -1187,7 +1187,7 @@ void ThermalController::ctrlRw() {
} }
void ThermalController::ctrlStr() { void ThermalController::ctrlStr() {
thermalComponent = STR; currThermalComponent = STR;
sensors[0].first = sensorTemperatures.startracker.isValid(); sensors[0].first = sensorTemperatures.startracker.isValid();
sensors[0].second = sensorTemperatures.startracker.value; sensors[0].second = sensorTemperatures.startracker.value;
sensors[1].first = deviceTemperatures.startracker.isValid(); sensors[1].first = deviceTemperatures.startracker.isValid();
@ -1201,7 +1201,7 @@ void ThermalController::ctrlStr() {
} }
void ThermalController::ctrlIfBoard() { void ThermalController::ctrlIfBoard() {
thermalComponent = IF_BOARD; currThermalComponent = IF_BOARD;
sensors[0].first = sensorTemperatures.tmp1075IfBrd.isValid(); sensors[0].first = sensorTemperatures.tmp1075IfBrd.isValid();
sensors[0].second = sensorTemperatures.tmp1075IfBrd.value; sensors[0].second = sensorTemperatures.tmp1075IfBrd.value;
sensors[1].first = sensorTemperatures.mgt.isValid(); sensors[1].first = sensorTemperatures.mgt.isValid();
@ -1215,7 +1215,7 @@ void ThermalController::ctrlIfBoard() {
} }
void ThermalController::ctrlTcsBoard() { void ThermalController::ctrlTcsBoard() {
thermalComponent = TCS_BOARD; currThermalComponent = TCS_BOARD;
sensors[0].first = sensorTemperatures.tcsBoard.isValid(); sensors[0].first = sensorTemperatures.tcsBoard.isValid();
sensors[0].second = sensorTemperatures.tcsBoard.value; sensors[0].second = sensorTemperatures.tcsBoard.value;
sensors[1].first = sensorTemperatures.tmp1075Tcs0.isValid(); sensors[1].first = sensorTemperatures.tmp1075Tcs0.isValid();
@ -1229,7 +1229,7 @@ void ThermalController::ctrlTcsBoard() {
} }
void ThermalController::ctrlObc() { void ThermalController::ctrlObc() {
thermalComponent = OBC; currThermalComponent = OBC;
sensors[0].first = deviceTemperatures.q7s.isValid(); sensors[0].first = deviceTemperatures.q7s.isValid();
sensors[0].second = deviceTemperatures.q7s.value; sensors[0].second = deviceTemperatures.q7s.value;
sensors[1].first = sensorTemperatures.tmp1075Tcs1.isValid(); sensors[1].first = sensorTemperatures.tmp1075Tcs1.isValid();
@ -1248,7 +1248,7 @@ void ThermalController::ctrlObc() {
} }
void ThermalController::ctrlObcIfBoard() { void ThermalController::ctrlObcIfBoard() {
thermalComponent = OBCIF_BOARD; currThermalComponent = OBCIF_BOARD;
sensors[0].first = deviceTemperatures.q7s.isValid(); sensors[0].first = deviceTemperatures.q7s.isValid();
sensors[0].second = deviceTemperatures.q7s.value; sensors[0].second = deviceTemperatures.q7s.value;
sensors[1].first = sensorTemperatures.tmp1075Tcs0.isValid(); sensors[1].first = sensorTemperatures.tmp1075Tcs0.isValid();
@ -1267,7 +1267,7 @@ void ThermalController::ctrlObcIfBoard() {
} }
void ThermalController::ctrlSBandTransceiver() { void ThermalController::ctrlSBandTransceiver() {
thermalComponent = SBAND_TRANSCEIVER; currThermalComponent = SBAND_TRANSCEIVER;
sensors[0].first = deviceTemperatures.syrlinksPowerAmplifier.isValid(); sensors[0].first = deviceTemperatures.syrlinksPowerAmplifier.isValid();
sensors[0].second = deviceTemperatures.syrlinksPowerAmplifier.value; sensors[0].second = deviceTemperatures.syrlinksPowerAmplifier.value;
sensors[1].first = deviceTemperatures.syrlinksBasebandBoard.isValid(); sensors[1].first = deviceTemperatures.syrlinksBasebandBoard.isValid();
@ -1285,7 +1285,7 @@ void ThermalController::ctrlSBandTransceiver() {
} }
} }
void ThermalController::ctrlPcduP60Board() { void ThermalController::ctrlPcduP60Board() {
thermalComponent = PCDUP60_BOARD; currThermalComponent = PCDUP60_BOARD;
sensors[0].first = deviceTemperatures.temp1P60dock.isValid(); sensors[0].first = deviceTemperatures.temp1P60dock.isValid();
sensors[0].second = deviceTemperatures.temp1P60dock.value; sensors[0].second = deviceTemperatures.temp1P60dock.value;
sensors[1].first = deviceTemperatures.temp2P60dock.isValid(); sensors[1].first = deviceTemperatures.temp2P60dock.isValid();
@ -1302,7 +1302,7 @@ void ThermalController::ctrlPcduP60Board() {
} }
void ThermalController::ctrlPcduAcu() { void ThermalController::ctrlPcduAcu() {
thermalComponent = PCDUACU; currThermalComponent = PCDUACU;
heater::Switch switchNr = heater::HEATER_1_PCDU_PDU; heater::Switch switchNr = heater::HEATER_1_PCDU_PDU;
heater::Switch redSwitchNr = heater::HEATER_2_ACS_BRD; heater::Switch redSwitchNr = heater::HEATER_2_ACS_BRD;
@ -1318,7 +1318,7 @@ void ThermalController::ctrlPcduAcu() {
} else if (sensorTemperatures.acu.isValid()) { } else if (sensorTemperatures.acu.isValid()) {
sensorTemp = sensorTemperatures.acu.value; sensorTemp = sensorTemperatures.acu.value;
} else { } else {
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, thermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent);
sensorTempAvailable = false; sensorTempAvailable = false;
} }
if (sensorTempAvailable) { if (sensorTempAvailable) {
@ -1335,7 +1335,7 @@ void ThermalController::ctrlPcduAcu() {
} }
void ThermalController::ctrlPcduPdu() { void ThermalController::ctrlPcduPdu() {
thermalComponent = PCDUPDU; currThermalComponent = PCDUPDU;
sensors[0].first = deviceTemperatures.pdu1.isValid(); sensors[0].first = deviceTemperatures.pdu1.isValid();
sensors[0].second = deviceTemperatures.pdu1.value; sensors[0].second = deviceTemperatures.pdu1.value;
sensors[1].first = deviceTemperatures.pdu2.isValid(); sensors[1].first = deviceTemperatures.pdu2.isValid();
@ -1354,7 +1354,7 @@ void ThermalController::ctrlPcduPdu() {
} }
void ThermalController::ctrlPlPcduBoard() { void ThermalController::ctrlPlPcduBoard() {
thermalComponent = PLPCDU_BOARD; currThermalComponent = PLPCDU_BOARD;
sensors[0].first = sensorTemperatures.tmp1075PlPcdu0.isValid(); sensors[0].first = sensorTemperatures.tmp1075PlPcdu0.isValid();
sensors[0].second = sensorTemperatures.tmp1075PlPcdu0.value; sensors[0].second = sensorTemperatures.tmp1075PlPcdu0.value;
sensors[1].first = sensorTemperatures.tmp1075PlPcdu1.isValid(); sensors[1].first = sensorTemperatures.tmp1075PlPcdu1.isValid();
@ -1370,7 +1370,7 @@ void ThermalController::ctrlPlPcduBoard() {
} }
void ThermalController::ctrlPlocMissionBoard() { void ThermalController::ctrlPlocMissionBoard() {
thermalComponent = PLOCMISSION_BOARD; currThermalComponent = PLOCMISSION_BOARD;
sensors[0].first = sensorTemperatures.plocHeatspreader.isValid(); sensors[0].first = sensorTemperatures.plocHeatspreader.isValid();
sensors[0].second = sensorTemperatures.plocHeatspreader.value; sensors[0].second = sensorTemperatures.plocHeatspreader.value;
sensors[1].first = sensorTemperatures.plocMissionboard.isValid(); sensors[1].first = sensorTemperatures.plocMissionboard.isValid();
@ -1385,7 +1385,7 @@ void ThermalController::ctrlPlocMissionBoard() {
} }
void ThermalController::ctrlPlocProcessingBoard() { void ThermalController::ctrlPlocProcessingBoard() {
thermalComponent = PLOCPROCESSING_BOARD; currThermalComponent = PLOCPROCESSING_BOARD;
sensors[0].first = sensorTemperatures.plocMissionboard.isValid(); sensors[0].first = sensorTemperatures.plocMissionboard.isValid();
sensors[0].second = sensorTemperatures.plocMissionboard.value; sensors[0].second = sensorTemperatures.plocMissionboard.value;
sensors[1].first = sensorTemperatures.plocHeatspreader.isValid(); sensors[1].first = sensorTemperatures.plocHeatspreader.isValid();
@ -1400,7 +1400,7 @@ void ThermalController::ctrlPlocProcessingBoard() {
} }
void ThermalController::ctrlDac() { void ThermalController::ctrlDac() {
thermalComponent = DAC; currThermalComponent = DAC;
sensors[0].first = sensorTemperatures.dacHeatspreader.isValid(); sensors[0].first = sensorTemperatures.dacHeatspreader.isValid();
sensors[0].second = sensorTemperatures.dacHeatspreader.value; sensors[0].second = sensorTemperatures.dacHeatspreader.value;
sensors[1].first = sensorTemperatures.plocMissionboard.isValid(); sensors[1].first = sensorTemperatures.plocMissionboard.isValid();
@ -1414,7 +1414,7 @@ void ThermalController::ctrlDac() {
} }
void ThermalController::ctrlCameraBody() { void ThermalController::ctrlCameraBody() {
thermalComponent = CAMERA; currThermalComponent = CAMERA;
sensors[0].first = sensorTemperatures.payload4kCamera.isValid(); sensors[0].first = sensorTemperatures.payload4kCamera.isValid();
sensors[0].second = sensorTemperatures.payload4kCamera.value; sensors[0].second = sensorTemperatures.payload4kCamera.value;
sensors[1].first = sensorTemperatures.dro.isValid(); sensors[1].first = sensorTemperatures.dro.isValid();
@ -1440,7 +1440,7 @@ void ThermalController::ctrlCameraBody() {
} }
void ThermalController::ctrlDro() { void ThermalController::ctrlDro() {
thermalComponent = DRO; currThermalComponent = DRO;
sensors[0].first = sensorTemperatures.dro.isValid(); sensors[0].first = sensorTemperatures.dro.isValid();
sensors[0].second = sensorTemperatures.dro.value; sensors[0].second = sensorTemperatures.dro.value;
sensors[1].first = sensorTemperatures.payload4kCamera.isValid(); sensors[1].first = sensorTemperatures.payload4kCamera.isValid();
@ -1454,7 +1454,7 @@ void ThermalController::ctrlDro() {
} }
void ThermalController::ctrlX8() { void ThermalController::ctrlX8() {
thermalComponent = X8; currThermalComponent = X8;
sensors[0].first = sensorTemperatures.x8.isValid(); sensors[0].first = sensorTemperatures.x8.isValid();
sensors[0].second = sensorTemperatures.x8.value; sensors[0].second = sensorTemperatures.x8.value;
sensors[1].first = sensorTemperatures.hpa.isValid(); sensors[1].first = sensorTemperatures.hpa.isValid();
@ -1468,7 +1468,7 @@ void ThermalController::ctrlX8() {
} }
void ThermalController::ctrlTx() { void ThermalController::ctrlTx() {
thermalComponent = TX; currThermalComponent = TX;
sensors[0].first = sensorTemperatures.eBandTx.isValid(); sensors[0].first = sensorTemperatures.eBandTx.isValid();
sensors[0].second = sensorTemperatures.eBandTx.value; sensors[0].second = sensorTemperatures.eBandTx.value;
sensors[1].first = sensorTemperatures.x8.isValid(); sensors[1].first = sensorTemperatures.x8.isValid();
@ -1482,7 +1482,7 @@ void ThermalController::ctrlTx() {
} }
void ThermalController::ctrlMpa() { void ThermalController::ctrlMpa() {
thermalComponent = MPA; currThermalComponent = MPA;
sensors[0].first = sensorTemperatures.mpa.isValid(); sensors[0].first = sensorTemperatures.mpa.isValid();
sensors[0].second = sensorTemperatures.mpa.value; sensors[0].second = sensorTemperatures.mpa.value;
sensors[1].first = sensorTemperatures.hpa.isValid(); sensors[1].first = sensorTemperatures.hpa.isValid();
@ -1496,7 +1496,7 @@ void ThermalController::ctrlMpa() {
} }
void ThermalController::ctrlHpa() { void ThermalController::ctrlHpa() {
thermalComponent = HPA; currThermalComponent = HPA;
sensors[0].first = sensorTemperatures.hpa.isValid(); sensors[0].first = sensorTemperatures.hpa.isValid();
sensors[0].second = sensorTemperatures.hpa.value; sensors[0].second = sensorTemperatures.hpa.value;
sensors[1].first = sensorTemperatures.x8.isValid(); sensors[1].first = sensorTemperatures.x8.isValid();
@ -1510,7 +1510,7 @@ void ThermalController::ctrlHpa() {
} }
void ThermalController::ctrlScexBoard() { void ThermalController::ctrlScexBoard() {
thermalComponent = SCEX_BOARD; currThermalComponent = SCEX_BOARD;
sensors[0].first = sensorTemperatures.scex.isValid(); sensors[0].first = sensorTemperatures.scex.isValid();
sensors[0].second = sensorTemperatures.scex.value; sensors[0].second = sensorTemperatures.scex.value;
sensors[1].first = sensorTemperatures.x8.isValid(); sensors[1].first = sensorTemperatures.x8.isValid();
@ -1601,7 +1601,7 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) { if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
if (heaterCtrlAllowed() and if (heaterCtrlAllowed() and
(heaterHandler.getSwitchState(htrCtx.switchNr) == HeaterHandler::SwitchState::ON)) { (heaterHandler.getSwitchState(htrCtx.switchNr) == HeaterHandler::SwitchState::ON)) {
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, thermalComponent); heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
} }
} }
} }
@ -1613,19 +1613,19 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
sensors[i].second > SANITY_LIMIT_LOWER_TEMP and sensors[i].second > SANITY_LIMIT_LOWER_TEMP and
sensors[i].second < SANITY_LIMIT_UPPER_TEMP) { sensors[i].second < SANITY_LIMIT_UPPER_TEMP) {
sensorTemp = sensors[i].second; sensorTemp = sensors[i].second;
thermalStates[thermalComponent].errorCounter = 0; thermalStates[currThermalComponent].errorCounter = 0;
return true; return true;
} }
} }
thermalStates[thermalComponent].errorCounter++; thermalStates[currThermalComponent].errorCounter++;
if (thermalComponent != RW and thermalComponent != ACS_BOARD) { if (currThermalComponent != RW and currThermalComponent != ACS_BOARD) {
if (thermalStates[thermalComponent].errorCounter <= 3) { if (thermalStates[currThermalComponent].errorCounter <= 3) {
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, thermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent);
} }
} else { } else {
if (thermalStates[thermalComponent].errorCounter <= 8) { if (thermalStates[currThermalComponent].errorCounter <= 8) {
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, thermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent);
} }
} }
@ -1658,14 +1658,14 @@ void ThermalController::heaterCtrlTempTooHighHandler(HeaterContext& htrCtx, cons
return; return;
} }
if (htrCtx.switchState == HeaterHandler::SwitchState::ON) { if (htrCtx.switchState == HeaterHandler::SwitchState::ON) {
sif::info << "TCS: Component " << static_cast<int>(thermalComponent) << " too warm, above " sif::info << "TCS: Component " << static_cast<int>(currThermalComponent) << " too warm, above "
<< whatLimit << ", switching off heater" << std::endl; << whatLimit << ", switching off heater" << std::endl;
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, thermalComponent); 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;
} }
if (heaterHandler.getSwitchState(htrCtx.redSwitchNr) == HeaterHandler::SwitchState::ON) { if (heaterHandler.getSwitchState(htrCtx.redSwitchNr) == HeaterHandler::SwitchState::ON) {
heaterSwitchHelper(htrCtx.redSwitchNr, HeaterHandler::SwitchState::OFF, thermalComponent); heaterSwitchHelper(htrCtx.redSwitchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
heaterStates[htrCtx.redSwitchNr].switchTransition = true; heaterStates[htrCtx.redSwitchNr].switchTransition = true;
heaterStates[htrCtx.redSwitchNr].target = HeaterHandler::SwitchState::OFF; heaterStates[htrCtx.redSwitchNr].target = HeaterHandler::SwitchState::OFF;
} }
@ -1687,13 +1687,13 @@ 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>(thermalComponent) << " ON" << std::endl; sif::info << "TCS: Heater " << static_cast<int>(currThermalComponent) << " ON" << std::endl;
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::ON, thermalComponent); 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;
} else { } else {
// Even if heater control is now allowed, we can update the state. // Even if heater control is now allowed, we can update the state.
thermalStates[thermalComponent].heating = false; thermalStates[currThermalComponent].heating = false;
} }
heaterCtrlCheckUpperLimits(htrCtx); heaterCtrlCheckUpperLimits(htrCtx);
return; return;
@ -1701,11 +1701,12 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) {
// Heater on // Heater on
if (htrCtx.switchState == HeaterHandler::SwitchState::ON) { if (htrCtx.switchState == HeaterHandler::SwitchState::ON) {
if (thermalStates[thermalComponent].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>(thermalComponent) << " OFF" << std::endl; sif::info << "TCS: Heater " << static_cast<int>(currThermalComponent) << " OFF"
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, thermalComponent); << std::endl;
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;
} }
@ -1747,7 +1748,7 @@ void ThermalController::resetSensorsArray() {
validValuePair.first = false; validValuePair.first = false;
validValuePair.second = INVALID_TEMPERATURE; validValuePair.second = INVALID_TEMPERATURE;
} }
thermalComponent = NONE; currThermalComponent = NONE;
} }
void ThermalController::heaterTransitionControl(const HeaterSwitchStates& currentHeaterStates) { void ThermalController::heaterTransitionControl(const HeaterSwitchStates& currentHeaterStates) {
@ -1809,10 +1810,14 @@ void ThermalController::heaterSwitchHelper(heater::Switch switchNr,
Clock::getClockMonotonic(&currentTime); Clock::getClockMonotonic(&currentTime);
if (state == HeaterHandler::SwitchState::ON) { if (state == HeaterHandler::SwitchState::ON) {
heaterHandler.switchHeater(switchNr, state); heaterHandler.switchHeater(switchNr, state);
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_ON, static_cast<uint32_t>(currThermalComponent),
static_cast<uint32_t>(switchNr));
thermalStates[componentIdx].heating = true; thermalStates[componentIdx].heating = true;
thermalStates[componentIdx].heaterStartTime = currentTime.tv_sec; thermalStates[componentIdx].heaterStartTime = currentTime.tv_sec;
} else { } else {
heaterHandler.switchHeater(switchNr, state); heaterHandler.switchHeater(switchNr, state);
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_OFF, static_cast<uint32_t>(currThermalComponent),
static_cast<uint32_t>(switchNr));
thermalStates[componentIdx].heating = false; thermalStates[componentIdx].heating = false;
thermalStates[componentIdx].heaterEndTime = currentTime.tv_sec; thermalStates[componentIdx].heaterEndTime = currentTime.tv_sec;
} }

View File

@ -256,7 +256,7 @@ class ThermalController : public ExtendedControllerBase {
TempLimits scexBoardLimits = TempLimits(-60.0, -40.0, 80.0, 85.0, 150.0); TempLimits scexBoardLimits = TempLimits(-60.0, -40.0, 80.0, 85.0, 150.0);
double sensorTemp = INVALID_TEMPERATURE; double sensorTemp = INVALID_TEMPERATURE;
ThermalComponents thermalComponent = NONE; ThermalComponents currThermalComponent = NONE;
bool redSwitchNrInUse = false; bool redSwitchNrInUse = false;
MessageQueueId_t camId = MessageQueueIF::NO_QUEUE; MessageQueueId_t camId = MessageQueueIF::NO_QUEUE;
bool componentAboveCutOffLimit = false; bool componentAboveCutOffLimit = false;

View File

@ -18,6 +18,10 @@ static constexpr Event CAMERA_OVERHEATING = MAKE_EVENT(5, severity::HIGH);
static constexpr Event PCDU_SYSTEM_OVERHEATING = MAKE_EVENT(6, severity::HIGH); static constexpr Event PCDU_SYSTEM_OVERHEATING = MAKE_EVENT(6, severity::HIGH);
static constexpr Event HEATER_NOT_OFF_FOR_OFF_MODE = MAKE_EVENT(7, severity::MEDIUM); static constexpr Event HEATER_NOT_OFF_FOR_OFF_MODE = MAKE_EVENT(7, severity::MEDIUM);
static constexpr Event MGT_OVERHEATING = MAKE_EVENT(8, severity::HIGH); static constexpr Event MGT_OVERHEATING = MAKE_EVENT(8, severity::HIGH);
//! [EXPORT] : [COMMENT] P1: Module index. P2: Heater index
static constexpr Event TCS_SWITCHING_HEATER_ON = MAKE_EVENT(9, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Module index. P2: Heater index
static constexpr Event TCS_SWITCHING_HEATER_OFF = MAKE_EVENT(10, severity::INFO);
enum SetId : uint32_t { enum SetId : uint32_t {
SENSOR_TEMPERATURES = 0, SENSOR_TEMPERATURES = 0,

2
tmtc

@ -1 +1 @@
Subproject commit c48f04eed5152f319b217870292968fb67b763d4 Subproject commit 6d5bde40db69534a8cea923f96145bdeb62b79af