Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -re283a8f2f25dea73d84f87ac346c23e7b3059531 -r2a301437ee7dd8557afcb2203cdcb10991dbb7d8 --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision e283a8f2f25dea73d84f87ac346c23e7b3059531) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 2a301437ee7dd8557afcb2203cdcb10991dbb7d8) @@ -207,10 +207,7 @@ } else { - if ( airTrapIllegalLevelSensorsCtr > 0 ) - { - airTrapIllegalLevelSensorsCtr--; - } + airTrapIllegalLevelSensorsCtr = 0; } } Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rb9830073c88a7ccb257093f99895edad4132b3d8 -r2a301437ee7dd8557afcb2203cdcb10991dbb7d8 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision b9830073c88a7ccb257093f99895edad4132b3d8) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 2a301437ee7dd8557afcb2203cdcb10991dbb7d8) @@ -595,7 +595,8 @@ * and load cell sensor monitor. Checks are performed. Data is published * at appropriate interval. * @details Inputs: latest sensor data - * @details Outputs: dialOutPumpMCSpeedRPM, dialOutPumpMCCurrentmA + * @details Outputs: dialOutPumpMCSpeedRPM, dialOutPumpMCCurrentmA, ufMeasuredRate, + * dopMeasuredRate * @return none *************************************************************************/ void execDialOutFlowMonitor( void ) @@ -609,14 +610,30 @@ // Calculate dialysate outlet pump motor speed/direction from hall sensor count updateDialOutPumpSpeedAndDirectionFromHallSensors(); - // Filter estimated dialysate out flow rate and calculate UF rate - if ( ++flowFilterTimerCtr >= DIAL_OUT_FILTER_INTERVAL ) + // Filter estimated dialysate out flow rate and estimate UF rate if running pump in closed loop mode + if ( ( TRUE == isDialOutPumpOn ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == dialOutPumpControlMode ) ) { + if ( ++flowFilterTimerCtr >= DIAL_OUT_FILTER_INTERVAL ) + { + flowFilterTimerCtr = 0; + // Calculate DPo flow in mL/min + filterDialOutFlowReadings( getMeasuredDialOutPumpMCSpeed() * RPM_2_ML_MIN_CONVERSION ); + // Calculate UF flow in mL/min + if ( DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE == dialOutPumpState ) + { + ufMeasuredRate = dopMeasuredRate - getMeasuredDialInFlowRate(); + } + else + { // if we're ramping, calculation won't work so just set to set rate + ufMeasuredRate = getCurrentUFSetRate(); + } + } + } + else + { + dopMeasuredRate = 0.0F; + ufMeasuredRate = 0.0F; flowFilterTimerCtr = 0; - // Calculate DPo flow in mL/min - filterDialOutFlowReadings( getMeasuredDialOutPumpMCSpeed() * RPM_2_ML_MIN_CONVERSION ); - // Calculate UF flow in mL/min - ufMeasuredRate = dopMeasuredRate - getMeasuredDialInFlowRate(); } // Do not start enforcing checks until out of init/POST mode