Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r0bb0852cf1b7abcd56df89f3b0328efeec37b15c -rd6775171de59386445ffdf70d6b32bcdfc1db07e --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 0bb0852cf1b7abcd56df89f3b0328efeec37b15c) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision d6775171de59386445ffdf70d6b32bcdfc1db07e) @@ -7,8 +7,8 @@ * * @file ModeStandby.c * -* @author (last) Arpita Srivastava -* @date (last) 18-May-2026 +* @author (last) Sean Nash +* @date (last) 01-Jul-2026 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 @@ -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. static FLUID_TYPE_T fluidType; ///< Fluid type assigned based on user selection. static U32 modality; ///< Modality from the treatment initiation. @@ -54,13 +57,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; fluidType = FLUID_TYPE_UNKNOWN; modality = TREATMENT_MODALITY_HD_SALINE_FLUID; } @@ -88,15 +92,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 // Request DD service record and usage information from DD // sendDGServiceRequestToDG(); @@ -157,23 +168,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