Merge remote-tracking branch 'origin/main' into tcs-heater-upper-limit
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Robin Müller 2023-07-11 09:45:01 +02:00
commit 8800b20409
Signed by: muellerr
GPG Key ID: A649FB78196E3849
4 changed files with 23 additions and 31 deletions

View File

@ -18,6 +18,8 @@ will consitute of a breaking change warranting a new major release:
## Changed ## Changed
- TCS: Remove OBC IF board thermal module, which is exactly identical to OBC module and therefore
obsolete.
- Swapped PL and PS I2C, BPX battery and MGT are connected to PS I2C now for firmware versions - Swapped PL and PS I2C, BPX battery and MGT are connected to PS I2C now for firmware versions
equal or above v4. However, this software version is compatible to both v3 and v4 of the firmware. equal or above v4. However, this software version is compatible to both v3 and v4 of the firmware.
- The firmware version variables are global statics inititalized early during the program - The firmware version variables are global statics inititalized early during the program
@ -26,6 +28,7 @@ will consitute of a breaking change warranting a new major release:
components (no sensors available), irrespective of current switch state. components (no sensors available), irrespective of current switch state.
- Make OBSW compatible to prospective FW version v5.0.0, where the Q7 I2C devices were - Make OBSW compatible to prospective FW version v5.0.0, where the Q7 I2C devices were
moved to a PL I2C block and the TMP sensor devices were moved to the PS I2C0. moved to a PL I2C block and the TMP sensor devices were moved to the PS I2C0.
- Made `Xadc` code a little bit more robust against errors.
## Fixed ## Fixed
@ -40,6 +43,8 @@ will consitute of a breaking change warranting a new major release:
- TMP1075: Devices did not go to OFF mode when being set faulty. - TMP1075: Devices did not go to OFF mode when being set faulty.
- Update PL PCDU 1 in TCS mode tree on the EM. - Update PL PCDU 1 in TCS mode tree on the EM.
- TMP1075: Possibly ignored health commands. - TMP1075: Possibly ignored health commands.
- TCS CTRL: Limit number of heater handler messages sent in case there are not sensors available
anymore.
# Added # Added

View File

@ -129,7 +129,7 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl; sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
} }
char valstring[MAX_STR_LENGTH] = ""; char valstring[MAX_STR_LENGTH]{};
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp); char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
if (returnVal == nullptr) { if (returnVal == nullptr) {
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
@ -139,6 +139,11 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
} }
std::istringstream valSstream(valstring); std::istringstream valSstream(valstring);
valSstream >> val; valSstream >> val;
if(valSstream.bad()) {
sif::warning << "Xadc: Conversion of value to target type failed" << std::endl;
fclose(fp);
return returnvalue::FAILED;
}
fclose(fp); fclose(fp);
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -1251,25 +1251,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() { void ThermalController::ctrlSBandTransceiver() {
currThermalComponent = SBAND_TRANSCEIVER; currThermalComponent = SBAND_TRANSCEIVER;
sensors[0].first = deviceTemperatures.syrlinksPowerAmplifier.isValid(); sensors[0].first = deviceTemperatures.syrlinksPowerAmplifier.isValid();
@ -1535,7 +1516,6 @@ void ThermalController::performThermalModuleCtrl(const HeaterSwitchStates& heate
ctrlIfBoard(); ctrlIfBoard();
ctrlTcsBoard(); ctrlTcsBoard();
ctrlObc(); ctrlObc();
ctrlObcIfBoard();
ctrlSBandTransceiver(); ctrlSBandTransceiver();
ctrlPcduP60Board(); ctrlPcduP60Board();
ctrlPcduAcu(); ctrlPcduAcu();
@ -1602,9 +1582,11 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
// No sensors available, so switch the heater off. We can not perform control tasks if we // No sensors available, so switch the heater off. We can not perform control tasks if we
// are blind.. // are blind..
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) { if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
if (heaterCtrlAllowed()) { // Also track the counter to prevent heater handler message spam. The heater handle can only
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent); // process 2 messages per cycle.
} if (heaterCtrlAllowed() and (thermalStates[currThermalComponent].noSensorAvailableCounter < 3)) {
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
}
} }
} }
resetSensorsArray(); resetSensorsArray();
@ -1616,18 +1598,18 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
sensors[i].second < SANITY_LIMIT_UPPER_TEMP) { sensors[i].second < SANITY_LIMIT_UPPER_TEMP) {
sensorTemp = sensors[i].second; sensorTemp = sensors[i].second;
currentSensorIndex = i; currentSensorIndex = i;
thermalStates[currThermalComponent].errorCounter = 0; thermalStates[currThermalComponent].noSensorAvailableCounter = 0;
return true; return true;
} }
} }
thermalStates[currThermalComponent].errorCounter++; thermalStates[currThermalComponent].noSensorAvailableCounter++;
if (currThermalComponent != RW and currThermalComponent != ACS_BOARD) { if (currThermalComponent != RW and currThermalComponent != ACS_BOARD) {
if (thermalStates[currThermalComponent].errorCounter <= 3) { if (thermalStates[currThermalComponent].noSensorAvailableCounter <= 3) {
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent);
} }
} else { } else {
if (thermalStates[currThermalComponent].errorCounter <= 8) { if (thermalStates[currThermalComponent].noSensorAvailableCounter <= 8) {
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent); triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, currThermalComponent);
} }
} }

View File

@ -48,7 +48,7 @@ struct TempLimits {
}; };
struct ThermalState { struct ThermalState {
uint8_t errorCounter; uint8_t noSensorAvailableCounter;
// Which sensor is used for this component? // Which sensor is used for this component?
uint8_t sensorIndex = 0; uint8_t sensorIndex = 0;
// Is heating on for that thermal module? // Is heating on for that thermal module?
@ -80,7 +80,8 @@ enum ThermalComponents : uint8_t {
IF_BOARD = 5, IF_BOARD = 5,
TCS_BOARD = 6, TCS_BOARD = 6,
OBC = 7, OBC = 7,
OBCIF_BOARD = 8, // Not used anymore, was identical to OBC module.
LEGACY_OBCIF_BOARD = 8,
SBAND_TRANSCEIVER = 9, SBAND_TRANSCEIVER = 9,
PCDUP60_BOARD = 10, PCDUP60_BOARD = 10,
PCDUACU = 11, PCDUACU = 11,
@ -357,7 +358,6 @@ class ThermalController : public ExtendedControllerBase {
void ctrlIfBoard(); void ctrlIfBoard();
void ctrlTcsBoard(); void ctrlTcsBoard();
void ctrlObc(); void ctrlObc();
void ctrlObcIfBoard();
void ctrlSBandTransceiver(); void ctrlSBandTransceiver();
void ctrlPcduP60Board(); void ctrlPcduP60Board();
void ctrlPcduAcu(); void ctrlPcduAcu();