Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r8b73263b38f449dacc0795c67a7cf6240cb79026 -rbb63d313f1edeb2fa72f992cedab03b13cdf644a --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 8b73263b38f449dacc0795c67a7cf6240cb79026) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision bb63d313f1edeb2fa72f992cedab03b13cdf644a) @@ -113,6 +113,8 @@ #define BP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * BP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * BP_GEAR_RATIO * BP_MOTOR_RPM_TO_PWM_DC_FACTOR + BP_PWM_ZERO_OFFSET ) /// Conversion from PWM duty cycle % to commanded pump motor speed. #define BP_PWM_TO_MOTOR_SPEED_RPM(pwm) ( ((pwm) - BP_PWM_ZERO_OFFSET) * 4000.0F ) +/// Conversion macro from mL/min to estimated PWM duty cycle %. +#define BP_ML_PER_MIN_FROM_PWM(pwm) ( ( pwm / ( BP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * BP_GEAR_RATIO * BP_MOTOR_RPM_TO_PWM_DC_FACTOR) ) - BP_PWM_ZERO_OFFSET ) /// Measured blood flow is filtered w/ moving average. #define SIZE_OF_ROLLING_AVG ( ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) * 1 )