Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r6b9d077b0adab3b771c5fa8ceeb7381ca54b84f5 -r27a68f930508638f2eb6265ebb381c8918cbc37b --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 6b9d077b0adab3b771c5fa8ceeb7381ca54b84f5) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 27a68f930508638f2eb6265ebb381c8918cbc37b) @@ -7,8 +7,8 @@ * * @file SelfTests.c * -* @author (last) Sean Nash -* @date (last) 02-Mar-2022 +* @author (last) Dara Navaei +* @date (last) 31-Mar-2022 * * @author (original) Quang Nguyen * @date (original) 28-Jan-2021 @@ -72,8 +72,6 @@ /// Multiplier to conver flow (mL/min) into volume (mL) for period of general task interval. static const F32 SELF_TEST_FLOW_INTEGRATOR = ( ( 1.0F * TASK_GENERAL_INTERVAL ) / ( SEC_PER_MIN * MS_PER_SECOND ) ); - - // ********** private data ********** static NO_CART_SELF_TESTS_STATE_T currentNoCartSelfTestsState; ///< Current state of the no cartridge self-tests state machine. @@ -637,14 +635,24 @@ static NO_CART_SELF_TESTS_STATE_T handleNoCartSelfTestsWaitForClosedDoor( void ) { NO_CART_SELF_TESTS_STATE_T state = NO_CART_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE; + OPN_CLS_STATE_T frontDoor = getSwitchStatus( FRONT_DOOR ); + OPN_CLS_STATE_T pumpTrack = getSwitchStatus( PUMP_TRACK_SWITCH ); signalBloodPumpHardStop(); signalDialInPumpHardStop(); signalDialOutPumpHardStop(); selfTestStartTime = getMSTimerCount(); +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_SWITCHES_MONITOR ) ) + { + frontDoor = STATE_CLOSED; + pumpTrack = STATE_CLOSED; + } +#endif + // TODO: Use appropriate sensor driver - if ( STATE_CLOSED == getFPGADoorState() ) + if ( ( STATE_CLOSED == frontDoor ) && ( STATE_CLOSED == pumpTrack ) ) { state = NO_CART_SELF_TESTS_OCCLUSION_SENSORS_STATE; } @@ -823,12 +831,22 @@ static DRY_SELF_TESTS_STATE_T handleDrySelfTestWaitForDoorCloseState( void ) { DRY_SELF_TESTS_STATE_T state = DRY_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE; + OPN_CLS_STATE_T frontDoor = getSwitchStatus( FRONT_DOOR ); + OPN_CLS_STATE_T pumpTrack = getSwitchStatus( PUMP_TRACK_SWITCH ); // Restart self-test start time selfTestStartTime = getMSTimerCount(); +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_SWITCHES_MONITOR ) ) + { + frontDoor = STATE_CLOSED; + pumpTrack = STATE_CLOSED; + } +#endif + // TODO: Use appropriate sensor driver - if ( STATE_CLOSED == getFPGADoorState() ) + if (( STATE_CLOSED == frontDoor ) && (STATE_CLOSED == pumpTrack ) ) { state = DRY_SELF_TESTS_USED_CARTRIDGE_CHECK_STATE; setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); @@ -1058,11 +1076,15 @@ if ( TRUE == didTimeout( syringeOcclusionDelayStartTime, SYRINGE_PUMP_OCCLUSION_CHECK_DELAY ) ) { - checkForPrimeOcclusion(); - state = DRY_SELF_TESTS_COMPLETE_STATE; + if ( FALSE == checkForPrimeOcclusion() ) // transition to complete state only when occlusion is removed + { + // clear the occlusion alarm condition to allow user to resume + clearAlarmCondition( ALARM_ID_HD_SYRINGE_PUMP_OCCLUSION ); // Resume option will appear + state = DRY_SELF_TESTS_COMPLETE_STATE; + } } - if ( TRUE == doesAlarmStatusIndicateStop() ) + if ( ( TRUE == doesAlarmStatusIndicateStop() ) && ( FALSE == isAlarmActive( ALARM_ID_HD_SYRINGE_PUMP_OCCLUSION ) ) ) { state = DRY_SELF_TESTS_STOPPED_STATE; setupForSelfTestsStop();