Index: firmware/App/Controllers/FlowSensors.c =================================================================== diff -u -r2e21405574597474db0ebae86cdd7fa2d517f71c -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 --- firmware/App/Controllers/FlowSensors.c (.../FlowSensors.c) (revision 2e21405574597474db0ebae86cdd7fa2d517f71c) +++ firmware/App/Controllers/FlowSensors.c (.../FlowSensors.c) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) @@ -36,7 +36,7 @@ #define FLOW_SENSORS_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the Dialysate flow data is published on the CAN bus. #define FLOW_SENSORS_EDGES_BUFFER_LENGTH 100 ///< Flow sensors edges buffer length. #define FLOW_SENSORS_PULSES_PER_LITER 110000 ///< Flow sensors pulses per liter -#define FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ( 12 * MS_PER_SECOND ) ///< Flow out of range time out in counts. +#define FLOW_OUT_OF_RANGE_TIME_OUT_MS ( 12 * MS_PER_SECOND ) ///< Flow out of range time out in milliseconds. #define DATA_PUBLISH_COUNTER_START_COUNT 20 ///< Data publish counter start count. static const F32 FLOW_SENSORS_LITERS_PER_PULSES = ( 1.0 / (F32)FLOW_SENSORS_PULSES_PER_LITER ); ///< Flow sensors liters/pulses coefficient. @@ -81,7 +81,8 @@ } // Initialize the persistent alarm for flow out of upper and lower range - initPersistentAlarm( ALARM_ID_DIALYSATE_FLOW_RATE_OUT_OF_RANGE, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ); + initPersistentAlarm( ALARM_ID_DG_DIALYSATE_FLOW_RATE_OUT_OF_MAX_RANGE, FLOW_OUT_OF_RANGE_TIME_OUT_MS, FLOW_OUT_OF_RANGE_TIME_OUT_MS ); + initPersistentAlarm( ALARM_ID_DG_RO_FLOW_RATE_OUT_OF_MAX_RANGE, FLOW_OUT_OF_RANGE_TIME_OUT_MS, FLOW_OUT_OF_RANGE_TIME_OUT_MS ); dataPublicationCounter = DATA_PUBLISH_COUNTER_START_COUNT; } @@ -114,10 +115,12 @@ void execFlowSensorsMonitor( void ) { U08 i; - U08 countsIndex; - U16 oldestEdgeCount; - U16 oldest2CurrentEdgeDiff; - F32 flowBeforeCalibrationLPM; + U08 countsIndex = 0; + U16 oldestEdgeCount = 0; + U16 oldest2CurrentEdgeDiff = 0; + F32 flowBeforeCalibrationLPM = 0.0F; + F32 currentFlowLPM = 0.0F; + BOOL isFlowOutOfRange = FALSE; // Check if a new calibration is available if ( TRUE == isNewCalibrationRecordAvailable() ) @@ -162,11 +165,16 @@ flowSensorStatus[ i ].edgeCountsIndex = INC_WRAP( countsIndex, 0, ( FLOW_SENSORS_EDGES_BUFFER_LENGTH - 1 ) ); } - // TODO dialysate flow alarm. Is it needed? - //currentFlow = getMeasuredFlowRateLPM( DIALYSATE_FLOW_SENSOR ); - //isFlowOutOfUpperRange = ( currentFlow > MAX_DIALYSATE_FLOWRATE_LPM ? TRUE : FALSE ); - //checkPersistentAlarm( ALARM_ID_DIALYSATE_FLOW_RATE_OUT_OF_RANGE, isFlowOutOfUpperRange, currentFlow, MAX_DIALYSATE_FLOWRATE_LPM ); + // Check the dialysate flow rate for the maximum allowed flow rate + currentFlowLPM = getMeasuredFlowRateLPM( DIALYSATE_FLOW_SENSOR ); + isFlowOutOfRange = ( currentFlowLPM > MAX_FLOWRATE_LPM ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_DG_DIALYSATE_FLOW_RATE_OUT_OF_MAX_RANGE, isFlowOutOfRange, currentFlowLPM, MAX_FLOWRATE_LPM ); + // Check the RO flow rate for the maximum allowed flow rate + currentFlowLPM = getMeasuredFlowRateLPM( RO_FLOW_SENSOR ); + isFlowOutOfRange = ( currentFlowLPM > MAX_FLOWRATE_LPM ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_DG_RO_FLOW_RATE_OUT_OF_MAX_RANGE, isFlowOutOfRange, currentFlowLPM, MAX_FLOWRATE_LPM ); + publishFlowSensorsData(); } Index: firmware/App/Controllers/FlowSensors.h =================================================================== diff -u -r2e21405574597474db0ebae86cdd7fa2d517f71c -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 --- firmware/App/Controllers/FlowSensors.h (.../FlowSensors.h) (revision 2e21405574597474db0ebae86cdd7fa2d517f71c) +++ firmware/App/Controllers/FlowSensors.h (.../FlowSensors.h) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) @@ -31,7 +31,7 @@ */ // ********** public definitions ********** -#define MAX_DIALYSATE_FLOWRATE_LPM 2.00F ///< Maximum target flow rate in L/min. +#define MAX_FLOWRATE_LPM 2.00F ///< Maximum flow rate in L/min. #define MIN_DIALYSATE_FLOWRATE_LPM 0.05F ///< Minimum target flow rate in L/min. /// Flow meters name Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -rad6b3443575d3f6bbac52237866e19a212d36bc1 -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision ad6b3443575d3f6bbac52237866e19a212d36bc1) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) @@ -175,17 +175,6 @@ loadcells[ LOAD_CELL_RESERVOIR_2_PRIMARY ].rawReading = ( 0 == b1Err ? b1 & MASK_OFF_U32_MSB : loadcells[ LOAD_CELL_RESERVOIR_2_PRIMARY ].rawReading ); loadcells[ LOAD_CELL_RESERVOIR_2_BACKUP ].rawReading = ( 0 == b2Err ? b2 & MASK_OFF_U32_MSB : loadcells[ LOAD_CELL_RESERVOIR_2_BACKUP ].rawReading ); - - /*loadcells[ LOAD_CELL_RESERVOIR_1_PRIMARY ].rawReading = a1 & MASK_OFF_U32_MSB; - loadcells[ LOAD_CELL_RESERVOIR_1_BACKUP ].rawReading = a2 & MASK_OFF_U32_MSB; - loadcells[ LOAD_CELL_RESERVOIR_2_PRIMARY ].rawReading = b1 & MASK_OFF_U32_MSB; - loadcells[ LOAD_CELL_RESERVOIR_2_BACKUP ].rawReading = b2 & MASK_OFF_U32_MSB; - - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID__AVAILABLE_13, ( ( a1 > 0 ) || ( a2 > 0 ) || ( b1 > 0 ) || ( b2 > 0 ) ) ) ) - { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID__AVAILABLE_13, ( a1 | a2 | b1 | b2 ) ) - }*/ - checkFPGAPersistentAlarms( FPGA_PERS_ERROR_LOAD_CELL_A1_B1_SENSORS, getFPGAADC1ErrorCount(), getFPGAADC1ReadCount() ); checkFPGAPersistentAlarms( FPGA_PERS_ERROR_LOAD_CELL_A2_B2_SENSORS, getFPGAADC2ErrorCount(), getFPGAADC2ReadCount() ); @@ -219,9 +208,9 @@ loadcells[ ii ].smallFilterReadings[ smallReadingsIdx ] ) * (F32)SEC_PER_MIN; // Update small filter with new weight sample - loadcells[ ii ].smallFilterTotal -= loadcells[ ii ].smallFilterReadings[ smallReadingsIdx ]; - loadcells[ ii ].smallFilterReadings[ smallReadingsIdx ] = getLoadCellWeight( (LOAD_CELL_ID_T)ii ); - loadcells[ ii ].smallFilterTotal += getLoadCellWeight( (LOAD_CELL_ID_T)ii ); + loadcells[ ii ].smallFilterTotal -= loadcells[ ii ].smallFilterReadings[ smallReadingsIdx ]; + loadcells[ ii ].smallFilterReadings[ smallReadingsIdx ] = getLoadCellWeight( (LOAD_CELL_ID_T)ii ); + loadcells[ ii ].smallFilterTotal += getLoadCellWeight( (LOAD_CELL_ID_T)ii ); // Calculate the load cell value before applying calibration to it loadcells[ ii ].smallFilteredWeight.data = (F32)( loadcells[ ii ].smallFilterTotal / (F64)SIZE_OF_SMALL_LOAD_CELL_AVG ); @@ -241,15 +230,14 @@ for ( ii = 0; ii < NUM_OF_LOAD_CELLS; ++ii ) { // Update large filter with new small filter weight sample - - loadcells[ ii ].largeFilterTotal -= loadcells[ ii ].largeFilterReadings[ largeReadingsIdx ]; + loadcells[ ii ].largeFilterTotal -= loadcells[ ii ].largeFilterReadings[ largeReadingsIdx ]; loadcells[ ii ].largeFilterReadings[ largeReadingsIdx ] = getLoadCellSmallFilteredWeight((LOAD_CELL_ID_T) ii); - loadcells[ ii ].largeFilterTotal += getLoadCellSmallFilteredWeight((LOAD_CELL_ID_T) ii); - loadcells[ ii ].largeFilteredWeight = (F32)( loadcells[ ii ].largeFilterTotal / (F64)SIZE_OF_LARGE_LOAD_CELL_AVG ); + loadcells[ ii ].largeFilterTotal += getLoadCellSmallFilteredWeight((LOAD_CELL_ID_T) ii); + loadcells[ ii ].largeFilteredWeight = (F32)( loadcells[ ii ].largeFilterTotal / (F64)SIZE_OF_LARGE_LOAD_CELL_AVG ); } loadCellFilterTimerCount = 0; - largeReadingsIdx = INC_WRAP( largeReadingsIdx, 0, SIZE_OF_LARGE_LOAD_CELL_AVG - 1 ); + largeReadingsIdx = INC_WRAP( largeReadingsIdx, 0, SIZE_OF_LARGE_LOAD_CELL_AVG - 1 ); } // broadcast load cell data if we are at scheduled interval. Index: firmware/App/Controllers/Pressures.c =================================================================== diff -u -r2e21405574597474db0ebae86cdd7fa2d517f71c -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 --- firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision 2e21405574597474db0ebae86cdd7fa2d517f71c) +++ firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) @@ -47,8 +47,10 @@ #define PRESSURE_SAMPLES_TO_AVERAGE ( 200 / TASK_PRIORITY_INTERVAL ) ///< Averaging pressure data over the reporting interval. #define PRESSURE_AVERAGE_MULTIPLIER ( 1.0F / (F32)PRESSURE_SAMPLES_TO_AVERAGE ) ///< Optimization - multiplying is faster than dividing. -#define MIN_VALID_PRESSURE_RANGE 0.0F ///< Minimum valid range on pressure reading. -#define MAX_VALID_PRESSURE_RANGE 200.0F ///< Maximum valid range on pressure reading. +#define MIN_VALID_PRESSURE_RANGE_PSIA 0.0F ///< Minimum valid range on pressure psia. +#define MAX_VALID_PRESSURE_RANGE_PSIA 200.0F ///< Maximum valid range on pressure psia. +#define MIN_VALID_BARO_PRESSURE_PSIA 10.1F ///< Minimum valid barometric pressure in psia. +#define MAX_VALID_BARO_PRESSURE_PSIA 15.4F ///< Maximum valid barometric pressure in psia. #define MAX_INLET_WATER_PRESSURE_WARNING_LOW 25.0F ///< Maximum allowed low pressure value. #define MIN_INLET_WATER_PRESSURE_WARNING_LOW 28.0F ///< Minimum allowed low pressure value. @@ -133,15 +135,16 @@ for ( i = 0; i < NUM_OF_PRESSURE_SENSORS; i++ ) { - pressures[ i ].data = 0.0; - pressures[ i ].ovData = 0.0; - pressures[ i ].ovInitData = 0.0; + pressures[ i ].data = 0.0F; + pressures[ i ].ovData = 0.0F; + pressures[ i ].ovInitData = 0.0F; pressures[ i ].override = OVERRIDE_RESET; msrdPressureSum[ i ] = 0; } initPersistentAlarm( ALARM_ID_INLET_WATER_PRESSURE_IN_LOW_RANGE, INLET_WATER_PRESSURE_PERSISTENCE_PERIOD, INLET_WATER_PRESSURE_PERSISTENCE_PERIOD ); initPersistentAlarm( ALARM_ID_DG_PRESSURE_OUT_OF_RANGE, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_DG_BARO_PRESSURE_OUT_OF_RANGE, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS, PRESSURE_OUT_OF_RANGE_TIMEOUT_MS ); } /*********************************************************************//** @@ -183,7 +186,7 @@ *************************************************************************/ F32 getMeasuredDGPressure( U32 pressureID ) { - F32 result = 0.0; + F32 result = 0.0F; if ( pressureID < NUM_OF_PRESSURE_SENSORS ) { @@ -320,7 +323,7 @@ if ( ++pressureFilterCounter >= PRESSURE_SAMPLES_TO_AVERAGE ) { F32 adcSum; - F32 pressureBeforeCal = 0.0; + F32 pressureBeforeCal = 0.0F; F32 baroPressure = getBaroPressurePSI(); pressureFilterCounter = 0; @@ -354,10 +357,26 @@ for ( sensorId = 0; sensorId < NUM_OF_PRESSURE_SENSORS; sensorId++ ) { - pressureReading = getMeasuredDGPressure( sensorId ) + getBaroPressurePSI(); - isPressureOutOfRange = ( ( pressureReading < MIN_VALID_PRESSURE_RANGE ) || ( pressureReading > MAX_VALID_PRESSURE_RANGE ) ? TRUE : FALSE ); + switch ( sensorId ) + { + case PRESSURE_SENSOR_RO_PUMP_INLET: + case PRESSURE_SENSOR_RO_PUMP_OUTLET: + case PRESSURE_SENSOR_DRAIN_PUMP_INLET: + case PRESSURE_SENSOR_DRAIN_PUMP_OUTLET: + pressureReading = getMeasuredDGPressure( sensorId ) + getBaroPressurePSI(); + isPressureOutOfRange = ( ( pressureReading < MIN_VALID_PRESSURE_RANGE_PSIA ) || ( pressureReading > MAX_VALID_PRESSURE_RANGE_PSIA ) ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_DG_PRESSURE_OUT_OF_RANGE, isPressureOutOfRange, (F32)sensorId, pressureReading ); + break; - checkPersistentAlarm( ALARM_ID_DG_PRESSURE_OUT_OF_RANGE, isPressureOutOfRange, (F32)sensorId, pressureReading ); + case PRESSURE_SENSOR_BAROMETRIC: + if ( baroConvConsts.pressureSensitivity != 0 ) + { + pressureReading = getBaroPressurePSI(); + isPressureOutOfRange = ( ( pressureReading < MIN_VALID_BARO_PRESSURE_PSIA ) || ( pressureReading > MAX_VALID_BARO_PRESSURE_PSIA ) ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_DG_BARO_PRESSURE_OUT_OF_RANGE, isPressureOutOfRange, (F32)sensorId, pressureReading ); + } + break; + } } return result; @@ -377,14 +396,14 @@ { PRESSURES_DATA_T data; - data.roPumpInletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_INLET ); - data.roPumpOutletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_OUTLET ); - data.drainPumpInletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_DRAIN_PUMP_INLET ); - data.drainPumpOutletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_DRAIN_PUMP_OUTLET ); - data.barometricPressure = getMeasuredDGPressure( PRESSURE_SENSOR_BAROMETRIC ); + data.roPumpInletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_INLET ); + data.roPumpOutletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_OUTLET ); + data.drainPumpInletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_DRAIN_PUMP_INLET ); + data.drainPumpOutletPressure = getMeasuredDGPressure( PRESSURE_SENSOR_DRAIN_PUMP_OUTLET ); + data.barometricPressure = getMeasuredDGPressure( PRESSURE_SENSOR_BAROMETRIC ); + pressuresDataPublicationTimerCounter = 0; broadcastData( MSG_ID_DG_PRESSURES_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( PRESSURES_DATA_T ) ); - pressuresDataPublicationTimerCounter = 0; } } Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -re6c4c61c793a91f9ed9dfe969e01bdeee565347d -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision e6c4c61c793a91f9ed9dfe969e01bdeee565347d) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) @@ -76,7 +76,7 @@ /// Initial conversion factor from target flow rate to PWM duty cycle estimate. #define ROP_FLOW_TO_PWM_DC(flow) ( ROP_FLOW_TO_PWM_SLOPE * flow + ROP_FLOW_TO_PWM_INTERCEPT ) #define MAX_ALLOWED_FLOW_DEVIATION 0.1F ///< Max allowed deviation from target flow. -#define FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ( 12 * MS_PER_SECOND ) ///< Flow out of range time out in counts. +#define FLOW_OUT_OF_RANGE_TIME_OUT_MS ( 12 * MS_PER_SECOND ) ///< Flow out of range time out in counts. #define MAX_PRESSURE_TARGET_TOLERANCE 5 ///< Pressure tolerance from maximum set pressure by user in psi. #define MAX_ALLOWED_PRESSURE_PSI 130 ///< Maximum allowed pressure that the RO pump can go to. #define MIN_ALLOWED_PRESSURE_PSI 10 ///< Minimum allowed pressure that the RO pump can go to. @@ -167,8 +167,8 @@ MIN_RO_PUMP_DUTY_CYCLE, MAX_RO_PUMP_DUTY_CYCLE ); // Initialize the persistent alarm for flow out of upper and lower range - initPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_UPPER_RANGE, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ); - initPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_LOWER_RANGE, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL, FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ); + initPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_UPPER_RANGE, FLOW_OUT_OF_RANGE_TIME_OUT_MS, FLOW_OUT_OF_RANGE_TIME_OUT_MS ); + initPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_LOWER_RANGE, FLOW_OUT_OF_RANGE_TIME_OUT_MS, FLOW_OUT_OF_RANGE_TIME_OUT_MS ); // Initialize the persistent alarm for max allowed pressure out of range initPersistentAlarm( ALARM_ID_RO_PUMP_PRESSURE_OUT_OF_RANGE, MAX_PRESSURE_OUT_OF_RANGE_PERSISTENT_INTERVAL, @@ -221,7 +221,7 @@ // For now maximum allowed pressure is inserted into the target pressure override // if the target flow rate exceeded the max pressure, it will set the maximum pressure targetROPumpMaxPressure = maxPressure; - targetROPumpFlowRateLPM = roFlowRate; + targetROPumpFlowRateLPM = roFlowRate; roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; roPumpState = RO_PUMP_RAMP_UP_TO_TARGET_FLOW_STATE; // Get the initial guess of the duty cycle @@ -776,11 +776,12 @@ { RO_PUMP_DATA_T pumpData; - pumpData.roPumpTgtFlowRateLM = getTargetROPumpFlowRateLPM(); - pumpData.roPumpTgtPressure = getTargetROPumpPressurePSI(); - pumpData.roPumpDutyCycle = roPumpDutyCyclePctSet * FRACTION_TO_PERCENT_FACTOR; - pumpData.roPumpState = (U32)roPumpState; - pumpData.roPumpFBDutyCycle = roPumpFeedbackDutyCyclePct * FRACTION_TO_PERCENT_FACTOR; + pumpData.roPumpTgtFlowRateLPM = getTargetROPumpFlowRateLPM(); + pumpData.roPumpTgtPressurePSI = getTargetROPumpPressurePSI(); + pumpData.roPumpDutyCycle = roPumpDutyCyclePctSet * FRACTION_TO_PERCENT_FACTOR; + pumpData.roMeasFlowRateLPM = getMeasuredFlowRateLPM( RO_FLOW_SENSOR ); + pumpData.roPumpState = (U32)roPumpState; + pumpData.roPumpFBDutyCycle = roPumpFeedbackDutyCyclePct * FRACTION_TO_PERCENT_FACTOR; broadcastData( MSG_ID_RO_PUMP_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&pumpData, sizeof( RO_PUMP_DATA_T ) ); roPumpDataPublicationTimerCounter = 0; Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -rad6b3443575d3f6bbac52237866e19a212d36bc1 -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision ad6b3443575d3f6bbac52237866e19a212d36bc1) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) @@ -37,10 +37,11 @@ /// RO pump data struct. typedef struct { - F32 roPumpTgtPressure; ///< RO pump target pressure. + F32 roPumpTgtPressurePSI; ///< RO pump target pressure. + F32 roMeasFlowRateLPM; ///< RO pump measured flow rate F32 roPumpDutyCycle; ///< RO pump duty cycle. U32 roPumpState; ///< RO pump current state. - F32 roPumpTgtFlowRateLM; ///< RO pump target flow rate in L/min. + F32 roPumpTgtFlowRateLPM; ///< RO pump target flow rate in L/min. F32 roPumpFBDutyCycle; ///< RO pump feedback duty cycle. } RO_PUMP_DATA_T; Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -re6c4c61c793a91f9ed9dfe969e01bdeee565347d -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision e6c4c61c793a91f9ed9dfe969e01bdeee565347d) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) @@ -76,7 +76,7 @@ #define PRIME_CONCENTRATE_LINES_TIME_OUT_MS ( 95 * MS_PER_SECOND ) ///< Time required to prime the concentrate lines. #define FLUSH_BUBBLES_PUMP_TIME_OUT_MS ( 2 * MS_PER_SECOND ) ///< RO pump on during flush bubble interval in ms. #define DIALYSATE_TEMPERATURE_TOLERANCE_C 2.0F ///< Dialysate temperature tolerance in degree C. -#define DIALYSATE_TEMPERATURE_SENSORS_MAX_DRIFT_C 2.0F ///< Dialysate temperature sensors maximum allowed drift in C. +#define DIALYSATE_TEMPERATURE_SENSORS_MAX_DRIFT_C 1.0F ///< Dialysate temperature sensors maximum allowed drift in C. #define DIALYSATE_TEMP_SNSRS_OUT_OF_RANGE_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Dialysate temperature sensors drift timeout in milliseconds. #define DATA_PUBLISH_COUNTER_START_COUNT 63 ///< Data publish counter start count. @@ -399,11 +399,11 @@ { if ( ACID == bottle ) { - usedAcidVolumeML.data = 0.0; + usedAcidVolumeML.data = 0.0F; } else if ( BICARB == bottle ) { - usedBicarbVolumeML.data = 0.0; + usedBicarbVolumeML.data = 0.0F; } else { @@ -528,8 +528,8 @@ else { // Initialization - totalBicarbConductivity = 0.0; - averageBicarbConductivity = 0.0; + totalBicarbConductivity = 0.0F; + averageBicarbConductivity = 0.0F; bicarbConductivitySampleCount = 0; // Set pumps flow rate to prepare for bicarb conductivity testing @@ -584,8 +584,8 @@ { // Initialization requestConcentratePumpOff( CONCENTRATEPUMPS_CP2_BICARB ); - totalBicarbConductivity = 0.0; - totalAcidConductivity = 0.0; + totalBicarbConductivity = 0.0F; + totalAcidConductivity = 0.0F; bicarbConductivitySampleCount = 0; acidConductivitySampleCount = 0; @@ -635,7 +635,7 @@ averageBicarbConductivity = totalBicarbConductivity / bicarbConductivitySampleCount; averageAcidConductivity = totalAcidConductivity / acidConductivitySampleCount; - pctDiffInConductivity = fabs( 2.0 * ( averageAcidConductivity - averageBicarbConductivity ) / + pctDiffInConductivity = fabs( 2.0F * ( averageAcidConductivity - averageBicarbConductivity ) / ( averageAcidConductivity + averageBicarbConductivity ) ); if ( ( TRUE == isValueWithinPercentRange( averageAcidConductivity, ACID_TEST_CD2_TCD, FIVE_PERCENT_FACTOR ) ) && @@ -906,10 +906,8 @@ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_TEMPERATURE_SENSORS_ALARM ) != SW_CONFIG_ENABLE_VALUE ) #endif { - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DG_DIALYSATE_TEMPERATURE_SENSORS_OUT_OF_RANGE, isDriftOut ) ) - { - activateAlarmNoData( ALARM_ID_DG_DIALYSATE_TEMPERATURE_SENSORS_OUT_OF_RANGE ); - } + checkPersistentAlarm( ALARM_ID_DG_DIALYSATE_TEMPERATURE_SENSORS_OUT_OF_RANGE, isDriftOut, fabs( TDi - TRo ), + DIALYSATE_TEMPERATURE_SENSORS_MAX_DRIFT_C ); } }