Index: PressureCommon.c =================================================================== diff -u -ra6e50d961f79536e62469297ce39f3fb258a25e1 -re17124f84bdd75e18007f27e0cb38471f119337e --- PressureCommon.c (.../PressureCommon.c) (revision a6e50d961f79536e62469297ce39f3fb258a25e1) +++ PressureCommon.c (.../PressureCommon.c) (revision e17124f84bdd75e18007f27e0cb38471f119337e) @@ -24,15 +24,15 @@ // ********** private definitions ********** -#define KPA_TO_MMHG ( 7.50062F ) ///< Conversion factor for converting kPa to mmHg. +#define BAR_TO_MMHG ( 750.062F ) ///< Conversion factor for converting bar to mmHg. #define PRESSURE_FS ( 80.0F ) ///< Pressure sensor full scale percentage. #define PRESSURE_ZERO ( 0.0F ) ///< Pressure sensor zero value. #define PRESSURE_FS_RATIO ( 0.9F ) ///< Pressure sensor full scale ratio. #define PRESSURE_ZERO_RATIO ( 0.1F ) ///< Pressure sensor zero ratio. #define PRESSURE_DIVIDER ( 8388608.0F ) ///< Pressure sensor divider. -/// Scaler value for converting pressure readings to kPa. +/// Scaler value for converting pressure readings from kPa to bar (100th). #define PRESSURE_SCALER ( ( PRESSURE_FS - PRESSURE_ZERO ) / \ ( PRESSURE_FS_RATIO - PRESSURE_ZERO_RATIO ) ) @@ -55,11 +55,11 @@ *************************************************************************/ F32 convertPressureReading2mmHg( S32 counts ) { - F32 pressure_kPa, mmHg; + F32 pressure_bar, mmHg; - // Convert raw pressure counts to kPa and then to mmHg - pressure_kPa = ( ( (F32)counts / PRESSURE_DIVIDER ) - PRESSURE_ZERO_RATIO ) * PRESSURE_SCALER; - mmHg = pressure_kPa * KPA_TO_MMHG; + // Convert raw pressure counts to bar and then to mmHg + pressure_bar = ( ( (F32)counts / PRESSURE_DIVIDER ) - PRESSURE_ZERO_RATIO ) * PRESSURE_SCALER; + mmHg = pressure_bar * BAR_TO_MMHG; return mmHg; }