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 Index: firmware/App/Monitors/Level.c =================================================================== diff -u -r8c5ca1982c53f4702c6f019ce9bcfedb9e513548 -r3ea4def3a3a69a00fb96b6089dbd097fa80041de --- firmware/App/Monitors/Level.c (.../Level.c) (revision 8c5ca1982c53f4702c6f019ce9bcfedb9e513548) +++ firmware/App/Monitors/Level.c (.../Level.c) (revision 3ea4def3a3a69a00fb96b6089dbd097fa80041de) @@ -28,9 +28,9 @@ */ // ********** private definitions ********** -#define FPGA_LEVEL_LOW 4 ///< Floater low level status -#define FPGA_LEVEL_MEDIUM 5 ///< Floater medium level status -#define FPGA_LEVEL_HIGH 7 ///< Floater high level status +#define FPGA_LEVEL_LOW 2 ///< Floater low level status +#define FPGA_LEVEL_MEDIUM 3 ///< Floater medium level status +#define FPGA_LEVEL_HIGH 1 ///< Floater high level status #define LEVEL_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the level data is published on the CAN bus. #define LEVEL_DEBOUNCE_TIME_MS ( MS_PER_SECOND / 10 ) ///< Level debounce time in milliseconds. #define DATA_PUBLISH_COUNTER_START_COUNT 7 ///< Data publish counter start count. @@ -117,6 +117,7 @@ else { // Handle invalid level - alarm + currentLevelStatus = LEVEL_STATE_ILLEGAL ; } break; @@ -233,6 +234,7 @@ data.floaterLevel = (U32)getLevelStatus( FLOATER_LEVEL ); data.bicarbLevel = (U32)getLevelStatus( BICARB_LEVEL ); data.spentDialysateLevel = (U32)getLevelStatus( SPENT_DIALYSATE_LEVEL ); + //data.spentDialysateLevel = (U32)getFPGAFloater1Status(); levelsDataPublicationCounter = 0; Index: firmware/App/Monitors/Level.h =================================================================== diff -u -r8c5ca1982c53f4702c6f019ce9bcfedb9e513548 -r3ea4def3a3a69a00fb96b6089dbd097fa80041de --- firmware/App/Monitors/Level.h (.../Level.h) (revision 8c5ca1982c53f4702c6f019ce9bcfedb9e513548) +++ firmware/App/Monitors/Level.h (.../Level.h) (revision 3ea4def3a3a69a00fb96b6089dbd097fa80041de) @@ -47,6 +47,7 @@ LEVEL_STATE_LOW = 0, ///< Low level LEVEL_STATE_HIGH, ///< High level LEVEL_STATE_MEDIUM, ///< Medium level + LEVEL_STATE_ILLEGAL, ///< Illegal level NUM_OF_LEVELS_STATES ///< Number of level states } LEVEL_STATE_T; Index: firmware/App/Monitors/Pressure.c =================================================================== diff -u -r9102c5da21a15bdaf4bb3bc38795ceb064e3c443 -r3ea4def3a3a69a00fb96b6089dbd097fa80041de --- firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 9102c5da21a15bdaf4bb3bc38795ceb064e3c443) +++ firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 3ea4def3a3a69a00fb96b6089dbd097fa80041de) @@ -36,6 +36,7 @@ #define SIZE_OF_PRESSURE_ROLLING_AVG ( PRESSURE_SAMPLE_FILTER_MS / TASK_PRIORITY_INTERVAL ) ///< Filtered pressure moving average. #define SIZE_OF_PRESSURETEMP_ROLLING_AVG ( PRESSURE_TEMP_SAMPLE_FILTER_MS / TASK_PRIORITY_INTERVAL ) ///< Filtered pressure temprature w/ 1 second moving average. #define MMHG_TO_PSI_CONVERSION 0.0193368F ///< MMHG to PSI conversion. +#define BAR_TO_PSI_CONVERSION 14.5038F ///< MMHG to PSI conversion. #define MIN_INLET_WATER_PRESSURE_WARNING_LOW_PSIG 20.0F ///< Minimum allowed Input low pressure value in psig. #define MAX_INLET_WATER_PRESSURE_WARNING_HIGH_PSIG 80.0F ///< Maximum allowed Input high pressure value in psig. @@ -345,8 +346,8 @@ for ( i = PRESSURE_SENSOR_FIRST; i < NUM_OF_PRESSURE_SENSORS; i++ ) { - F32 pressureinmmHG = getPressure( i ); - F32 pressure = getConvertedPressure( i, pressureinmmHG ); + F32 pressureinPSI = getPressure( i ); + F32 pressure = getConvertedPressure( i, pressureinPSI ); if ( filteredPressureReadings[i].pressureReadingsCount >= SIZE_OF_PRESSURE_ROLLING_AVG ) { @@ -401,12 +402,12 @@ static F32 getConvertedPressure( PRESSURE_SENSORS_T sensor, F32 pressure ) { F32 baroPressurePSI = getPressure( PRESSURE_SENSOR_BAROMETRIC ) * MMHG_TO_PSI_CONVERSION; - F32 pressurePSI = pressure * MMHG_TO_PSI_CONVERSION; // calibrated pressure - //F32 calPressure = getCalibrationAppliedPressure( sensor, pressurePSI ); + //F32 calPressure = getCalibrationAppliedPressure( sensor, pressure ); - return pressurePSI; + return pressure; + //return calPressure; } /*********************************************************************//** Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -r8c5ca1982c53f4702c6f019ce9bcfedb9e513548 -r3ea4def3a3a69a00fb96b6089dbd097fa80041de --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 8c5ca1982c53f4702c6f019ce9bcfedb9e513548) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision 3ea4def3a3a69a00fb96b6089dbd097fa80041de) @@ -90,7 +90,7 @@ #define FPGA_DGP_PUMP_ERROR_BIT 0x01 ///< Fresh dialysate pump error bit mask. #define FPGA_SDP_PUMP_ERROR_BIT 0x02 ///< Spent dialysate pump error bit mask. -#define FPGA_FLOATER_LEVEL_BIT 0x07 ///< Floater level bit mask. +#define FPGA_FLOATER_LEVEL_BIT 0x03 ///< Floater level bit mask. /// FPGA size of V3 read bytes. #define FPGA_SIZE_OF_V3_READ_BYTES ( FPGA_READ_V3_END_BYTE_NUM - FPGA_READ_V3_START_BYTE_NUM )