Index: firmware/App/Drivers/PressureSensor.c =================================================================== diff -u -r48c75a394c56b82886760e9a136b638edecf7572 -r3ea4def3a3a69a00fb96b6089dbd097fa80041de --- firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision 48c75a394c56b82886760e9a136b638edecf7572) +++ firmware/App/Drivers/PressureSensor.c (.../PressureSensor.c) (revision 3ea4def3a3a69a00fb96b6089dbd097fa80041de) @@ -30,6 +30,11 @@ // ********** 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 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. @@ -139,13 +144,13 @@ void readPressureSensors( void ) { // Update and convert raw pressures to mmHg - currentPressureReadings[ PRESSURE_SENSOR_WATER_INLET_INPUT ].data = convertPressureReading2mmHg( getFPGAPRiRawPressure() ); - currentPressureReadings[ PRESSURE_SENSOR_WATER_INLET_OUTPUT ].data = convertPressureReading2mmHg( getFPGAPRoRawPressure() ); - currentPressureReadings[ PRESSURE_SENSOR_HYDRAULICS_OUTLET ].data = convertPressureReading2mmHg( getFPGAPnRawPressure() ); - currentPressureReadings[ PRESSURE_SENSOR_BIBAG ].data = convertPressureReading2mmHg( getFPGAPCbRawPressure() ); - currentPressureReadings[ PRESSURE_SENSOR_SPENT_DIALYSATE ].data = convertPressureReading2mmHg( getFPGAPDsRawPressure() ); - currentPressureReadings[ PRESSURE_SENSOR_FRESH_DIALYSATE ].data = convertPressureReading2mmHg( getFPGAPDfRawPressure() ); - currentPressureReadings[ PRESSURE_SENSOR_TRANSMEMBRANE ].data = convertPressureReading2mmHg( getFPGAPtmRawPressure() ); + currentPressureReadings[ PRESSURE_SENSOR_WATER_INLET_INPUT ].data = convertPressureReading( getFPGAPRiRawPressure(), PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ PRESSURE_SENSOR_WATER_INLET_OUTPUT ].data = convertPressureReading( getFPGAPRoRawPressure(),PRES_MIN_PSI, HIGH_PRES_MAX_PSI ); + currentPressureReadings[ PRESSURE_SENSOR_HYDRAULICS_OUTLET ].data = convertPressureReading( getFPGAPnRawPressure(),PRES_MIN_PSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ PRESSURE_SENSOR_BIBAG ].data = convertPressureReading( getFPGAPCbRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ PRESSURE_SENSOR_SPENT_DIALYSATE ].data = convertPressureReading( getFPGAPDsRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ PRESSURE_SENSOR_FRESH_DIALYSATE ].data = convertPressureReading( getFPGAPDfRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); + currentPressureReadings[ PRESSURE_SENSOR_TRANSMEMBRANE ].data = convertPressureReading( getFPGAPtmRawPressure(), PRES_MIN_PSI, LOW_PRES_MAX_PSI ); currentPressureReadings[ PRESSURE_SENSOR_BAROMETRIC ].data = convertBaroPressureReading2mmHg( getFPGABaroPressure() ); // Update and convert raw pressure sensor temperatures to deg C