Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -re9e339870c5ed01230963f00d400331ab879c91f -rb777859b2667c350c6ca9fda60a668c9eb5fe02d --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision e9e339870c5ed01230963f00d400331ab879c91f) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision b777859b2667c350c6ca9fda60a668c9eb5fe02d) @@ -27,6 +27,8 @@ #include "Switches.h" #include "SystemCommTD.h" #include "TxParams.h" +#include "Valve3Way.h" +#include "Valves.h" /** * @addtogroup TDStandbyMode @@ -42,6 +44,7 @@ static TD_STANDBY_STATE_T currentStandbyState; ///< Current state (sub-mode) of standby mode. static BOOL treatStartReqReceived; ///< Flag indicates user has requested initiation of a treatment. +static BOOL homingInitiated; ///< Flag indicates actuators have been homed. // ********** private function prototypes ********** @@ -52,13 +55,14 @@ * @brief * The initStandbyMode function initializes the Standby Mode Unit. * @details \b Inputs: none - * @details \b Outputs: currentStandbyState, treatStartReqReceived + * @details \b Outputs: Standby mode variables initialized. * @return none *************************************************************************/ void initStandbyMode( void ) { currentStandbyState = STANDBY_START_STATE; treatStartReqReceived = FALSE; + homingInitiated = FALSE; } /*********************************************************************//** @@ -84,15 +88,22 @@ setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, FALSE ); // Pumps should be off -// signalBloodPumpHardStop(); + signalBloodPumpHardStop(); // stopSyringePump(); // Set valves to default positions -// setValveAirTrap( VALVE_3WAY_COMMON_TO_CLOSED_STATE ); -// setValvePosition( H1_VALV, VALVE_POSITION_A_INSERT_EJECT ); -// setValvePosition( H19, VALVE_POSITION_A_INSERT_EJECT ); + set3WayValveState( H13_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); + set3WayValveState( H20_VALV, VALVE_3WAY_COMMON_TO_CLOSED_STATE ); + if ( getValveState( H1_VALV ) < VALVE_STATE_IDLE ) + { + setValvePosition( H1_VALV, VALVE_POSITION_A_INSERT_EJECT ); + } + if ( getValveState( H19_VALV ) < VALVE_STATE_IDLE ) + { + setValvePosition( H19_VALV, VALVE_POSITION_A_INSERT_EJECT ); + } -// doorClosedRequired( FALSE ); // door no longer required to be closed in standby mode + doorClosedRequired( FALSE ); // door no longer required to be closed in standby mode // syringeDetectionRequired( FALSE ); // Request DD service record and usage information from DD @@ -154,23 +165,23 @@ // Wait for door to be closed so we can home actuators // if ( STATE_CLOSED == getSwitchState( H9_SWCH ) ) // { -// // If we haven't already initiated homing of actuators, initiate now -// if ( homingInitiated != TRUE ) -// { -// VALVE_T valve; -// -// // Home pumps and valves -// for ( valve = VDI; valve < NUM_OF_VALVES; ++valve ) -// { -// homeValve( valve, VALVE_NO_FORCE_HOME, VALVE_CARTRIDGE_MAY_BE_PRESENT ); -// } + // If we haven't already initiated homing of actuators, initiate now + if ( homingInitiated != TRUE ) + { + VALVE_T valve; + + // Home pumps and valves + for ( valve = FIRST_VALVE; valve < NUM_OF_VALVES; ++valve ) + { + homeValve( valve, FALSE, TRUE ); + } // homeBloodPump(); // homeDialInPump(); // homeDialOutPump(); // retractSyringePump(); -// -// homingInitiated = TRUE; -// } + + homingInitiated = TRUE; + } // else // { // // If homing has been initiated, wait for syringe pump to home and the verify force sensor calibration