Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff -rb92c26da32bed791d9836391080eacf19f221de6 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 2652d50bbc5e78ed6fe3ad9ccbca0be6f802f1ff) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision b92c26da32bed791d9836391080eacf19f221de6) @@ -46,15 +46,15 @@ #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 0.5F ///< Slope of flow to PWM line equation. +#define ROP_FLOW_TO_PWM_SLOPE 0.357F ///< Slope of flow to PWM line equation. #define ROP_FLOW_TO_PWM_INTERCEPT 0.0F ///< Intercept of flow to PWM line equation. -#define ROP_PRESSURE_TO_PWM_SLOPE 0.5F ///< Slope of pressure to PWM line equation. +#define ROP_PRESSURE_TO_PWM_SLOPE 10.0F ///< 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_FLOW_TO_PWM(flow) ( ROP_FLOW_TO_PWM_SLOPE * flow + ROP_FLOW_TO_PWM_INTERCEPT ) ///< PWM line equation for flow. -#define ROP_PRESSURE_TO_PWM(pres) ( ROP_PRESSURE_TO_PWM_SLOPE * pres + ROP_PRESSURE_TO_PWM_INTERCEPT )///< PWM line equation for pressure. +#define ROP_FLOW_TO_PWM_PCT(flow) ( ( ROP_FLOW_TO_PWM_SLOPE * flow + ROP_FLOW_TO_PWM_INTERCEPT ) / MAX_FLUID_PUMP_PWM_DUTY_CYCLE ) ///< PWM line equation for flow. +#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. // ********** private data ********** @@ -281,13 +281,13 @@ } // Control at set interval or shut off - if ( ( getTargetROPumpFlowRateMLPM() == 0.0F ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) + if ( ( (F32)getTargetROPumpFlowRateMLPM() == 0.0F ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { signalROPumpHardStop(); } else if ( ( ++roControlTimerCounter >= ROP_CONTROL_INTERVAL ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { - roPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, getTargetROPumpFlowRateMLPM(), getFilteredFlow( P16_FLOW ) ); + roPumpDutyCyclePctSet = runPIController( PI_CONTROLLER_ID_RO_PUMP_FLOW, (F32)getTargetROPumpFlowRateMLPM(), getFilteredFlow( P16_FLOW ) ); setFluidPumpPctToPWMDutyCycle( P12_PUMP, roPumpDutyCyclePctSet ); roControlTimerCounter = 0; } @@ -580,7 +580,7 @@ roPumpState = RO_PUMP_OFF_STATE; roPumpDutyCyclePctSet = 0.0F; roControlTimerCounter = 0; - roPumpOpenLoopTargetDutyCycle.data = 0; + roPumpOpenLoopTargetDutyCycle.data = 0.0F; stopPumpRequest = TRUE; stopROPump(); }