Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r5b71511ab1de37e47a1cde5d33173144fb9bf25f -rbd08e87721d89f77e00a271828f8dff1e10e549b --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 5b71511ab1de37e47a1cde5d33173144fb9bf25f) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision bd08e87721d89f77e00a271828f8dff1e10e549b) @@ -8,7 +8,7 @@ * @file ModeStandby.c * * @author (last) Sean Nash -* @date (last) 13-Mar-2023 +* @date (last) 15-May-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -146,6 +146,7 @@ resetBloodPumpRotorCount(); resetDialInPumpRotorCount(); resetPreLoadStatus(); + setVenousBubbleDetectionEnabled( FALSE ); // Set user alarm recovery actions allowed in this mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); @@ -197,6 +198,15 @@ handleDisinfectCancel( stop ); + // if no active alarms anymore, restore to default valve states for standby mode + if ( ( FALSE == doesAlarmStatusIndicateStop() ) && ( VALVE_POSITION_C_CLOSE == getValvePosition( VDI ) ) ) + { + 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 ); + } + // State machine to get DG to prep a reservoir so we can start a treatment switch ( currentStandbyState ) { @@ -284,7 +294,7 @@ REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; // Verify HD is in standby mode waiting for treatment start request - if ( ( MODE_STAN != getCurrentOperationMode() ) || ( STANDBY_WAIT_FOR_TREATMENT_STATE != currentStandbyState ) ) + if ( ( MODE_STAN != getCurrentOperationMode() ) || ( STANDBY_WAIT_FOR_TREATMENT_STATE != currentStandbyState ) || ( isPOSTPassed() != TRUE ) ) { rejReason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; } @@ -299,7 +309,7 @@ rejReason = REQUEST_REJECT_REASON_DG_INCOMPATIBLE; } // Verify DG is not busy - else if ( ( DG_MODE_STAN != getDGOpMode() ) || ( DG_STANDBY_MODE_STATE_IDLE != getDGSubMode() ) ) + else if ( ( DG_MODE_STAN != getDGOpMode() ) || ( DG_STANDBY_MODE_STATE_IDLE != getDGSubMode() ) ) // || ( isDGPOSTPassed() != TRUE ) ) // TODO - is DG sending status??? { rejReason = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; } @@ -353,7 +363,27 @@ *************************************************************************/ void signalAlarmActionToStandbyMode( ALARM_ACTION_T action ) { - // Alarm actions not handled in Standby mode + switch ( action ) + { + case ALARM_ACTION_STOP: + // Pumps should be off + signalBloodPumpHardStop(); + signalDialInPumpHardStop(); + signalDialOutPumpHardStop(); + stopSyringePump(); + + // Set valves to safe positions + setValveAirTrap( STATE_CLOSED ); + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); + break; + + default: + // do not handle other actions in standby mode + break; + } } /*********************************************************************//** @@ -669,7 +699,7 @@ // Home pumps and valves for ( valve = VDI; valve < NUM_OF_VALVES; ++valve ) { - homeValve( valve ); + homeValve( valve, VALVE_NO_FORCE_HOME, VALVE_CARTRIDGE_MAY_BE_PRESENT ); } homeBloodPump(); homeDialInPump();