Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r25e1aca59e53ee01c2ade994628a5ec7b71e959c -rb5eba178d424a5e7dd7a68b3ae9ace1f95a944bf --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 25e1aca59e53ee01c2ade994628a5ec7b71e959c) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision b5eba178d424a5e7dd7a68b3ae9ace1f95a944bf) @@ -223,7 +223,7 @@ static void adjustTemperatureSensorsRefResistance( void ); static void checkBaroSensorCRC( void ); static void processDialTemperatureData( void ); -static void getCalibrationAppliedTemperatureValue( U32 sesnorId, F32* temperature ); +static void getCalibrationAppliedTemperatureValue( U32 sesnorIndex, F32* temperature ); /*********************************************************************//** * @brief @@ -837,7 +837,6 @@ case TEMPSENSORS_HEAT_DISINFECT: temperature = getADC2TempConversion( avgADCReads, (U32)tempSensors [ sensorIndex ].gain, (U32)tempSensors [ sensorIndex ].refResistance, (U32)tempSensors [ sensorIndex ].zeroDegreeResistance, tempSensors [ sensorIndex ].conversionCoeff ); - getCalibrationAppliedTemperatureValue( sensorIndex, &temperature ); break; case TEMPSENSORS_FPGA_BOARD_SENSOR: @@ -864,7 +863,6 @@ S64 baroSnsrTemperature = BARO_SENSOR_REFERENCE_TEMP_C + ( ( tempSensors[ sensorIndex ].baroTempSnsrDiff * baroConvConsts.temperatureCoeff ) / TWO_TO_POWER_OF_23 ); temperature = (F32)( (U32)( baroSnsrTemperature ) / 100 ); - getCalibrationAppliedTemperatureValue( sensorIndex, &temperature ); } break; @@ -876,6 +874,7 @@ break; } + getCalibrationAppliedTemperatureValue( sensorIndex, &temperature ); // Update the temperature tempSensors[ sensorIndex ].temperatureValues.data = temperature; } @@ -1210,12 +1209,12 @@ * @param temperature pointer to the calculated temperature value * @return none *************************************************************************/ -static void getCalibrationAppliedTemperatureValue( U32 sesnorId, F32* temperature ) +static void getCalibrationAppliedTemperatureValue( U32 sesnorIndex, F32* temperature ) { CAL_DATA_DG_TEMP_SENSORS_T calId; F32 tempTemperature = *temperature; - switch( sesnorId ) + switch( sesnorIndex ) { case TEMPSENSORS_INLET_PRIMARY_HEATER: calId = CAL_DATA_INLET_PRIMARY_HEATER_TEMP; @@ -1250,15 +1249,19 @@ break; default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_TEMPERATURE_SENSOR_SELECTED, sesnorId ) + // Set the calibration temperature value as num of meaning calibration is not needed for the provided sensor + calId = NUM_OF_CAL_DATA_TEMP_SENSORS; break; } - *temperature = pow( tempTemperature, 4 ) * tempSensorCalRecord.tempSensors[ calId ].fourthOrderCoeff + - pow( tempTemperature, 3 ) * tempSensorCalRecord.tempSensors[ calId ].thirdOrderCoeff + - pow( tempTemperature, 2 ) * tempSensorCalRecord.tempSensors[ calId ].secondOrderCoeff + - tempTemperature * tempSensorCalRecord.tempSensors[ calId ].gain + - tempSensorCalRecord.tempSensors[ calId ].offset; + if ( calId != NUM_OF_CAL_DATA_TEMP_SENSORS ) + { + *temperature = pow( tempTemperature, 4 ) * tempSensorCalRecord.tempSensors[ calId ].fourthOrderCoeff + + pow( tempTemperature, 3 ) * tempSensorCalRecord.tempSensors[ calId ].thirdOrderCoeff + + pow( tempTemperature, 2 ) * tempSensorCalRecord.tempSensors[ calId ].secondOrderCoeff + + tempTemperature * tempSensorCalRecord.tempSensors[ calId ].gain + + tempSensorCalRecord.tempSensors[ calId ].offset; + } }