Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rd5b85c44743b1aaaeb61b88179de032e8ca3c6a7 -r5de1434566b17a5dbef58bc992ff193baa98913f --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision d5b85c44743b1aaaeb61b88179de032e8ca3c6a7) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 5de1434566b17a5dbef58bc992ff193baa98913f) @@ -297,7 +297,7 @@ BOOL result = FALSE; // Direction change while pump is running is not allowed - if ( ( ( FALSE == isDialInPumpOn ) && ( dir == dialInPumpDirectionSet ) ) || ( 0 == flowRate ) ) + if ( ( ( FALSE == isDialInPumpOn ) || ( dir == dialInPumpDirectionSet ) ) || ( 0 == flowRate ) ) { S32 dirFlowRate = ( dir == MOTOR_DIR_FORWARD ? (S32)flowRate : (S32)flowRate * -1 ); @@ -1527,19 +1527,19 @@ dir = MOTOR_DIR_REVERSE; } - // Check to see if pump is on or attempting to turn off // Direction change while pump is running is not allowed unless we are turning off - if ( ( ( FALSE == isDialInPumpOn ) && ( dir == dialInPumpDirectionSet ) ) || ( MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE >= pwmFabs ) ) + if ( FALSE == isDialInPumpOn && ( dir != dialInPumpDirectionSet ) ) { + dialInPumpDirection = dir; + } + + // Allow pump to turn on, change rate in same direction, or turn off. + if ( ( ( FALSE == isDialInPumpOn ) || ( dir == dialInPumpDirectionSet ) ) || ( pwmFabs <= MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE ) ) + { // Don't interrupt pump control unless rate is changing if ( ( pwmFabs != dialInPumpPWMDutyCyclePct ) ) { resetDialInFlowMovingAverage(); - // accept direction changes only when we stop - if ( FALSE == isDialInPumpOn ) - { - dialInPumpDirection = dir; - } dialInPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; dialInPumpPWMDutyCyclePct = RANGE( pwmFabs, MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE, MAX_DIAL_IN_PUMP_PWM_DUTY_CYCLE ); @@ -1911,13 +1911,12 @@ if ( TRUE == isTestingActivated() ) { - // check for max of pump pwm. - // minimum will get bounded within setDialInPumpWithPWM but we want - // 0 to be acceptable as off. + // check for max of pump pwm for acceptance. if ( absolutePWM < MAX_DIAL_IN_PUMP_PWM_DUTY_CYCLE ) { - // if exactly zero, clear test flag - if ( pwmPct == 0 ) + // if less than minimum pwm, we are turning off the pump + // and set the test switch. + if ( absolutePWM <= MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE) { isTestPWMSet = FALSE; }