Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r0b920c7149620ef5d32f118efc9414c6e7319dfa -r42db67ae5e0568843ec1b8c4733d1279ea2d6169 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 0b920c7149620ef5d32f118efc9414c6e7319dfa) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 42db67ae5e0568843ec1b8c4733d1279ea2d6169) @@ -290,7 +290,7 @@ dialInPumpDirection = dir; dialInPumpControlMode = mode; // Set PWM duty cycle target to an estimated initial target to ramp to based on target flow rate - then we will control to flow when ramp completed - dialInPumpPWMDutyCyclePct = DIP_PWM_FROM_ML_PER_MIN((F32)flowRate); // ~ 8% per 100 mL/min with a 10% zero offset added in (e.g. 100 mL/min = 8+10 = 18%) + dialInPumpPWMDutyCyclePct = ( 0 == flowRate ? DIP_PWM_ZERO_OFFSET : DIP_PWM_FROM_ML_PER_MIN( (F32)flowRate ) ); switch ( dialInPumpState ) { @@ -299,13 +299,15 @@ { dialInPumpState = DIAL_IN_PUMP_RAMPING_DOWN_STATE; } - break; + break; + case DIAL_IN_PUMP_RAMPING_DOWN_STATE: // See if we need to reverse direction of ramp if ( dialInPumpPWMDutyCyclePct > dialInPumpPWMDutyCyclePctSet ) { dialInPumpState = DIAL_IN_PUMP_RAMPING_UP_STATE; } - break; + break; + case DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE: // Start ramp to new target in appropriate direction if ( dialInPumpPWMDutyCyclePctSet > dialInPumpPWMDutyCyclePct ) { @@ -315,7 +317,8 @@ { dialInPumpState = DIAL_IN_PUMP_RAMPING_UP_STATE; } - break; + break; + default: // Ok - not all states need to be handled here break; @@ -1385,7 +1388,14 @@ } if ( ctrlMode < NUM_OF_PUMP_CONTROL_MODES ) { - result = setDialInPumpTargetFlowRate( abs(value), dir, (PUMP_CONTROL_MODE_T)ctrlMode ); + if ( 0 == value ) + { + signalDialInPumpHardStop(); + } + else + { + result = setDialInPumpTargetFlowRate( abs(value), dir, (PUMP_CONTROL_MODE_T)ctrlMode ); + } } } Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r450fd51053df274149ec091955baa33e23e1c7a7 -r42db67ae5e0568843ec1b8c4733d1279ea2d6169 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 450fd51053df274149ec091955baa33e23e1c7a7) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 42db67ae5e0568843ec1b8c4733d1279ea2d6169) @@ -261,7 +261,7 @@ // Direction change while pump is running is not allowed if ( ( FALSE == isDialOutPumpOn ) || ( 0 == flowRate ) || ( dir == dialOutPumpDirectionSet ) ) { - F32 pwmDC = DOP_PWM_FROM_ML_PER_MIN( (F32)flowRate ); + F32 pwmDC = ( 0 == flowRate ? DOP_PWM_ZERO_OFFSET : DOP_PWM_FROM_ML_PER_MIN( (F32)flowRate ) ); // Don't interrupt pump control unless rate or mode is changing if ( ( fabs( pwmDC - dialOutPumpPWMDutyCyclePct ) > NEARLY_ZERO ) || ( mode != dialOutPumpControlMode ) ) @@ -1334,7 +1334,14 @@ } if ( ctrlMode < NUM_OF_PUMP_CONTROL_MODES ) { - result = setDialOutPumpTargetRate( abs(value), dir, (PUMP_CONTROL_MODE_T)ctrlMode ); + if ( 0 == value ) + { + signalDialOutPumpHardStop(); + } + else + { + result = setDialOutPumpTargetRate( abs(value), dir, (PUMP_CONTROL_MODE_T)ctrlMode ); + } } }