Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rbb648110d33fb859beed67fabc43f7e9614fc00a -r48773fabe2df547a85392cca725aa7c0d6e28329 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision bb648110d33fb859beed67fabc43f7e9614fc00a) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 48773fabe2df547a85392cca725aa7c0d6e28329) @@ -848,31 +848,30 @@ // Add PWM offset to DPi PWM mirror for our new DPo PWM dialOutPumpPWMDutyCyclePct = getDialInPumpPWMDutyCyclePct( FALSE ) + offsetPWMDutyCyclePct; - // Limit PWM range - dialOutPumpPWMDutyCyclePct = MIN( dialOutPumpPWMDutyCyclePct, MAX_DIAL_OUT_PUMP_PWM_DUTY_CYCLE ); - dialOutPumpPWMDutyCyclePct = MAX( dialOutPumpPWMDutyCyclePct, MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE ); - // change in PWM duty cycle should not cross the defined threshold value, if so, step changes should be applied - // to have gradual increase/decrease in PWM duty cycle. This is to avoid few undefined scenarios where sudden ramp down/up seen - // TODO : Need to define the threshold value, for now up to 5% change is allowed?? - if( fabs( dialOutPumpPWMDutyCyclePct - dialOutPumpPWMDutyCyclePctSet ) > MAX_DIAL_OUT_PUMP_PWM_CHANGE ) + // change in PWM duty cycle should not cross the defined threshold value, if so, Limit the change to max 5% for a single control interval + if ( fabs( dialOutPumpPWMDutyCyclePct - dialOutPumpPWMDutyCyclePctSet ) > MAX_DIAL_OUT_PUMP_PWM_CHANGE ) { if ( dialOutPumpPWMDutyCyclePctSet > dialOutPumpPWMDutyCyclePct ) { - dialOutPumpState = DIAL_OUT_PUMP_RAMPING_DOWN_STATE; + dialOutPumpPWMDutyCyclePctSet -= MAX_DIAL_OUT_PUMP_PWM_CHANGE; } else { - dialOutPumpState = DIAL_OUT_PUMP_RAMPING_UP_STATE; + dialOutPumpPWMDutyCyclePctSet += MAX_DIAL_OUT_PUMP_PWM_CHANGE; } } else { dialOutPumpPWMDutyCyclePctSet = dialOutPumpPWMDutyCyclePct; - // Apply new PWM to DPo pump - setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePctSet ); } + // Limit PWM range + dialOutPumpPWMDutyCyclePctSet = MIN( dialOutPumpPWMDutyCyclePctSet, MAX_DIAL_OUT_PUMP_PWM_DUTY_CYCLE ); + dialOutPumpPWMDutyCyclePctSet = MAX( dialOutPumpPWMDutyCyclePctSet, MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE ); + + // Apply new PWM to DPo pump + setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePctSet ); } }