Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r2475e55c224cbd841d61b76f1618451efe6be1f5 -r9f79bc2ee4ab3e5b3b14c4a1d9c337af5d001ebd --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 2475e55c224cbd841d61b76f1618451efe6be1f5) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 9f79bc2ee4ab3e5b3b14c4a1d9c337af5d001ebd) @@ -46,17 +46,19 @@ #define ROP_PRESSURE_CONTROL_P_COEFFICIENT 0.15F ///< P term for RO pump pressure control. #define ROP_PRESSURE_CONTROL_I_COEFFICIENT 0.65F ///< I term for RO pump pressure control. -#define ROP_FLOW_TO_PWM_SLOPE 155.31F ///< Slope of flow to PWM line equation. -#define ROP_FLOW_TO_PWM_INTERCEPT -699.99F ///< Intercept of flow to PWM line equation. +#define ROP_FLOW_TO_PWM_SLOPE_PERM_FLUSH 117.63F ///< Slope of flow to PWM line equation for permeate flush. +#define ROP_FLOW_TO_PWM_INTERCEPT_PERM_FLUSH -648.05F ///< Intercept of flow to PWM line equation for permeate flush. +#define ROP_FLOW_TO_PWM_SLOPE_MAX_RECOVER 155.31F ///< Slope of flow to PWM line equation for max RO recovery. +#define ROP_FLOW_TO_PWM_INTERCEPT_MAX_RECOVER -699.99F ///< Intercept of flow to PWM line equation for max RO recovery. #define ROP_PRESSURE_TO_PWM_SLOPE 0.5F ///< Slope of pressure to PWM line equation. #define ROP_PRESSURE_TO_PWM_INTERCEPT 0.0F ///< Intercept of pressure to PWM line equation. #define DATA_PUBLISH_COUNTER_START_COUNT 10 ///< Data publish counter start count. #define ROP_PRESSURE_TO_PWM_PCT(pres) ( ( ROP_PRESSURE_TO_PWM_SLOPE * pres + ROP_PRESSURE_TO_PWM_INTERCEPT ) / MAX_FLUID_PUMP_PWM_DUTY_CYCLE ) ///< PWM line equation for pressure. converted to percentage. -#define ROP_FLOW_TO_PWM_PCT(flow) ( ( ROP_FLOW_TO_PWM_SLOPE * log(flow) + ROP_FLOW_TO_PWM_INTERCEPT ) / MAX_FLUID_PUMP_PWM_DUTY_CYCLE ) ///< PWM line equation for flow converted to percentage. -#define ROP_FLOW_TO_PWM(flow) ( ROP_FLOW_TO_PWM_SLOPE * log(flow) + ROP_FLOW_TO_PWM_INTERCEPT ) ///< PWM line equation for flow converted to percentage. +#define ROP_FLOW_TO_PWM_PCT(slope, intercept, flow) ( ( slope * log(flow) + intercept ) / MAX_FLUID_PUMP_PWM_DUTY_CYCLE ) ///< PWM line equation for flow converted to percentage. +#define ROP_FLOW_TO_PWM(slope, intercept, flow) ( slope * log(flow) + intercept ) ///< PWM line equation for flow converted to percentage. #define FP_FLOW_RATE_BELOW_TARGET_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Timeout for flow rate below 75% of target flow rate #define FP_FLOW_RATE_BELOW_TARGET_CLEAR_MS ( 10 * MS_PER_SECOND ) ///< Clear timeout for flow rate below target flow rate @@ -632,8 +634,13 @@ *************************************************************************/ static F32 roPumpFlowToPWM( U32 targetFlow ) { - F32 dutyCyclePct = ROP_FLOW_TO_PWM_PCT( targetFlow ); + F32 dutyCyclePct = ROP_FLOW_TO_PWM_PCT( ROP_FLOW_TO_PWM_SLOPE_MAX_RECOVER, ROP_FLOW_TO_PWM_INTERCEPT_MAX_RECOVER, targetFlow ); + if ( FP_PRE_GENP_PERMEATE_FLUSH == getCurrentFPSubMode() && ( FP_MODE_PGEN == getCurrentFPOperationMode() ) ) + { + dutyCyclePct = ROP_FLOW_TO_PWM_PCT( ROP_FLOW_TO_PWM_SLOPE_PERM_FLUSH, ROP_FLOW_TO_PWM_INTERCEPT_PERM_FLUSH, targetFlow ); + } + return dutyCyclePct; }