Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r2ecbac1618a09e6992889283cef6190cae8d7f7a -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 2ecbac1618a09e6992889283cef6190cae8d7f7a) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2021-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file SelfTests.c * -* @author (last) Michael Garthwaite -* @date (last) 08-Aug-2023 +* @author (last) Bill Bracken +* @date (last) 18-Oct-2023 * * @author (original) Quang Nguyen * @date (original) 28-Jan-2021 @@ -43,8 +43,8 @@ #define PUMP_RUN_SELF_TEST_TIME_MS ( 15 * MS_PER_SECOND ) ///< Self-test time to run pumps in ms. #define PUMP_SELF_TEST_FLOW_RATE_ML_MIN 100 ///< Self-test pump flow rate in mL/min. -#define BLOOD_PUMP_PRESSURE_SELF_TEST_FLOW 100 -#define DIAL_IN_PUMP_PRESSURE_SELF_TEST_FLOW 400 +#define BLOOD_PUMP_PRESSURE_SELF_TEST_FLOW 100 ///< Pressure self-test BP flow rate in mL/min. +#define DIAL_IN_PUMP_PRESSURE_SELF_TEST_FLOW 400 ///< Pressure self-test DPi flow rate in mL/min. #define SYRINGE_PUMP_OCCLUSION_CHECK_DELAY ( 1 * MS_PER_SECOND ) ///< Delay 1 second then check for syringe pump prime occlusion. #define PRE_NORMAL_PRESSURE_SELF_TEST_DELAY_MS ( 5 * MS_PER_SECOND ) ///< Delay 5 second prior to getting initial normal baseline pressures. @@ -221,7 +221,7 @@ * @brief * The setupForSelfTestsStop function sets actuators appropriately for self-tests * states. - * @details Inputs: none + * @details Inputs: dryPressureTestsCompleted, PreTreatmentSubState * @details Outputs: All pumps stopped * @return none *************************************************************************/ @@ -243,9 +243,21 @@ setValvePosition( VDI, VALVE_POSITION_A_INSERT_EJECT ); setValvePosition( VDO, VALVE_POSITION_A_INSERT_EJECT ); - setValvePosition( VBA, VALVE_POSITION_A_INSERT_EJECT ); setValvePosition( VBV, VALVE_POSITION_A_INSERT_EJECT ); - setValveAirTrap( STATE_CLOSED ); + + // If the HD has finished no cart s.t. but not dry pressure tests, Open VBT to vent pressure + // to prevent air going to the Saline bag. + if ( ( HD_PRE_TREATMENT_SELF_TEST_DRY_STATE == getPreTreatmentSubState() ) && ( FALSE == dryPressureTestsCompleted ) ) + { + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + setValveAirTrap( STATE_OPEN ); + } + + else + { + setValvePosition( VBA, VALVE_POSITION_A_INSERT_EJECT ); + setValveAirTrap( STATE_CLOSED ); + } } /*********************************************************************//** @@ -1601,6 +1613,17 @@ checkForSyringeOcclusion( FALSE ); } + // Set VBA to Pos A and close VBT after we have + // depressurized the line from failed pressure self tests. + if ( FALSE == dryPressureTestsCompleted ) + { + if ( getFilteredVenousPressure() <= NORMAL_PRESSURE_DIFF_TOLERANCE_MMHG ) + { + setValvePosition( VBA, VALVE_POSITION_A_INSERT_EJECT ); + setValveAirTrap( STATE_CLOSED ); + } + } + // if resume request, resume dry self-tests if ( TRUE == selfTestsResumeRequested ) { @@ -1660,9 +1683,9 @@ setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); // if user set a Heparin bolus volume, request bolus to be initiated now - if ( ( bolusVol > 0.0F ) && ( getSyringePumpVolumeDelivered() < bolusVol ) ) + if ( bolusVol > 0.0F ) { - startHeparinBolus(); // moved here from startHeparinPump() in Dialysis.c + startHeparinBolus(); // Function will only start bolus if necessary } if ( TRUE == doesAlarmStatusIndicateStop() ) @@ -1831,6 +1854,7 @@ { if ( TRUE == hasBloodLeakZeroSequenceFailed() ) { + zeroBloodLeakReset(); #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_BLOOD_LEAK_ALARM ) != SW_CONFIG_ENABLE_VALUE ) #endif @@ -2177,6 +2201,7 @@ static WET_SELF_TESTS_STATE_T handleWetSelfTestStoppedState( void ) { WET_SELF_TESTS_STATE_T state = WET_SELF_TESTS_STOPPED_STATE; + F32 bolusVol = getTreatmentParameterF32( TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME ); setAlarmResumePerDoorAndLatch(); doorClosedRequired( FALSE, FALSE ); @@ -2195,6 +2220,12 @@ doorClosedRequired( TRUE, TRUE ); selfTestsResumeRequested = FALSE; + // if user set a Heparin bolus volume, request bolus to be initiated now + if ( bolusVol > 0.0F ) + { + startHeparinBolus(); // Function will only start bolus if necessary + } + switch( checkpointWetSelfTestsState ) { case WET_SELF_TESTS_BUBBLE_CHECK_SETUP_STATE: