Index: firmware/App/Modes/TreatmentEnd.c =================================================================== diff -u -r48fda88cb7d8607181efb80f98deaaab1b343a92 -r0b8564de1aeab98438bd2e4e1b666d77b4d506df --- firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 48fda88cb7d8607181efb80f98deaaab1b343a92) +++ firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 0b8564de1aeab98438bd2e4e1b666d77b4d506df) @@ -20,6 +20,7 @@ #include "DialInFlow.h" #include "DialOutFlow.h" #include "ModeTreatment.h" +#include "ModeTreatmentParams.h" #include "OperationModes.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" @@ -36,8 +37,6 @@ /// Interval at which treatment end progress is to be published to UI. #define TREATMENT_END_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) -/// Target flow rate for blood while waiting for user to initiate final rinseback. -#define TX_END_BP_FLOW_RATE_ML_MIN 150 /// Max time to wait for user to initiate final rinseback. static const U32 TX_END_TIMEOUT_MS = ( ( 10 * 60 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ); @@ -55,6 +54,7 @@ static BOOL txEndDrainCmdSent; ///< Flag indicates DG Drain command has been sent. static U32 treatmentEndPublishTimerCtr; ///< Timer counter for determining interval for treatment end status to be published. static BOOL airTrapFillInProgress; ///< Flag indicates an air trap fill is in progress. +static U32 txEndTargetBloodFlowMLPM; ///< Treatment end target blood flow in mL/min. // ********** private function prototypes ********** @@ -86,6 +86,12 @@ txEndDrainCmdSent = FALSE; resetTreatmentEndFlags(); airTrapFillInProgress = FALSE; // set to false initially - so keep after call to reset function + txEndTargetBloodFlowMLPM = getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ); + + if ( getNVInstitutionalRecordTxEndBloodFlowMLPM() != 0 ) + { + txEndTargetBloodFlowMLPM = getNVInstitutionalRecordTxEndBloodFlowMLPM(); + } } /*********************************************************************//** @@ -152,7 +158,7 @@ setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); // Start blood pump at Tx End slow flow rate - setBloodPumpTargetFlowRate( TX_END_BP_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + setBloodPumpTargetFlowRate( txEndTargetBloodFlowMLPM, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); bloodSittingTimerCtr = 0; // Continue air trap leveling control startAirTrapControl(); @@ -288,7 +294,7 @@ // re-open VBV after fill setValvePosition( VBV, VALVE_POSITION_B_OPEN ); // restore BP to Tx End blood flow rate - setBloodPumpTargetFlowRate( TX_END_BP_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + setBloodPumpTargetFlowRate( txEndTargetBloodFlowMLPM, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); } return result;