TCS improvements
This commit is contained in:
@ -1247,25 +1247,6 @@ void ThermalController::ctrlObc() {
|
||||
}
|
||||
}
|
||||
|
||||
void ThermalController::ctrlObcIfBoard() {
|
||||
currThermalComponent = OBCIF_BOARD;
|
||||
sensors[0].first = deviceTemperatures.q7s.isValid();
|
||||
sensors[0].second = deviceTemperatures.q7s.value;
|
||||
sensors[1].first = sensorTemperatures.tmp1075Tcs0.isValid();
|
||||
sensors[1].second = sensorTemperatures.tmp1075Tcs0.value;
|
||||
sensors[2].first = sensorTemperatures.tmp1075Tcs1.isValid();
|
||||
sensors[2].second = sensorTemperatures.tmp1075Tcs1.value;
|
||||
numSensors = 3;
|
||||
HeaterContext htrCtx(heater::HEATER_3_OBC_BRD, heater::HEATER_2_ACS_BRD, obcIfBoardLimits);
|
||||
ctrlComponentTemperature(htrCtx);
|
||||
if (componentAboveUpperLimit and not obcTooHotFlag) {
|
||||
triggerEvent(tcsCtrl::OBC_OVERHEATING, tempFloatToU32());
|
||||
obcTooHotFlag = true;
|
||||
} else if (not componentAboveUpperLimit) {
|
||||
obcTooHotFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ThermalController::ctrlSBandTransceiver() {
|
||||
currThermalComponent = SBAND_TRANSCEIVER;
|
||||
sensors[0].first = deviceTemperatures.syrlinksPowerAmplifier.isValid();
|
||||
@ -1531,7 +1512,6 @@ void ThermalController::performThermalModuleCtrl(const HeaterSwitchStates& heate
|
||||
ctrlIfBoard();
|
||||
ctrlTcsBoard();
|
||||
ctrlObc();
|
||||
ctrlObcIfBoard();
|
||||
ctrlSBandTransceiver();
|
||||
ctrlPcduP60Board();
|
||||
ctrlPcduAcu();
|
||||
@ -1599,9 +1579,11 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
|
||||
// No sensors available, so switch the heater off. We can not perform control tasks if we
|
||||
// are blind..
|
||||
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
|
||||
if (heaterCtrlAllowed()) {
|
||||
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
|
||||
}
|
||||
// Also track the counter to prevent heater handler message spam. The heater handle can only
|
||||
// process 2 messages per cycle.
|
||||
if (heaterCtrlAllowed() and (thermalStates[currThermalComponent].noSensorAvailableCounter < 3)) {
|
||||
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
resetSensorsArray();
|
||||
@ -1612,18 +1594,18 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
|
||||
sensors[i].second > SANITY_LIMIT_LOWER_TEMP and
|
||||
sensors[i].second < SANITY_LIMIT_UPPER_TEMP) {
|
||||
sensorTemp = sensors[i].second;
|
||||
thermalStates[currThermalComponent].errorCounter = 0;
|
||||
thermalStates[currThermalComponent].noSensorAvailableCounter = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
thermalStates[currThermalComponent].errorCounter++;
|
||||
thermalStates[currThermalComponent].noSensorAvailableCounter++;
|
||||
if (currThermalComponent != RW and currThermalComponent != ACS_BOARD) {
|
||||
if (thermalStates[currThermalComponent].errorCounter <= 3) {
|
||||
if (thermalStates[currThermalComponent].noSensorAvailableCounter <= 3) {
|
||||
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent);
|
||||
}
|
||||
} else {
|
||||
if (thermalStates[currThermalComponent].errorCounter <= 8) {
|
||||
if (thermalStates[currThermalComponent].noSensorAvailableCounter <= 8) {
|
||||
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user