Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r721bd715bef050760e5c0f79044d1cba642c8354 -rde18b3784a9a5ab48d11cb6ce2c651de390ee0e9 --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 721bd715bef050760e5c0f79044d1cba642c8354) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision de18b3784a9a5ab48d11cb6ce2c651de390ee0e9) @@ -144,6 +144,7 @@ OVERRIDE_U32_T coeffsCRC; ///< Barometric sensor coefficients CRC. U32 waitForCoeffStartTimeMS; ///< Barometric sensor wait for coefficients start time in milliseconds. BOOL hasCRCBeenChecked; ///< Barometric sensor has CRC been checked flag. + BOOL hasCRCCheckBeenRequested; ///< Barometric sensor has CRC check been requested flag. } BARO_SENSOR_CONSTS_T; /// Barometric sensor coefficients @@ -670,6 +671,19 @@ /*********************************************************************//** * @brief + * The requestBaroSensorMFGInfoCheck function requests the baro sensor manufacturing + * information be checked. + * @details Inputs: none + * @details Outputs: baroConvConsts.hasCRCCheckBeenRequested + * @return none + *************************************************************************/ +void requestBaroSensorMFGInfoCheck( void ) +{ + baroConvConsts.hasCRCCheckBeenRequested = TRUE; +} + +/*********************************************************************//** + * @brief * The getADC2TempConversion function calculates the temperature from the * moving average ADC samples. * @details Inputs: tempEquationCoeffA, tempEquationCoeffB @@ -949,9 +963,6 @@ processTempSnsrsADCRead( TEMPSENSORS_INTERNAL_THD_RTD, getFPGATHdInternalTemp() ); - // Make sure the baro sensor coefficients are not corrupted - checkBaroSensorCRC(); - baroConvConsts.refTemperature = getFPGABaroReferenceTemperature(); baroConvConsts.temperatureCoeff = getFPGABaroTempCoeffOfTemperature(); readCount = getFPGABaroReadCount(); @@ -1142,23 +1153,24 @@ BOOL hasCRCChanged = ( baroCRC != getU32OverrideValue( &baroConvConsts.coeffsCRC ) ? TRUE : FALSE ); // Once FPGA is ready get the barometric sensor's temperature conversion constants - if ( TRUE == hasCRCChanged ) + if ( ( TRUE == hasCRCChanged ) || ( TRUE == baroConvConsts.hasCRCCheckBeenRequested ) ) { U08 calculatedCRC; BARO_SENSORS_COEFFS_T baroCoeffs; - baroCoeffs.mfgInfo = getFPGABaroMfgInfo(); - baroCoeffs.pressSensitivity = getFPGABaroPressureSensitivity(); - baroCoeffs.pressOffset = getFPGABaroPressureOffset(); - baroCoeffs.tempCoeffOfPressSens = getFPGABaroTempCoeffOfPressSensitvity(); - baroCoeffs.tempCoeffPressOffset = getFPGABaroTempCoeffOfPressOffset(); - baroCoeffs.referenceTemp = getFPGABaroReferenceTemperature(); - baroCoeffs.tempCoeffOfTemp = getFPGABaroTempCoeffOfTemperature(); - baroCoeffs.crc = MASK_OFF_LSB & getFPGABaroCoeffsCRC(); - calculatedCRC = crc4( (U16*)&baroCoeffs, sizeof( baroCoeffs ) ); - baroConvConsts.coeffsCRC.data = baroCRC; - baroCRC = (U16)( baroCRC & MASK_OFF_MSB ) & MASK_OFF_NIBBLE_MSB; - baroConvConsts.hasCRCBeenChecked = TRUE; + baroCoeffs.mfgInfo = getFPGABaroMfgInfo(); + baroCoeffs.pressSensitivity = getFPGABaroPressureSensitivity(); + baroCoeffs.pressOffset = getFPGABaroPressureOffset(); + baroCoeffs.tempCoeffOfPressSens = getFPGABaroTempCoeffOfPressSensitvity(); + baroCoeffs.tempCoeffPressOffset = getFPGABaroTempCoeffOfPressOffset(); + baroCoeffs.referenceTemp = getFPGABaroReferenceTemperature(); + baroCoeffs.tempCoeffOfTemp = getFPGABaroTempCoeffOfTemperature(); + baroCoeffs.crc = MASK_OFF_LSB & getFPGABaroCoeffsCRC(); + calculatedCRC = crc4( (U16*)&baroCoeffs, sizeof( baroCoeffs ) ); + baroConvConsts.coeffsCRC.data = baroCRC; + baroCRC = (U16)( baroCRC & MASK_OFF_MSB ) & MASK_OFF_NIBBLE_MSB; + baroConvConsts.hasCRCBeenChecked = TRUE; + baroConvConsts.hasCRCCheckBeenRequested = FALSE; if ( calculatedCRC != baroCRC ) {