Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r9051b47d2d0e9f112d4ebc310a5572844b7528f4 -rbb63d313f1edeb2fa72f992cedab03b13cdf644a --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 9051b47d2d0e9f112d4ebc310a5572844b7528f4) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision bb63d313f1edeb2fa72f992cedab03b13cdf644a) @@ -111,6 +111,9 @@ //#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 ) /// Conversion from PWM duty cycle % to commanded pump motor speed. #define DIP_PWM_TO_MOTOR_SPEED_RPM(pwm) ( ((pwm) - DIP_PWM_ZERO_OFFSET) * 4000.0F ) +// Macro converts PWM to estimate flow rate needed to achieve it. +#define DIP_ML_PER_MIN_FROM_PWM(pwm) ( (( pwm + DIP_PWM_ZERO_OFFSET) * 684.73 ) + 49.121 ) + /// Measured dialIn flow is filtered w/ moving average. #define SIZE_OF_ROLLING_AVG 10 @@ -1625,6 +1628,30 @@ } return result; -} +} + +/*********************************************************************//** + * @brief + * The testSetDialInPumpTargetDutyCycle function resets the override of the + * measured dialIn pump motor current. + * @details Inputs: none + * @details Outputs: adcDialInPumpMCCurrentmA + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testSetDialInPumpTargetDutyCycle( F32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + targetDialInFlowRate = (S32) DIP_ML_PER_MIN_FROM_PWM( value ); + result = TRUE; + } + + return result; +} + + + /**@}*/