add sanity range check
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2023-04-04 15:02:56 +02:00
parent bc7bdfe1fe
commit 4a287344f4
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 10 additions and 6 deletions

View File

@ -1560,9 +1560,11 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
}
resetSensorsArray();
}
bool ThermalController::selectAndReadSensorTemp() {
bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
for (unsigned i = 0; i < numSensors; i++) {
if (sensors[i].first and sensors[i].second != INVALID_TEMPERATURE) {
if (sensors[i].first and sensors[i].second != INVALID_TEMPERATURE and
sensors[i].second > SANITY_LIMIT_LOWER_TEMP and
sensors[i].second < SANITY_LIMIT_UPPER_TEMP) {
sensorTemp = sensors[i].second;
thermalStates[thermalComponent].errorCounter = 0;
return true;

View File

@ -31,8 +31,8 @@
* limit is exceeded to avoid reaching NOP limit
*/
struct TempLimits {
TempLimits(float nopLowerLimit, float opLowerLimit, float cutOffLimit, float opUpperLimit,
float nopUpperLimit)
TempLimits(float opLowerLimit, float cutOffLimit, float opUpperLimit,
float nopUpperLimit, float sanityUpperLimit)
: opLowerLimit(opLowerLimit),
opUpperLimit(opUpperLimit),
cutOffLimit(cutOffLimit),
@ -91,6 +91,8 @@ class ThermalController : public ExtendedControllerBase {
public:
static const uint16_t INVALID_TEMPERATURE = 999;
static const uint8_t NUMBER_OF_SENSORS = 16;
static constexpr uint16_t SANITY_LIMIT_LOWER_TEMP = -80;
static constexpr uint16_t SANITY_LIMIT_UPPER_TEMP = 160;
ThermalController(object_id_t objectId, HeaterHandler& heater);
@ -218,7 +220,7 @@ class ThermalController : public ExtendedControllerBase {
lp_var_t<float> tempAdcPayloadPcdu = lp_var_t<float>(objects::PLPCDU_HANDLER, plpcdu::TEMP);
// TempLimits
TempLimits acsBoardLimits = TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
TempLimits acsBoardLimits = TempLimits(5-40.0, -40.0, 80.0, 85.0, 85.0);
TempLimits mgtLimits = TempLimits(-40.0, -40.0, 65.0, 70.0, 70.0);
TempLimits rwLimits = TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
TempLimits strLimits = TempLimits(-30.0, -20.0, 65.0, 70.0, 80.0);
@ -299,7 +301,7 @@ class ThermalController : public ExtendedControllerBase {
void heaterCtrlTempTooHighHandler(HeaterContext& heaterContext, const char* whatLimit);
bool chooseHeater(heater::Switchers& switchNr, heater::Switchers redSwitchNr);
bool selectAndReadSensorTemp();
bool selectAndReadSensorTemp(HeaterContext& htrCtx);
void ctrlAcsBoard();
void ctrlMgt();