Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rde5a0d43bdef611d963d11855bc958a8d8899a09 -ra3a01327c8fe80f65f6658ae6cbef4910a4a8033 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision de5a0d43bdef611d963d11855bc958a8d8899a09) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision a3a01327c8fe80f65f6658ae6cbef4910a4a8033) @@ -15,9 +15,7 @@ * ***************************************************************************/ -#ifndef _VECTORCAST_ - #include -#endif +#include #include "etpwm.h" #include "gio.h" @@ -83,7 +81,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 %. @@ -97,13 +95,13 @@ NUM_OF_DIAL_OUT_PUMP_STATES ///< Number of dialysate outlet pump control states. } DIAL_OUT_PUMP_STATE_T; -/// Enumeration of dialysate outlet pump self test states. +/// Enumeration of dialysate outlet pump self-test states. typedef enum DialOut_Pump_Self_Test_States { - DIAL_OUT_PUMP_SELF_TEST_STATE_START = 0, ///< Start state of the dialysate outlet pump self test state machine. - DIAL_OUT_PUMP_TEST_STATE_IN_PROGRESS, ///< In progress state of the dialysate outlet pump self test state machine. - DIAL_OUT_PUMP_TEST_STATE_COMPLETE, ///< Completed state of the dialysate outlet pump self test state machine. - NUM_OF_DIAL_OUT_PUMP_SELF_TEST_STATES ///< Number of dialysate outlet pumpt self test states. + DIAL_OUT_PUMP_SELF_TEST_STATE_START = 0, ///< Start state of the dialysate outlet pump self-test state machine. + DIAL_OUT_PUMP_TEST_STATE_IN_PROGRESS, ///< In progress state of the dialysate outlet pump self-test state machine. + DIAL_OUT_PUMP_TEST_STATE_COMPLETE, ///< Completed state of the dialysate outlet pump self-test state machine. + NUM_OF_DIAL_OUT_PUMP_SELF_TEST_STATES ///< Number of dialysate outlet pump self-test states. } DIAL_OUT_PUMP_SELF_TEST_STATE_T; // pin assignments and macros for pump stop and direction outputs @@ -124,7 +122,7 @@ static DIAL_OUT_PUMP_STATE_T dialOutPumpState = DIAL_OUT_PUMP_OFF_STATE; ///< Current state of the dialysate outlet pump controller state machine. static U32 dialOutFlowDataPublicationTimerCounter = 6; ///< Timer counter controlling when to publish dialysate outlet data. Set non-zero to phase data publication to CAN bus. static BOOL isDialOutPumpOn = FALSE; ///< Flag set to TRUE when dialysate outlet pump is running. -static U32 lastGivenRate = 0.0; ///< Remembers the last given set point rate for the dialysate outlet pump. +static U32 lastGivenRate = 0; ///< Remembers the last given set point rate for the dialysate outlet pump. static F32 dialOutPumpPWMDutyCyclePct = 0.0; ///< Requested PWM duty cycle for dialysate outlet pump (based on given rate). static F32 dialOutPumpPWMDutyCyclePctSet = 0.0; ///< Currently set PWM duty cycle for dialysate outlet pump. static MOTOR_DIR_T dialOutPumpDirection = MOTOR_DIR_FORWARD; ///< Requested direction for dialysate outlet pump. @@ -156,8 +154,8 @@ static U32 errorDialOutMotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for motor speed error condition. static U32 errorDialOutRotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for rotor speed error condition. -static DIAL_OUT_PUMP_SELF_TEST_STATE_T dialOutPumpSelfTestState = DIAL_OUT_PUMP_SELF_TEST_STATE_START; ///< Current state of the dialysate outlet pump self test state machine. -static U32 dialOutPumpSelfTestTimerCount = 0; ///< Timer counter for time reference during self test. +static DIAL_OUT_PUMP_SELF_TEST_STATE_T dialOutPumpSelfTestState = DIAL_OUT_PUMP_SELF_TEST_STATE_START; ///< Current state of the dialysate outlet pump self-test state machine. +static U32 dialOutPumpSelfTestTimerCount = 0; ///< Timer counter for time reference during self-test. // Broadcasting record DIAL_OUT_FLOW_DATA_T dialOutBroadCastVariables; ///< Record containing latest dialysate outlet data for broadcasting. @@ -224,14 +222,14 @@ /*********************************************************************//** * @brief - * The setDialOutPumpTargetRate function sets a new target flow rate, pump \n + * The setDialOutPumpTargetRate function sets a new target flow rate, pump * direction, and control mode. * @details * Inputs : isDialOutPumpOn, dialOutPumpDirectionSet * Outputs : targetDialOutFlowRate, dialOutPumpdirection, dialOutPumpPWMDutyCyclePct - * @param flowRate : new target dialysate outlet flow rate - * @param dir : new dialysate outlet flow direction - * @param mode : new control mode + * @param flowRate new target dialysate outlet flow rate + * @param dir new dialysate outlet flow direction + * @param mode new control mode * @return TRUE if new flow rate & dir are set, FALSE if not *************************************************************************/ BOOL setDialOutPumpTargetRate( U32 flowRate, MOTOR_DIR_T dir, PUMP_CONTROL_MODE_T mode ) @@ -244,8 +242,12 @@ // verify flow rate if ( flowRate <= MAX_DIAL_OUT_FLOW_RATE ) { - F32 adjFlow = (F32)flowRate * DPO_FLOW_ADJ_DUE_TO_HIGHER_INLET_PRES; + F32 adjFlow = (F32)flowRate; + if ( PUMP_CONTROL_MODE_CLOSED_LOOP == mode ) + { + adjFlow *= DPO_FLOW_ADJ_DUE_TO_HIGHER_INLET_PRES; + } lastGivenRate = flowRate; dialOutPumpDirection = dir; dialOutPumpControlMode = mode; @@ -284,7 +286,7 @@ } else // requested flow rate too high { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_SET_TOO_HIGH, flowRate ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_SET_TOO_HIGH, flowRate ) } } @@ -293,13 +295,13 @@ /*********************************************************************//** * @brief - * The setDialOutUFVolumes function sets the ultrafiltration reference and \n + * The setDialOutUFVolumes function sets the ultrafiltration reference and * measured total volumes (in mL). * @details * Inputs : none * Outputs : referenceUFVolumeInMl and totalMeasuredUFVolumeInMl - * @param refVol : New ultrafiltration reference volume (in mL). - * @param totVol : New ultrafiltration total volume (in mL). + * @param refVol New ultrafiltration reference volume (in mL) + * @param totVol New ultrafiltration total volume (in mL) * @return none *************************************************************************/ void setDialOutUFVolumes( F32 refVol, F32 totVol ) @@ -310,7 +312,7 @@ /*********************************************************************//** * @brief - * The signalDialOutPumpHardStop function stops the dialysate outlet pump \n + * The signalDialOutPumpHardStop function stops the dialysate outlet pump * immediately. * @details * Inputs : none @@ -329,8 +331,8 @@ /*********************************************************************//** * @brief - * The signalDialOutPumpRotorHallSensor function handles the dialysate outlet \n - * pump rotor hall sensor detection. Calculates rotor speed (in RPM). \n + * The signalDialOutPumpRotorHallSensor function handles the dialysate outlet + * pump rotor hall sensor detection. Calculates rotor speed (in RPM). * Stops pump if there is a pending request to home the pump. * @details * Inputs : dopRotorRevStartTime, dopStopAtHomePosition @@ -378,15 +380,15 @@ /*********************************************************************//** * @brief - * The setDialOutUFVolumes function sets the ultrafiltration reference and \n + * The setDialOutUFVolumes function sets the ultrafiltration reference and * measured total volumes (in mL). * @details * Inputs : none * Outputs : loadCellWeightInGrams[] - * @param res1Primary : New weight from primary load cell of reservoir 1. - * @param res1Backup : New weight from backup load cell of reservoir 1. - * @param res2Primary : New weight from primary load cell of reservoir 2. - * @param res2Backup : New weight from backup load cell of reservoir 2. + * @param res1Primary New weight from primary load cell of reservoir 1 + * @param res1Backup New weight from backup load cell of reservoir 1 + * @param res2Primary New weight from primary load cell of reservoir 2 + * @param res2Backup New weight from backup load cell of reservoir 2 * @return TRUE if successful, FALSE if not *************************************************************************/ BOOL setNewLoadCellReadings( F32 res1Primary, F32 res1Backup, F32 res2Primary, F32 res2Backup ) @@ -402,9 +404,9 @@ } /*********************************************************************//** - * @brief execDialOutFlowMonitor - * The execDialOutFlowMonitor function executes the dialysate outlet pump \n - * and load cell sensor monitor. Checks are performed. Data is published \n + * @brief + * The execDialOutFlowMonitor function executes the dialysate outlet pump + * and load cell sensor monitor. Checks are performed. Data is published * at appropriate interval. * @details * Inputs : latest sensor data @@ -439,8 +441,8 @@ } /*********************************************************************//** - * @brief execDialOutFlowController - * The execDialOutFlowController function executes the dialysate outlet pump \n + * @brief + * The execDialOutFlowController function executes the dialysate outlet pump * ultrafiltration controller state machine. * @details * Inputs : dialOutPumpState @@ -468,14 +470,14 @@ break; default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_INVALID_DIAL_OUT_PUMP_STATE, dialOutPumpState ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_INVALID_DIAL_OUT_PUMP_STATE, dialOutPumpState ); break; } } /*********************************************************************//** - * @brief handleDialOutPumpOffState - * The handleDialOutPumpOffState function handles the dialOut pump off state \n + * @brief + * The handleDialOutPumpOffState function handles the dialOut pump off state * of the dialOut pump controller state machine. * @details * Inputs : targetDialOutFlowRate, dialOutPumpDirection @@ -507,8 +509,8 @@ } /*********************************************************************//** - * @brief handleDialOutPumpRampingUpState - * The handleDialOutPumpRampingUpState function handles the ramp up state \n + * @brief + * The handleDialOutPumpRampingUpState function handles the ramp up state * of the dialOut pump controller state machine. * @details * Inputs : dialOutPumpPWMDutyCyclePctSet @@ -551,8 +553,8 @@ } /*********************************************************************//** - * @brief handleDialOutPumpRampingDownState - * The handleDialOutPumpRampingDownState function handles the ramp down state \n + * @brief + * The handleDialOutPumpRampingDownState function handles the ramp down state * of the dialOut pump controller state machine. * @details * Inputs : dialOutPumpPWMDutyCyclePctSet @@ -593,8 +595,8 @@ } /*********************************************************************//** - * @brief handleDialOutPumpControlToTargetState - * The handleDialOutPumpControlToTargetState function handles the "control to \n + * @brief + * The handleDialOutPumpControlToTargetState function handles the "control to * target" state of the dialOut pump controller state machine. * @details * Inputs : dopControlTimerCounter, dialOutPumpControlModeSet, volumes. @@ -619,7 +621,7 @@ newPWM = runPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, refVol, totVol ); // limit PWM change to max deltaPWM = newPWM - dialOutPumpPWMDutyCyclePctSet; - if ( FABS( deltaPWM ) > MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE ) + if ( fabs( deltaPWM ) > MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE ) { newPWM = ( deltaPWM < 0.0 ? dialOutPumpPWMDutyCyclePctSet - MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE : dialOutPumpPWMDutyCyclePctSet + MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE ); } @@ -635,12 +637,12 @@ /*********************************************************************//** * @brief - * The setDialOutPumpControlSignalPWM function set the PWM duty cycle of \n + * The setDialOutPumpControlSignalPWM function set the PWM duty cycle of * the dialysate outlet pump to a given %. * @details * Inputs : none * Outputs : dialysis outlet pump PWM duty cycle is set. - * @param newPWM : A percentage duty cycle between 0.0 and 1.0. + * @param newPWM A percentage duty cycle between 0.0 and 1.0 * @return none *************************************************************************/ static void setDialOutPumpControlSignalPWM( F32 newPWM ) @@ -649,8 +651,8 @@ } /*********************************************************************//** - * @brief stopDialOutPump - * The stopDialOutPump function sets the dialout flow stop signal and PWM \n + * @brief + * The stopDialOutPump function sets the dialout flow stop signal and PWM * duty cycle to 0.0. * @details * Inputs : none @@ -680,12 +682,12 @@ /*********************************************************************//** * @brief - * The setDialOutPumpDirection function sets the set dialOut pump direction to \n + * The setDialOutPumpDirection function sets the set dialOut pump direction to * the given direction. * @details * Inputs : none * Outputs : dialOutPumpDirectionSet, pump direction signal set to match given direction. - * @param dir : dialysate outlet pump direction to set + * @param dir dialysate outlet pump direction to set * @return none *************************************************************************/ static void setDialOutPumpDirection( MOTOR_DIR_T dir ) @@ -703,14 +705,14 @@ break; default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_INVALID_DIAL_OUT_PUMP_DIRECTION, dir ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_INVALID_DIAL_OUT_PUMP_DIRECTION, dir ); break; } } /*********************************************************************//** * @brief - * The publishDialOutFlowData function publishes dialysate outlet data at \n + * The publishDialOutFlowData function publishes dialysate outlet data at * the set interval. * @details * Inputs : Dialysate outlet pump data @@ -724,11 +726,7 @@ { dialOutBroadCastVariables.refUFVolMl = getTotalTargetDialOutUFVolumeInMl(); dialOutBroadCastVariables.measUFVolMl = getTotalMeasuredUFVolumeInMl(); -#ifndef SHOW_LOAD_CELL_IN_ROTOR_RPM dialOutBroadCastVariables.measRotSpdRPM = getMeasuredDialOutPumpRotorSpeed(); -#else - dialOutBroadCastVariables.measRotSpdRPM = getLoadCellWeightInGrams( LOAD_CELL_RESERVOIR_1_PRIMARY ); -#endif dialOutBroadCastVariables.measSpdRPM = getMeasuredDialOutPumpSpeed(); dialOutBroadCastVariables.measMCSpdRPM = getMeasuredDialOutPumpMCSpeed(); dialOutBroadCastVariables.measMCCurrmA = getMeasuredDialOutPumpMCCurrent(); @@ -741,8 +739,8 @@ /*********************************************************************//** * @brief - * The updateDialOutPumpSpeedAndDirectionFromHallSensors function calculates \n - * the dialysate outlet pump motor speed and direction from hall sensor counter on \n + * The updateDialOutPumpSpeedAndDirectionFromHallSensors function calculates + * the dialysate outlet pump motor speed and direction from hall sensor counter on * a 1 second interval. * @details * Inputs : dopLastMotorHallSensorCount, dopMotorSpeedCalcTimerCtr, current count from FPGA @@ -780,8 +778,8 @@ /*********************************************************************//** * @brief - * The checkDialOutPumpRotor function checks the rotor for the dialysate outlet \n - * pump. If homing, this function will stop when hall sensor detected. If pump \n + * The checkDialOutPumpRotor function checks the rotor for the dialysate outlet + * pump. If homing, this function will stop when hall sensor detected. If pump * is off or running very slowly, rotor speed will be set to zero. * @details * Inputs : dopStopAtHomePosition, dopHomeStartTime, dopRotorRevStartTime @@ -807,7 +805,7 @@ /*********************************************************************//** * @brief - * The checkDialOutPumpDirection function checks the set direction vs. \n + * The checkDialOutPumpDirection function checks the set direction vs. * the direction implied by the sign of the measured MC speed. * @details * Inputs : adcDialOutPumpMCSpeedRPM, dialOutPumpDirectionSet, dialOutPumpState @@ -833,11 +831,11 @@ /*********************************************************************//** * @brief - * The checkDialOutPumpSpeeds function checks several aspects of the dialysate \n - * outlet pump speed. \n - * 1. while pump is commanded off, measured motor speed should be < limit. \n - * 2. while pump is controlling, measured motor speed should be within allowed range of measured motor controller speed. \n - * 3. measured motor speed should be within allowed range of measured rotor speed. \n + * The checkDialOutPumpSpeeds function checks several aspects of the dialysate + * outlet pump speed. + * 1. while pump is commanded off, measured motor speed should be < limit. + * 2. while pump is controlling, measured motor speed should be within allowed range of measured motor controller speed. + * 3. measured motor speed should be within allowed range of measured rotor speed. * All 3 checks have a persistence time that must be met before an alarm is triggered. * @details * Inputs : targetDialOutFlowRate, dialOutPumpSpeedRPM, dialOutPumpRotorSpeedRPM @@ -873,10 +871,10 @@ if ( DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE == dialOutPumpState ) { F32 controllerMotorSpeed = getMeasuredDialOutPumpMCSpeed(); - F32 deltaMotorSpeed = FABS( measMotorSpeed - controllerMotorSpeed ); + F32 deltaMotorSpeed = fabs( measMotorSpeed - controllerMotorSpeed ); F32 measRotorSpeed = getMeasuredDialOutPumpRotorSpeed(); F32 measMotorSpeedInRotorRPM = measMotorSpeed / DOP_GEAR_RATIO; - F32 deltaRotorSpeed = FABS( measRotorSpeed - measMotorSpeedInRotorRPM ); + F32 deltaRotorSpeed = fabs( measRotorSpeed - measMotorSpeedInRotorRPM ); // check measured motor speed vs. commanded motor speed while controlling to target if ( deltaMotorSpeed > DOP_MAX_MOTOR_SPEED_ERROR_RPM ) @@ -918,7 +916,7 @@ /*********************************************************************//** * @brief - * The checkDialOutPumpMCCurrent function checks the measured MC current vs. \n + * The checkDialOutPumpMCCurrent function checks the measured MC current vs. * the set state of the dialOut pump (stopped or running). * @details * Inputs : dialOutPumpState, dopCurrErrorDurationCtr, adcDialOutPumpMCCurrentmA @@ -976,7 +974,7 @@ /*********************************************************************//** * @brief - * The getPublishDialOutFlowDataInterval function gets the dialysate out flow \n + * The getPublishDialOutFlowDataInterval function gets the dialysate out flow * data publication interval. * @details * Inputs : dialOutDataPublishInterval @@ -1001,14 +999,14 @@ * @details * Inputs : loadCellWeightInGrams * Outputs : none - * @param loadCellID : ID of load cell to get + * @param loadCellID ID of load cell to get * @return the current load cell weight in grams *************************************************************************/ F32 getLoadCellWeightInGrams( U32 loadCellID ) { F32 result = 0.0; - if ( loadCellID <= NUM_OF_LOAD_CELLS - 1 ) + if ( loadCellID < NUM_OF_LOAD_CELLS ) { if ( OVERRIDE_KEY == loadCellWeightInGrams[ loadCellID ].override ) { @@ -1021,7 +1019,7 @@ } else { - activateAlarmNoData( ALARM_ID_SOFTWARE_FAULT ); + activateAlarmNoData( ALARM_ID_HD_SOFTWARE_FAULT ); } return result; @@ -1069,7 +1067,7 @@ /*********************************************************************//** * @brief - * The getMeasuredDialOutPumpRotorSpeed function gets the measured dialysate \n + * The getMeasuredDialOutPumpRotorSpeed function gets the measured dialysate * outlet pump rotor speed. * @details * Inputs : dialOutPumpRotorSpeedRPM @@ -1090,7 +1088,7 @@ /*********************************************************************//** * @brief - * The getMeasuredDialOutPumpSpeed function gets the measured dialysate outlet \n + * The getMeasuredDialOutPumpSpeed function gets the measured dialysate outlet * pump motor speed. * @details * Inputs : dialOutPumpSpeedRPM @@ -1111,7 +1109,7 @@ /*********************************************************************//** * @brief - * The getMeasuredDialOutPumpMCSpeed function gets the measured dialOut pump \n + * The getMeasuredDialOutPumpMCSpeed function gets the measured dialOut pump * speed. * @details * Inputs : dialOutPumpMCSpeedRPM @@ -1132,7 +1130,7 @@ /*********************************************************************//** * @brief - * The getMeasuredDialOutPumpMCCurrent function gets the measured dialOut pump \n + * The getMeasuredDialOutPumpMCCurrent function gets the measured dialOut pump * current. * @details * Inputs : dialOutPumpMCCurrentmA @@ -1159,12 +1157,12 @@ /*********************************************************************//** * @brief - * The testSetDialOutPumpAndLoadCellDataPublishIntervalOverride function overrides the \n + * The testSetDialOutPumpAndLoadCellDataPublishIntervalOverride function overrides the * dialout data publish interval. * @details * Inputs : none * Outputs : dialOutDataPublishInterval - * @param value : override dialout data publish interval with (in ms) + * @param value override dialout data publish interval with (in ms) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetDialOutPumpAndLoadCellDataPublishIntervalOverride( U32 value ) @@ -1185,12 +1183,12 @@ /*********************************************************************//** * @brief - * The testResetDialOutPumpAndLoadCellDataPublishIntervalOverride function resets the override \n + * The testResetDialOutPumpAndLoadCellDataPublishIntervalOverride function resets the override * of the dialout data publish interval. * @details * Inputs : none * Outputs : dialOutDataPublishInterval - * @return TRUE if reset reset successful, FALSE if not + * @return TRUE if reset override successful, FALSE if not *************************************************************************/ BOOL testResetDialOutPumpAndLoadCellDataPublishIntervalOverride( void ) { @@ -1208,12 +1206,69 @@ /*********************************************************************//** * @brief - * The testSetDialOutUFRefVolumeOverride function overrides the target \n + * The testSetTargetDialOutFlowRateOverride function overrides the target + * 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 + * 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 * dialout vol rate. * @details * Inputs : referenceUFVolumeInMl * Outputs : referenceUFVolumeInMl - * @param value : override target dialout vol rate (in mL/min) + * @param value override target dialout vol rate (in mL/min) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetDialOutUFRefVolumeOverride( F32 value ) @@ -1232,12 +1287,12 @@ /*********************************************************************//** * @brief - * The testResetDialOutUFRefVolumeOverride function resets the override of the \n + * The testResetDialOutUFRefVolumeOverride function resets the override of the * target dialout vol rate. * @details * Inputs : referenceUFVolumeInMl * Outputs : referenceUFVolumeInMl - * @return TRUE if reset reset successful, FALSE if not + * @return TRUE if reset override successful, FALSE if not *************************************************************************/ BOOL testResetDialOutUFRefVolumeOverride( void ) { @@ -1255,12 +1310,12 @@ /*********************************************************************//** * @brief - * The testSetDialOutUFTotVolumeOverride function overrides the measured \n + * The testSetDialOutUFTotVolumeOverride function overrides the measured * dialout vol rate. * @details * Inputs : totalMeasuredUFVolumeInMl * Outputs : totalMeasuredUFVolumeInMl - * @param value : override measured dialout vol rate (in mL/min) + * @param value override measured dialout vol rate (in mL/min) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetDialOutUFTotVolumeOverride( F32 value ) @@ -1279,12 +1334,12 @@ /*********************************************************************//** * @brief - * The testResetDialOutUFTotVolumeOverride function resets the override of the \n + * The testResetDialOutUFTotVolumeOverride function resets the override of the * measured dialout vol rate. * @details * Inputs : totalMeasuredUFVolumeInMl * Outputs : totalMeasuredUFVolumeInMl - * @return TRUE if reset reset successful, FALSE if not + * @return TRUE if reset override successful, FALSE if not *************************************************************************/ BOOL testResetDialOutUFTotVolumeOverride( void ) { @@ -1302,12 +1357,12 @@ /*********************************************************************//** * @brief - * The testSetMeasuredDialOutPumpRotorSpeedOverride function overrides the measured \n + * The testSetMeasuredDialOutPumpRotorSpeedOverride function overrides the measured * dialOut pump rotor speed. * @details * Inputs : DialOutPumpRotorSpeedRPM * Outputs : DialOutPumpRotorSpeedRPM - * @param value : override measured dialOut pump rotor speed (in RPM) + * @param value override measured dialOut pump rotor speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetMeasuredDialOutPumpRotorSpeedOverride( F32 value ) @@ -1326,12 +1381,12 @@ /*********************************************************************//** * @brief - * The testResetMeasuredDialOutPumpRotorSpeedOverride function resets the override of the \n + * The testResetMeasuredDialOutPumpRotorSpeedOverride function resets the override of the * measured dialOut pump rotor speed. * @details * Inputs : DialOutPumpRotorSpeedRPM * Outputs : DialOutPumpRotorSpeedRPM - * @return TRUE if reset reset successful, FALSE if not + * @return TRUE if reset override successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialOutPumpRotorSpeedOverride( void ) { @@ -1349,12 +1404,12 @@ /*********************************************************************//** * @brief - * The testSetMeasuredDialOutPumpSpeedOverride function overrides the measured \n + * The testSetMeasuredDialOutPumpSpeedOverride function overrides the measured * dialOut pump motor speed. * @details * Inputs : dialOutPumpSpeedRPM * Outputs : dialOutPumpSpeedRPM - * @param value : override measured dialOut pump motor speed (in RPM) + * @param value override measured dialOut pump motor speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetMeasuredDialOutPumpSpeedOverride( F32 value ) @@ -1373,12 +1428,12 @@ /*********************************************************************//** * @brief - * The testResetMeasuredDialOutPumpSpeedOverride function resets the override of the \n + * The testResetMeasuredDialOutPumpSpeedOverride function resets the override of the * measured dialOut pump motor speed. * @details * Inputs : dialOutPumpSpeedRPM * Outputs : dialOutPumpSpeedRPM - * @return TRUE if reset reset successful, FALSE if not + * @return TRUE if reset override successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialOutPumpSpeedOverride( void ) { @@ -1396,12 +1451,12 @@ /*********************************************************************//** * @brief - * The testSetMeasuredDialOutPumpMCSpeedOverride function overrides the measured \n + * The testSetMeasuredDialOutPumpMCSpeedOverride function overrides the measured * dialOut pump motor speed. * @details * Inputs : dialOutPumpMCSpeedRPM * Outputs : dialOutPumpMCSpeedRPM - * @param value : override measured dialOut pump speed (in RPM) + * @param value override measured dialOut pump speed (in RPM) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetMeasuredDialOutPumpMCSpeedOverride( F32 value ) @@ -1420,12 +1475,12 @@ /*********************************************************************//** * @brief - * The testResetMeasuredDialOutPumpMCSpeedOverride function resets the override of the \n + * The testResetMeasuredDialOutPumpMCSpeedOverride function resets the override of the * measured dialOut pump motor speed. * @details * Inputs : dialOutPumpMCSpeedRPM * Outputs : dialOutPumpMCSpeedRPM - * @return TRUE if reset reset successful, FALSE if not + * @return TRUE if reset override successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialOutPumpMCSpeedOverride( void ) { @@ -1443,12 +1498,12 @@ /*********************************************************************//** * @brief - * The testSetMeasuredDialOutPumpMCCurrentOverride function overrides the measured \n + * The testSetMeasuredDialOutPumpMCCurrentOverride function overrides the measured * dialOut pump motor current. * @details * Inputs : dialOutPumpMCCurrentmA * Outputs : dialOutPumpMCCurrentmA - * @param value : override measured dialOut pump current (in mA) + * @param value override measured dialOut pump current (in mA) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetMeasuredDialOutPumpMCCurrentOverride( F32 value ) @@ -1467,12 +1522,12 @@ /*********************************************************************//** * @brief - * The testResetMeasuredDialOutPumpMCCurrentOverride function resets the override of the \n + * The testResetMeasuredDialOutPumpMCCurrentOverride function resets the override of the * measured dialOut pump motor current. * @details * Inputs : dialOutPumpMCCurrentmA * Outputs : dialOutPumpMCCurrentmA - * @return TRUE if reset reset successful, FALSE if not + * @return TRUE if reset override successful, FALSE if not *************************************************************************/ BOOL testResetMeasuredDialOutPumpMCCurrentOverride( void ) { @@ -1490,13 +1545,13 @@ /*********************************************************************//** * @brief - * The testSetDialOutLoadCellWeightOverride function overrides the value of the \n + * The testSetDialOutLoadCellWeightOverride function overrides the value of the * load cell sensor with a given weight (in grams). * @details * Inputs : loadCellWeightInGrams[] * Outputs : loadCellWeightInGrams[] - * @param sensor : ID of load cell sensor to override weight for - * @param value : override weight (in grams) for the given sensor + * @param sensor ID of load cell sensor to override weight for + * @param value override weight (in grams) for the given sensor * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetDialOutLoadCellWeightOverride( U32 sensor, F32 value ) @@ -1518,12 +1573,12 @@ /*********************************************************************//** * @brief - * The testResetDialOutLoadCellWeightOverride function resets the override of the \n + * The testResetDialOutLoadCellWeightOverride function resets the override of the * load cell sensor. * @details * Inputs : loadCellWeightInGrams[] * Outputs : loadCellWeightInGrams[] - * @param sensor : ID of load cell sensor to override weight for + * @param sensor ID of load cell sensor to override weight for * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetDialOutLoadCellWeightOverride( U32 sensor )