Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r29a9a5dbaf87d4ae86612c7ca8c27716f20d6381 -r958fe9290555ff010f74d81bf4fdb819295607b4 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 29a9a5dbaf87d4ae86612c7ca8c27716f20d6381) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 958fe9290555ff010f74d81bf4fdb819295607b4) @@ -150,7 +150,7 @@ static RO_PUMP_STATE_T handleROPumpControlToMaxPressureState( void ); static RO_PUMP_STATE_T handleROPumpOpenLoopState( void ); -static F32 roPumpFlowToPWM( RO_PI_FLOW_PROFILES_T profileID ); +static F32 roPumpFlowToPWM( RO_PI_FLOW_PROFILES_T profileID, F32 targetFlow ); static void setROPumpTargetDutyCycle( F32 duty ); static void setROPumpControlSignalDutyCycle( F32 dutyCycle ); static void stopROPump( void ); @@ -418,7 +418,6 @@ *************************************************************************/ void execROPumpController( void ) { - currentDGOperationMode = getCurrentOperationMode(); // Handle pending delayed RO pump command if ( pendingROPumpCmdCountDown > 0 ) { @@ -466,7 +465,6 @@ roPumpState = RO_PUMP_OFF_STATE; break; } - lastDGOperationMode = currentDGOperationMode; } /*********************************************************************//** @@ -690,7 +688,7 @@ F32 actualPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_OUTLET ); // Control at set interval - if ( ++roControlTimerCounter >= roPumpPressureControlInterval && roPumpControlMode == PUMP_CONTROL_MODE_CLOSED_LOOP ) + if ( ++roControlTimerCounter >= ROP_CONTROL_INTERVAL && roPumpControlMode == PUMP_CONTROL_MODE_CLOSED_LOOP ) { if ( actualPressure > targetROPumpMaxPressure ) { @@ -825,7 +823,7 @@ if ( profileID < NUM_OF_RO_PI_FLOW_PROFILES ) { roPumpControlInterval = roPIFlowProfiles[ profileID ].controlInterval; - initialControlDutyCycle = roPumpFlowToPWM( profileID, getTargetROPumpFlowRateLPM() ); + initialControlDutyCycle = roPumpFlowToPWM( profileID, (getTargetROPumpFlowRateLPM()) ); initializePIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, initialControlDutyCycle, roPIFlowProfiles[ profileID ].Kp, roPIFlowProfiles[ profileID ].Ki,