Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r5070f8552a200e15dcc2ca0532db10fba9dc8c6b -rdfece12385652318f19c2aa3bd0a5992b0396bec --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 5070f8552a200e15dcc2ca0532db10fba9dc8c6b) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision dfece12385652318f19c2aa3bd0a5992b0396bec) @@ -98,8 +98,8 @@ #define DIP_ML_PER_MIN_TO_PUMP_RPM_FACTOR ( DIP_REV_PER_LITER / ML_PER_LITER ) #define DIP_GEAR_RATIO 32.0 ///< DialIn pump motor to dialIn pump gear ratio. #define DIP_PWM_ZERO_OFFSET 0.1 ///< 10% PWM duty cycle = zero speed. -/// Macro converts flow rate to estimate PWM needed to achieve it. -#define DIP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DIP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DIP_GEAR_RATIO * DIP_MOTOR_RPM_TO_PWM_DC_FACTOR + DIP_PWM_ZERO_OFFSET ) +/// Macro converts flow rate to estimate PWM needed to achieve it. // TODO - I added 1.2 gain based on empirical data +#define DIP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DIP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DIP_GEAR_RATIO * DIP_MOTOR_RPM_TO_PWM_DC_FACTOR * 1.2 + DIP_PWM_ZERO_OFFSET ) /// Conversion from PWM duty cycle % to commanded pump motor speed. #define DIP_PWM_TO_MOTOR_SPEED_RPM(pwm) ( ((pwm) - DIP_PWM_ZERO_OFFSET) * 4000.0 )