Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r70fe39f8fad7b62acc0e0f9cc53881b49653dbbe -rf18ceef65c96d9f1cd5464cf63e91c4d5a391ede --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 70fe39f8fad7b62acc0e0f9cc53881b49653dbbe) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision f18ceef65c96d9f1cd5464cf63e91c4d5a391ede) @@ -7,8 +7,8 @@ * * @file SelfTests.c * -* @author (last) Darren Cox -* @date (last) 28-Jun-2023 +* @author (last) Sean Nash +* @date (last) 05-Jul-2023 * * @author (original) Quang Nguyen * @date (original) 28-Jan-2021 @@ -130,8 +130,9 @@ static U32 bloodLeakDebubbleStartTimeMS; ///< Blood leak detector debubble start time in milliseconds. static BOOL useHeparin; ///< Flag indicates the user of heparin. - static BOOL selfTestsResumeRequested; ///< Flag indicates user requesting self-tests resume. +static BOOL cartridgeUsedTestRun; ///< Flag indicates whether the used cartridge test has been run. +static BOOL doorStateAfterCartridgeInstall; ///< Flag indicates state of front door for saline clamp check after cartridge installed. // ********** private function prototypes ********** @@ -188,6 +189,7 @@ selfTestStartTime = 0; selfTestPreviousPublishDataTime = 0; syringeOcclusionDelayStartTime = 0; + doorStateAfterCartridgeInstall = TRUE; } /*********************************************************************//** @@ -421,6 +423,7 @@ previousNormalArterialPressure = 0.0; previousNormalVenousPressure = 0.0; dryPressureTestsCompleted = FALSE; + cartridgeUsedTestRun = FALSE; selfTestStartTime = getMSTimerCount(); selfTestPreviousPublishDataTime = getMSTimerCount(); selfTestCartridgeSettleTime = getMSTimerCount(); @@ -436,7 +439,14 @@ setValveAirTrap( STATE_CLOSED ); setValvePosition( VDI, VALVE_POSITION_A_INSERT_EJECT ); setValvePosition( VDO, VALVE_POSITION_A_INSERT_EJECT ); - setValvePosition( VBA, VALVE_POSITION_A_INSERT_EJECT ); + if ( STATE_CLOSED == getSwitchStatus( FRONT_DOOR ) ) + { + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + } + else + { + setValvePosition( VBA, VALVE_POSITION_A_INSERT_EJECT ); + } setValvePosition( VBV, VALVE_POSITION_A_INSERT_EJECT ); resetSelfTestsFlags(); @@ -939,6 +949,8 @@ DRY_SELF_TESTS_STATE_T state = DRY_SELF_TESTS_START_STATE; OPN_CLS_STATE_T pumpTrack = getSwitchStatus( PUMP_TRACK_SWITCH ); + handleDoorCloseAfterCartridgeInsertion(); // want to pinch off saline once door closed after cartridge install + if ( STATE_CLOSED == pumpTrack ) { // Ensure occlusion sensor has time to settle after cartridge insertion before starting dry self-tests @@ -984,7 +996,7 @@ state = DRY_SELF_TESTS_USED_CARTRIDGE_CHECK_STATE; setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); - setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); } @@ -1024,6 +1036,7 @@ { // If either of the test configurations are set go to loaded check state = DRY_SELF_TESTS_CARTRIDGE_LOADED_CHECK_STATE; + cartridgeUsedTestRun = TRUE; } else { @@ -1537,7 +1550,15 @@ else { doorClosedRequired( FALSE, TRUE ); - state = DRY_SELF_TESTS_START_STATE; + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + if ( TRUE == cartridgeUsedTestRun ) + { + state = DRY_SELF_TESTS_CARTRIDGE_LOADED_CHECK_STATE; + } + else + { + state = DRY_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE; + } } } @@ -2072,4 +2093,29 @@ return state; } +/*********************************************************************//** + * @brief + * The handleDoorCloseAfterCartridgeInsertion function handles the check + * for door close after cartridge install so that saline line can be pinched. + * @details Inputs: door and latch states, doorStateAfterCartridgeInstall + * @details Outputs: doorStateAfterCartridgeInstall + * @return none + *************************************************************************/ +void handleDoorCloseAfterCartridgeInsertion( void ) +{ + OPN_CLS_STATE_T frontDoor = getSwitchStatus( FRONT_DOOR ); + OPN_CLS_STATE_T pumpTrack = getSwitchStatus( PUMP_TRACK_SWITCH ); + + if ( ( STATE_OPEN == frontDoor ) && ( TRUE == doorStateAfterCartridgeInstall ) ) + { + doorStateAfterCartridgeInstall = FALSE; + } + // when transitioning from door open to door closed, pinch off saline bag to prevent saline from running up the line + if ( ( STATE_CLOSED == frontDoor ) && ( STATE_CLOSED == pumpTrack ) && ( FALSE == doorStateAfterCartridgeInstall ) ) + { + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + doorStateAfterCartridgeInstall = TRUE; + } +} + /**@}*/