Index: firmware/App/Modes/StatePreTxRecirculate.c =================================================================== diff -u -rc34ad5cb83749cca78001409699a1fecf1436b7f -r71a1673a75d7f63fd29554a8dbbec8daa7bff1ec --- firmware/App/Modes/StatePreTxRecirculate.c (.../StatePreTxRecirculate.c) (revision c34ad5cb83749cca78001409699a1fecf1436b7f) +++ firmware/App/Modes/StatePreTxRecirculate.c (.../StatePreTxRecirculate.c) (revision 71a1673a75d7f63fd29554a8dbbec8daa7bff1ec) @@ -38,8 +38,10 @@ // ********** private definitions ********** -#define PRE_TX_RECIRC_BLOOD_FLOW_RATE_ML_MIN 100 ///< Blood pump flow rate during recirculation in mL/min. -#define RECIRC_MEDIUM_TIME_MS ( 90 * SEC_PER_MIN * MS_PER_SECOND ) ///< Pre-Treatment recirc time before medium priority warning in milliseconds. +#define PRE_TX_RECIRC_INITIAL_BLOOD_FLOW_RATE_ML_MIN 500 ///< Initial blood pump flow rate during recirculation in mL/min. +#define PRE_TX_RECIRC_BLOOD_FLOW_RATE_ML_MIN 300 ///< Blood pump flow rate after the initial recirculation period in mL/min. +#define PRE_TX_RECIRC_INITIAL_BLOOD_FLOW_TIME_MS ( 30 * MS_PER_SECOND ) ///< Initial high blood flow duration in milliseconds. +#define RECIRC_MEDIUM_TIME_MS ( 90 * SEC_PER_MIN * MS_PER_SECOND ) ///< Recirculation time before medium priority warning. /// Enumeration of Pre-Treatment Recirculation sub-states. typedef enum PreTxRecirculate_States @@ -56,6 +58,7 @@ static U32 preTxRecircStartTime; ///< Recirculation start time (ms timer count). static BOOL recircMediumAlarmGiven; ///< Flag indicating medium recirculation alarm has been raised. +static BOOL initialBloodFlowComplete; ///< Flag indicating the initial high blood flow period is complete. // ********** private function prototypes ********** @@ -72,15 +75,16 @@ * @details \b Inputs: none. * @details \b Outputs: currentPreTxRecircState, * recircResumeRequested, preTxRecircStartTime, - * recircMediumAlarmGiven. + * recircMediumAlarmGiven, initialBloodFlowComplete * @return none. *************************************************************************/ void initPreTxRecirculate( void ) { - currentPreTxRecircState = PRE_TX_RECIRCULATE_STATE; - recircResumeRequested = FALSE; - preTxRecircStartTime = getMSTimerCount(); - recircMediumAlarmGiven = FALSE; + currentPreTxRecircState = PRE_TX_RECIRCULATE_STATE; + recircResumeRequested = FALSE; + preTxRecircStartTime = getMSTimerCount(); + recircMediumAlarmGiven = FALSE; + initialBloodFlowComplete = FALSE; } /*********************************************************************//** @@ -181,16 +185,28 @@ * @details \b Alarm: ALARM_ID_TD_PRIME_COMPLETED_MEDIUM if the * recirculation timeout expires. * @details \b Inputs: preTxRecircStartTime, - * recircMediumAlarmGiven. - * @details \b Outputs: recircMediumAlarmGiven. + * recircMediumAlarmGiven, initialBloodFlowComplete + * @details \b Outputs: recircMediumAlarmGiven, initialBloodFlowComplete * @return next Recirculate sub-state. *************************************************************************/ static PRE_TX_RECIRCULATE_STATE_T handlePreTxRecirculateState( void ) { PRE_TX_RECIRCULATE_STATE_T state = PRE_TX_RECIRCULATE_STATE; + if ( ( TRUE != initialBloodFlowComplete ) && + ( TRUE == didTimeout( preTxRecircStartTime, + PRE_TX_RECIRC_INITIAL_BLOOD_FLOW_TIME_MS ) ) ) + { + setBloodPumpTargetFlowRate( PRE_TX_RECIRC_BLOOD_FLOW_RATE_ML_MIN, + MOTOR_DIR_FORWARD, + PUMP_CONTROL_MODE_OPEN_LOOP ); + + initialBloodFlowComplete = TRUE; + } + if ( ( FALSE == recircMediumAlarmGiven ) && - ( TRUE == didTimeout( preTxRecircStartTime, RECIRC_MEDIUM_TIME_MS ) ) ) + ( TRUE == didTimeout( preTxRecircStartTime, + RECIRC_MEDIUM_TIME_MS ) ) ) { recircMediumAlarmGiven = TRUE; activateAlarmNoData( ALARM_ID_TD_PRIME_COMPLETED_MEDIUM ); @@ -249,8 +265,23 @@ retractEjector(); stopSyringePump(); - setBloodPumpTargetFlowRate( PRE_TX_RECIRC_BLOOD_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + if ( ( TRUE == initialBloodFlowComplete ) || + ( TRUE == didTimeout( preTxRecircStartTime, + PRE_TX_RECIRC_INITIAL_BLOOD_FLOW_TIME_MS ) ) ) + { + initialBloodFlowComplete = TRUE; + setBloodPumpTargetFlowRate( PRE_TX_RECIRC_BLOOD_FLOW_RATE_ML_MIN, + MOTOR_DIR_FORWARD, + PUMP_CONTROL_MODE_OPEN_LOOP ); + } + else + { + setBloodPumpTargetFlowRate( PRE_TX_RECIRC_INITIAL_BLOOD_FLOW_RATE_ML_MIN, + MOTOR_DIR_FORWARD, + PUMP_CONTROL_MODE_OPEN_LOOP ); + } + // Direct DD to bypass dialyzer and perform no ultrafiltration cmdBypassDialyzer( TRUE ); cmdChangeQuf( 0.0F );