Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r5de1434566b17a5dbef58bc992ff193baa98913f -r6483eb087eb474d9d670b25a1b023c38d27612b6 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 5de1434566b17a5dbef58bc992ff193baa98913f) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 6483eb087eb474d9d670b25a1b023c38d27612b6) @@ -297,14 +297,15 @@ BOOL result = FALSE; // Direction change while pump is running is not allowed - if ( ( ( FALSE == isDialInPumpOn ) || ( dir == dialInPumpDirectionSet ) ) || ( 0 == flowRate ) ) + if ( ( FALSE == isDialInPumpOn ) || ( 0 == flowRate ) || ( dir == dialInPumpDirectionSet ) ) { S32 dirFlowRate = ( dir == MOTOR_DIR_FORWARD ? (S32)flowRate : (S32)flowRate * -1 ); // Don't interrupt pump control unless rate or mode is changing if ( ( dirFlowRate != targetDialInFlowRate ) || ( mode != dialInPumpControlMode ) ) { BOOL isFlowRateInRange = ( flowRate <= MAX_DIAL_IN_FLOW_RATE ? TRUE : FALSE ); + isTestPWMSet = FALSE; #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PUMPS_FLOW_LIMITS ) ) @@ -1513,7 +1514,7 @@ * @details Inputs: isDialInPumpOn, dialInPumpPWMDutyCyclePct, dialInPumpDirectionSet, * dialInPumpState * @details Outputs: dialInPumpControlMode, dialInPumpdirection, dialInPumpPWMDutyCyclePct - * @param pwm, the new pwm value + * @param pwm the new pwm value * @return TRUE if new flow rate & dir are set, FALSE if not **************************************************************************/ static BOOL testSetDialInPumpWithPWM( F32 pwm ) @@ -1528,7 +1529,7 @@ } // Direction change while pump is running is not allowed unless we are turning off - if ( FALSE == isDialInPumpOn && ( dir != dialInPumpDirectionSet ) ) + if ( ( FALSE == isDialInPumpOn ) && ( dir != dialInPumpDirectionSet ) ) { dialInPumpDirection = dir; } @@ -1543,6 +1544,17 @@ dialInPumpControlMode = PUMP_CONTROL_MODE_OPEN_LOOP; dialInPumpPWMDutyCyclePct = RANGE( pwmFabs, MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE, MAX_DIAL_IN_PUMP_PWM_DUTY_CYCLE ); + // clear test flag if we are turning off the pump. + if ( pwmFabs <= MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE ) + { + isTestPWMSet = FALSE; + } + else + { + isTestPWMSet = TRUE; + } + + switch ( dialInPumpState ) { case DIAL_IN_PUMP_RAMPING_UP_STATE: // See if we need to reverse direction of ramp @@ -1575,7 +1587,6 @@ break; } result = TRUE; - } } return result; @@ -1914,21 +1925,9 @@ // check for max of pump pwm for acceptance. if ( absolutePWM < MAX_DIAL_IN_PUMP_PWM_DUTY_CYCLE ) { - // 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; - } - else - { - isTestPWMSet = TRUE; - } result = testSetDialInPumpWithPWM( pwmPct ); } - } - return result; }