Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rc0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b -rc84daa1f07003427fc5cdde8f5651434478f7313 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision c0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision c84daa1f07003427fc5cdde8f5651434478f7313) @@ -83,7 +83,7 @@ #define DOP_REV_PER_LITER 150.24 ///< Rotor revolutions per liter. #define DOP_ML_PER_MIN_TO_PUMP_RPM_FACTOR ( DOP_REV_PER_LITER / ML_PER_LITER ) ///< Conversion factor from mL/min to pump motor RPM. #define DOP_GEAR_RATIO 32.0 ///< Pump motor to pump gear ratio. -#define DOP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.00035 ///< ~28 DPo motor RPM = 1% PWM duty cycle. +#define DOP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.00028 ///< ~28 DPo motor RPM = 1% PWM duty cycle. #define DOP_PWM_ZERO_OFFSET 0.1 ///< 10% PWM duty cycle = zero speed. #define DOP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DOP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DOP_GEAR_RATIO * DOP_MOTOR_RPM_TO_PWM_DC_FACTOR + DOP_PWM_ZERO_OFFSET ) ///< Macro converts a flow rate to an estimated PWM duty cycle %. @@ -1204,6 +1204,63 @@ /*********************************************************************//** * @brief + * The testSetTargetDialOutFlowRateOverride function overrides the target \n + * dialysate outlet flow rate. + * @details + * Inputs : none + * Outputs : pump started w/ set target rate and control mode + * @param value : override target dialysate outlet flow rate (in mL/min) + * @param ctrlMode : override pump control mode to this mode (0 = closed loop, 1 = open loop) + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetTargetDialOutFlowRateOverride( S32 value, U32 ctrlMode ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + MOTOR_DIR_T dir; + + if ( value < 0 ) + { + dir = MOTOR_DIR_REVERSE; + } + else + { + dir = MOTOR_DIR_FORWARD; + } + if ( ctrlMode < NUM_OF_PUMP_CONTROL_MODES ) + { + result = setDialOutPumpTargetRate( ABS(value), dir, (PUMP_CONTROL_MODE_T)ctrlMode ); + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetTargetDialOutFlowRateOverride function resets the override of the \n + * target dialysate outlet flow rate. + * @details + * Inputs : none + * Outputs : pump stopped + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetTargetDialOutFlowRateOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = setDialOutPumpTargetRate( 0, dialOutPumpDirection, dialOutPumpControlMode ); + } + + return result; +} + +/*********************************************************************//** + * @brief * The testSetDialOutUFRefVolumeOverride function overrides the target \n * dialout vol rate. * @details