Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r2a03f6c87706478406a4962d70f5bae2ccb57728 -ra6f84d4a0eda792eed2bd7c48a7b6c6bd5ebf1eb --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 2a03f6c87706478406a4962d70f5bae2ccb57728) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision a6f84d4a0eda792eed2bd7c48a7b6c6bd5ebf1eb) @@ -986,22 +986,40 @@ /*********************************************************************//** * @brief + * The handlePatientConnectionDoorOpened function handles the check + * for door opened in pre-treatment patient connection + * sub-mode. + * @details Inputs: none + * @details Outputs: doorOpened + * @return none + *************************************************************************/ +static void handlePatientConnectionDoorOpened( void ) +{ + // Look for cartridge door to open (indicating user inverting dialyzer) + if ( STATE_OPEN == getSwitchStatus( FRONT_DOOR ) ) + { + doorOpened = TRUE; + cmdStopDGTrimmerHeater(); + signalDialInPumpHardStop(); + } +} + +/*********************************************************************//** + * @brief * The handlePatientConnectionWait4UFVolState function handles the wait * for ultrafiltration volume setting state of pre-treatment patient connection * sub-mode. * @details Inputs: setUFVolStatus - * @details Outputs: setUFVolStatus, doorOpened + * @details Outputs: setUFVolStatus * @return next patient connection state *************************************************************************/ static HD_PRE_TREATMENT_PAT_CONN_STATE_T handlePatientConnectionWait4UFVolState( void ) { HD_PRE_TREATMENT_PAT_CONN_STATE_T nextState = PRE_TREATMENT_PAT_CONN_WAIT_FOR_UF_VOL_STATE; // Look for cartridge door to open (indicating user inverting dialyzer) - if ( STATE_OPEN == getSwitchStatus( FRONT_DOOR ) ) - { - doorOpened = TRUE; - } + handlePatientConnectionDoorOpened(); + // If UF volume set by user, move on to next state if ( TRUE == setUFVolStatus ) { @@ -1018,20 +1036,20 @@ * for dialyzer invert confirmation state of pre-treatment patient connection * sub-mode. * @details Inputs: doorOpened - * @details Outputs: doorOpened + * @details Outputs: none * @return next patient connection state *************************************************************************/ static HD_PRE_TREATMENT_PAT_CONN_STATE_T handlePatientConnectionWait4DialyzerInvertState( void ) { HD_PRE_TREATMENT_PAT_CONN_STATE_T nextState = PRE_TREATMENT_PAT_CONN_WAIT_FOR_DLZR_INVERT_STATE; // Look for cartridge door to open and then close (indicating user inverted dialyzer) - if ( STATE_OPEN == getSwitchStatus( FRONT_DOOR ) ) - { - doorOpened = TRUE; - } + handlePatientConnectionDoorOpened(); + if ( ( TRUE == doorOpened ) && ( STATE_CLOSED == getSwitchStatus( FRONT_DOOR ) ) ) { + setDialInPumpTargetFlowRate( DIP_PATIENT_CONNECTION_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + cmdStartDGTrimmerHeater(); nextState = PRE_TREATMENT_PAT_CONN_WAIT_FOR_USER_CONFIRM_STATE; }