Index: firmware/App/Drivers/PressureSensor.c =================================================================== diff -u -rf5baeac6a5f000705cd51e4779a967acf4088981 -r292746c14e6f7207fb0cb6d06e09df9e48461f4a --- firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision f5baeac6a5f000705cd51e4779a967acf4088981) +++ firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision 292746c14e6f7207fb0cb6d06e09df9e48461f4a) @@ -15,26 +15,25 @@ * ***************************************************************************/ -#include "AlarmMgmtDD.h" -#include "FpgaDD.h" +#include "AlarmMgmtDD.h" +#include "FpgaDD.h" #include "Messaging.h" #include "PersistentAlarm.h" #include "PressureSensor.h" #include "TemperatureSensors.h" - -/** - * @addtogroup PressureSensor - * @{ - */ - -// ********** private definitions ********** +/** + * @addtogroup PressureSensor + * @{ + */ + +// ********** private definitions ********** + #define PRES_SENSORS_COUNT_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Pressure sensors read and error count timeout in milliseconds. #define HIGH_PRES_MAX_PSI 145.038F ///< Convert pressure to PSI for 10 bar pressure sensor #define LOW_PRES_MAX_PSI 50.7632F ///< Convert pressure to PSI for 3.5 bar pressure sensor -#define PRES_MIN_PSI 0.0F ///< Minimum value for PSI conversion - - +#define PRES_MIN_PSI_ALPHA 0.0F ///< Minimum value for PSI conversion for alpha systems +#define PRES_MIN_PSI -14.5038F ///< Minimum value for PSI conversion #define ONE_BAR_TO_MILLI_BAR 1000 ///< 1 bar to milli-bar conversion. #define COUNTS_TO_MILLI_BAR 100 ///< Counts to milli-bar conversion. #define BAR_TO_MMHG ( 750.062F ) ///< Conversion factor for converting bar to mmHg. @@ -48,9 +47,9 @@ U16 pressureSensitivityTempCoeff; ///< Barometric sensor pressure sensitivity temperature coefficient. U16 pressureOffsetTempCoeff; ///< Barometric sensor pressure offset temperature coefficient. } BARO_SENSOR_CONSTS_T; - -// ********** private data ********** - + +// ********** private data ********** + static OVERRIDE_F32_T currentPressureReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< Current pressure sensor pressure readings (overrideable). static OVERRIDE_F32_T currentPresTempReadings[ NUM_OF_PRESSURE_SENSORS ]; ///< Current pressure sensor temperature readings (overrideable). static OVERRIDE_U32_T lastPressureReadCounter[ NUM_OF_PRESSURE_SENSORS ]; ///< Last pressure sensor read count (Overrideable). @@ -63,9 +62,9 @@ static const U32 TWO_TO_POWER_OF_16 = ( 1 << 16 ); ///< 2^16. static const U32 TWO_TO_POWER_OF_17 = ( 1 << 17 ); ///< 2^17. static const U32 TWO_TO_POWER_OF_21 = ( 1 << 21 ); ///< 2^21. - -// ********** private function prototypes ********** - + +// ********** private function prototypes ********** + static void checkPressureSensors( void ); static F32 convertBaroPressureReading2mmHg( U32 rawPressure ); static F32 calculateBaroPressure( U32 pressure ); @@ -143,19 +142,36 @@ *************************************************************************/ void readPressureSensors( void ) { + F32 presMinPSI = PRES_MIN_PSI; + // Update and convert raw pressures to mmHg - currentPressureReadings[ M1_PRES ].data = convertPressureReading( getFPGAM1PresRawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); - currentPressureReadings[ M3_PRES ].data = convertPressureReading( getFPGAM3PresRawPressure(),PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); - currentPressureReadings[ D9_PRES ].data = convertPressureReading( getFPGAD9PresRawPressure(),PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); - currentPressureReadings[ D66_PRES ].data = convertPressureReading( getFPGAD66PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); - currentPressureReadings[ D51_PRES ].data = convertPressureReading( getFPGAD51PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); - currentPressureReadings[ D18_PRES ].data = convertPressureReading( getFPGAD18PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); - currentPressureReadings[ D41_PRES ].data = convertPressureReading( getFPGAD41PresRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); - currentPressureReadings[ BARO_PRES ].data = convertBaroPressureReading2mmHg( getFPGABaroPressure() ); + if ( getTestConfigStatus( TEST_CONFIG_BETA_HW ) != TRUE ) + { + presMinPSI = PRES_MIN_PSI_ALPHA; + currentPressureReadings[ M1_PRES ].data = convertPressureReading( getFPGAM1PresRawPressure(), presMinPSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ M3_PRES ].data = convertPressureReading( getFPGAM3PresRawPressure(), presMinPSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ D9_PRES ].data = convertPressureReading( getFPGAD9PresRawPressure(), presMinPSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ D66_PRES ].data = convertPressureReading( getFPGAD66PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D51_PRES ].data = convertPressureReading( getFPGAD51PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D18_PRES ].data = convertPressureReading( getFPGAD18PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D41_PRES ].data = convertPressureReading( getFPGAD41PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ BARO_PRES ].data = convertBaroPressureReading2mmHg( getFPGABaroPressure() ); + } + else + { + currentPressureReadings[ M1_PRES ].data = convertPressureReading( getFPGAM1PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ M3_PRES ].data = convertPressureReading( getFPGAM3PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D9_PRES ].data = convertPressureReading( getFPGAD9PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D66_PRES ].data = convertPressureReading( getFPGAD66PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D51_PRES ].data = convertPressureReading( getFPGAD51PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D18_PRES ].data = convertPressureReading( getFPGAD18PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ D41_PRES ].data = convertPressureReading( getFPGAD41PresRawPressure(), presMinPSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ BARO_PRES ].data = convertBaroPressureReading2mmHg( getFPGABaroPressure() ); + } // Update and convert raw pressure sensor temperatures to deg C currentPresTempReadings[ M1_PRES ].data = convertPressureTempReading2DegC( getFPGAM1PresRawTemperature() ); - currentPresTempReadings[ M3_PRES ].data = convertPressureTempReading2DegC( getFPGAM3PresRawTemperature() ); + currentPresTempReadings[ M3_PRES ].data = convertPressureTempReading2DegC( getFPGAM3PresRawTemperature() ); currentPresTempReadings[ D9_PRES ].data = convertPressureTempReading2DegC( getFPGAD9PresRawTemperature() ); currentPresTempReadings[ D66_PRES ].data = convertPressureTempReading2DegC( getFPGAD66PresRawTemperature() ); currentPresTempReadings[ D51_PRES ].data = convertPressureTempReading2DegC( getFPGAD51PresRawTemperature() ); @@ -386,12 +402,12 @@ return result; } - -/************************************************************************* - * TEST SUPPORT FUNCTIONS - *************************************************************************/ +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + /*********************************************************************//** * @brief * The testPressureSensorReadingsOverride function overrides the value of the @@ -408,7 +424,7 @@ return result; } - + /*********************************************************************//** * @brief * The testPressureSensorTemperatureReadingsOverride function overrides the value of the @@ -459,5 +475,5 @@ return result; } - -/**@}*/ + +/**@}*/