Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -ra3d8f8dafc488730c316ae0a64d05cb69ec8bcc9 -r5ce7985577e93071cd4c361efe2342cdcd7004dd --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision a3d8f8dafc488730c316ae0a64d05cb69ec8bcc9) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 5ce7985577e93071cd4c361efe2342cdcd7004dd) @@ -112,6 +112,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_PWM_ZERO_OFFSET ) / ( BP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * BP_GEAR_RATIO * BP_MOTOR_RPM_TO_PWM_DC_FACTOR ) ) ) /// Measured blood flow is filtered w/ moving average. #define SIZE_OF_ROLLING_AVG ( ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) * 1 ) @@ -1634,5 +1636,26 @@ 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 testSetBloodPumpTargetDutyCycle( F32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + targetBloodFlowRate = (S32) BP_ML_PER_MIN_FROM_PWM( value ); + result = TRUE; + } + + return result; +} /**@}*/