Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r79a5884a9d7d6123dab6504940ec92f72093665c -r1a685471524555a374854c0c9ec8e208e71fe2df --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 79a5884a9d7d6123dab6504940ec92f72093665c) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 1a685471524555a374854c0c9ec8e208e71fe2df) @@ -1,3 +1,19 @@ +/************************************************************************** +* +* Copyright (c) 2019-2020 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 Valves.c +* +* @author (last) Sean Nash +* @date (last) 14-Oct-2020 +* +* @author (original) Dara Navaei +* @date (original) 07-Aug-2020 +* +***************************************************************************/ // Includes #include "reg_het.h" @@ -234,7 +250,7 @@ * The initValves function initializes the valves driver. * @details Inputs: valveSelfTestState, valvesSelfTestResult, valvesStatus, * valvesControlSetBits - * Outputs: valveSelfTestState, valvesSelfTestResult, valvesStatus + * @details Outputs: valveSelfTestState, valvesSelfTestResult, valvesStatus * @return none *************************************************************************/ void initValves( void ) @@ -256,6 +272,9 @@ { valvesStatus[ valve ].execState = VALVE_STATE_WAIT_FOR_POST; } + + // close air trap valve + setValveAirTrap( STATE_CLOSED ); } /*********************************************************************//** @@ -722,6 +741,16 @@ { VALVE_STATE_T state = VALVE_STATE_IDLE; +#ifdef TST_3WAY_VALVES_ALWAYS_OPEN + static BOOL valvesOpenedForSarina[NUM_OF_VALVES] = { FALSE, FALSE, FALSE, FALSE }; + + if ( FALSE == valvesOpenedForSarina[ valve ] ) + { + valvesOpenedForSarina[ valve ] = TRUE; + setValvePosition( valve, VALVE_POSITION_B_OPEN ); + } +#endif + if ( valvesStatus[ valve ].hasHomingBeenRequested ) { state = VALVE_STATE_HOMING_NOT_STARTED; @@ -888,12 +917,15 @@ *************************************************************************/ static void execMonitorValves( void ) { +#ifndef DISABLE_3WAY_VALVES // Check if the valves are still enabled areValvesFunctional(); +#endif // Get the current position of the valves in counts and store them getAndMonitorValvesCurrentPosition(); +#ifndef DISABLE_3WAY_VALVES // Get the current in ADC and convert them to amps // Check whether any of the valves are over current convertAndMonitorValvesCurrent(); @@ -903,6 +935,7 @@ #ifdef DEBUG_ENABLED getValvesCurrentPWM(); #endif +#endif } /*********************************************************************//** @@ -1090,6 +1123,7 @@ valvesStatus[ VBA ].currentPositionInCounts = getFPGAValveBloodArterialPosition(); valvesStatus[ VBV ].currentPositionInCounts = getFPGAValveBloodVenousPosition(); +#ifndef DISABLE_3WAY_VALVES // Check the position of each valve for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { @@ -1129,6 +1163,7 @@ } } } +#endif } /*********************************************************************//**