Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r340d76e1d4dee94b1e721cf2fac15ec8af134294 -r4d637d588c0d78d95645e24ccbfdc01d45718a2f --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 340d76e1d4dee94b1e721cf2fac15ec8af134294) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 4d637d588c0d78d95645e24ccbfdc01d45718a2f) @@ -131,6 +131,19 @@ BOOL hasCRCBeenChecked; ///< Barometric sensor has CRC been checked flag. } BARO_SENSOR_CONSTS_T; +/// Barometric sensor coefficients +typedef struct +{ + U16 mfgInfo; ///< Barometric sensor manufacturing info. + U16 pressSensitivity; ///< Barometric sensor pressure sensitivity. + U16 pressOffset; ///< Barometric sensor pressure offset. + U16 tempCoeffOfPressSens; ///< Barometric sensor temperature coefficient of pressure sensor. + U16 tempCoeffPressOffset; ///< Barometric sensor temperature coefficient of pressure offset. + U16 referenceTemp; ///< Barometric sensor reference temperature. + U16 tempCoeffOfTemp; ///< Barometric sensor temperature coefficient of Temperature sensor. + U16 crc; ///< Barometric sensor CRC of the coefficients. +} BARO_SENSORS_COEFFS_T; + // ********** private data ********** static TEMPSENSORS_EXEC_STATES_T tempSensorsExecState; ///< TemperatureSensor exec state. @@ -200,6 +213,7 @@ void initTemperatureSensors( void ) { U08 i; + tempSensorsExecState = TEMPSENSORS_EXEC_STATE_START; elapsedTime = 0; internalHeatersConversionTimer = 0; @@ -671,6 +685,7 @@ static void processHtrsTempSnsrsADCRead( U32 sensorIndex, U16 adc ) { S16 convert = (S16)adc; + processADCRead( sensorIndex, (S32)convert ); } @@ -751,7 +766,7 @@ case TEMPSENSORS_BAROMETRIC_TEMP_SENSOR: { tempSensors[ sensorIndex ].baroTempSnsrDiff = (S32)avgADCReads - ( baroConvConsts.refTemperature * TWO_TO_POWER_OF_8 ); - U64 baroSnsrTemperature = BARO_SENSOR_REFERENCE_TEMP_C + ( ( tempSensors[ sensorIndex ].baroTempSnsrDiff * + S64 baroSnsrTemperature = BARO_SENSOR_REFERENCE_TEMP_C + ( ( tempSensors[ sensorIndex ].baroTempSnsrDiff * baroConvConsts.temperatureCoeff ) / TWO_TO_POWER_OF_23 ); temperature = (F32)( (U32)( baroSnsrTemperature ) / 100 ); } @@ -942,9 +957,9 @@ #endif { U08 i; - F32 temperature = 0.0; + F32 temperature = 0.0F; BOOL isTemperatureOutOfRange = FALSE; - F32 alarmTemperature = 0.0; + F32 alarmTemperature = 0.0F; U08 alarmIndex = 0; for ( i = 0; i < NUM_OF_TEMPERATURE_SENSORS; i++ ) @@ -966,6 +981,8 @@ case TEMPSENSORS_INTERNAL_THD_RTD: case TEMPSENSORS_INTERNAL_COND_TEMP_SENSOR: case TEMPSENSORS_BAROMETRIC_TEMP_SENSOR: + // All the temperature sensors are monitored except the heaters' temperature sensors. + // The heaters' temperature sensors are only broadcast for information temperature = getTemperatureValue( i ); // Check both temperature and to be in range @@ -1041,17 +1058,7 @@ if ( TRUE == hasCRCChanged ) { U08 calculatedCRC; - struct - { - U16 mfgInfo; - U16 pressSensitivity; - U16 pressOffset; - U16 tempCoeffOfPressSens; - U16 tempCoeffPressOffset; - U16 referenceTemp; - U16 tempCoeffOfTemp; - U16 crc; - } baroCoeffs; + BARO_SENSORS_COEFFS_T baroCoeffs; baroCoeffs.mfgInfo = getFPGABaroMfgInfo(); baroCoeffs.pressSensitivity = getFPGABaroPressureSensitivity(); @@ -1078,6 +1085,7 @@ } } + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/