Пример #1
0
        /// <summary>
		/// Test the LEDs on the front panel.
		/// </summary>
		private void TestLEDs()
		{
            // Turn OFF all LEDs for 2 seconds.  Display a message indicating this.
            Master.Instance.ControllerWrapper.TurnLEDsOff();
            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.LEDS_ALL_OFF ) );
            Thread.Sleep( 2000 );

            // Turn ON the just the RED LED for 2 seconds.  Display a message indicating this.
            Master.Instance.ControllerWrapper.TurnLEDOn( Controller.LEDState.Red );
            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.LED_RED_ON ) );
            Thread.Sleep( 2000 );

            // Turn ON the just the YELLOW LED for 2 seconds.  Display a message indicating this.
            Master.Instance.ControllerWrapper.TurnLEDOn( Controller.LEDState.Yellow );
            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.LED_YELLOW_ON ) );
            Thread.Sleep( 2000 );

            // Turn ON the just the GREEN LED for 2 seconds.  Display a message indicating this.
            Master.Instance.ControllerWrapper.TurnLEDOn( Controller.LEDState.Green );
            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.LED_GREEN_ON ) );
            Thread.Sleep( 2000 );

            // Turn OFF all LEDs for 2 seconds.  Display a message indicating this.
            Master.Instance.ControllerWrapper.TurnLEDsOff();
            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.LEDS_ALL_OFF ) );
            Thread.Sleep( 2000 );

            // Prompt the user to indicate pass/fail for the LED tests.
            string message = GetText( DiagnosticResources.LED_PROMPT, DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT, string.Empty );
            Controller.Key keyPressed = GetPassFailKey( message );
            ReportDiagnostic( DiagnosticResources.LED_TEST, keyPressed, ( keyPressed != Controller.Key.Left ) );
        }
Пример #2
0
		/// <summary>
		/// Test battery charging.
		/// </summary>
		private void TestBatteryCharging()
		{
            if ( !Configuration.DockingStation.IsRechargeable() )
                return;

            if ( !IsInstrumentDocked() )
                return;

            if ( _dockedInstrument == null )
                _dockedInstrument = ReadDockedInstrument();

            if ( _dockedInstrument == null )
            {
                ReportDiagnostic( DiagnosticResources.BATTERY_INSTALLED, false /*battery installed == false*/, true /*failed*/ );
                return;
            }

			// Find the battery code.
			string batteryCode = string.Empty;
            foreach ( InstalledComponent installedComponent in _dockedInstrument.InstalledComponents )
			{
				if ( installedComponent.Component.Type.Code.StartsWith( "BP" ) ) 
					batteryCode = installedComponent.Component.Type.Code;
			}

			// Determine if a battery is installed
			if ( batteryCode == string.Empty )
                ReportDiagnostic( DiagnosticResources.BATTERY_INSTALLED, false /*battery installed == false*/, true /*failed*/ );

			// Check the battery type.
			string message = GetText( DiagnosticResources.INSTRUMENT_BATTERY_CODE_PROMPT, batteryCode , DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT );
			Controller.Key keyPressed = GetPassFailKey( message );
			ReportDiagnostic( DiagnosticResources.INSTRUMENT_BATTERY_CODE, keyPressed , ( keyPressed != Controller.Key.Left ) );

			// If correct battery type, test charging.
			if ( keyPressed == Controller.Key.Left )
			{
#if !MANUAL
                InstrumentChargingOperation chargingOp = new InstrumentChargingOperation();
                chargingOp.Execute();
                ChargingService.ChargingState chState = chargingOp.ChargingState;
                // Note that "NotCharging" is a passable state. The instrument will report a
                // phase of ChargeComplete if it's receiving charge current from the IDS but
                // isn't currently using it.  This will result in a NotCharging chargingstate.
                // The instrument will report a phase of ChargeOff if it's NOT receiving a
                // charge current from the IDS.  This is what we're interested in detecting 
                // and it results in a ChargingState.Error.
                bool failed = chargingOp.ChargingState == ChargingService.ChargingState.Error;
                ReportDiagnostic( DiagnosticResources.INSTRUMENT_CHARGING,  chState.ToString(), failed );
#else
                message = GetText( DiagnosticResources.INSTRUMENT_CHARGING_PROMPT" , batteryCode , DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT" );
                keyPressed = GetPassFailKey( message );
                ReportDiagnostic( DiagnosticResources.INSTRUMENT_CHARGING" , keyPressed , ( keyPressed != Controller.Keys.Left ) );
#endif
			}
		}
Пример #3
0
        /// <summary>
		/// Test the buzzer.
		/// </summary>
		private void TestBuzzer()
		{
            // Turn ON the buzzer for 2 seconds.  Display a message indicating this.
            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.BUZZER_IS_ON ) );
            Master.Instance.ControllerWrapper.Buzz( 2 );

            // Turn OFF the buzzer for 2 seconds.  Display a message indicating this.
            Master.Instance.ControllerWrapper.TurnBuzzerOff();
            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.BUZZER_IS_OFF ) );
            Thread.Sleep( 2000 );

            // Prompt the user to indicate pass/fail for the buzzer tests.
            string message = GetText( DiagnosticResources.BUZZER_TEST_PROMPT , DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT, string.Empty );
            Controller.Key keyPressed = GetPassFailKey( message );
            ReportDiagnostic( DiagnosticResources.BUZZER_TEST , keyPressed, ( keyPressed != Controller.Key.Left ) );
        }
Пример #4
0
        /// <summary>
        /// Test the cradle solenoid. We need to verify that the solenoid cradle can switch in both directions
        /// </summary>
        private void TestCradleGasFlowWithSolenoid()
        {
            const int gasPort = 1;

            // Ventis LS docking stations have a type of MX4, but do not have a cradle solenoid.
            if (Configuration.DockingStation.PartNumber == Configuration.VENTISLS_PARTNUMBER)
                return;

            // Prompt to start pump.
            string message = GetText(DiagnosticResources.PRESS_ANY_TO_START_PUMP, DiagnosticResources.GAS_PORT, string.Empty);
            message = message.Replace("#", gasPort.ToString());
            GetAnyKey(message);

            Controller.Key key = Controller.Key.None;

            // Open solenoid and start the pump.
            Master.Instance.PumpWrapper.OpenValve(gasPort, false);
            Master.Instance.PumpWrapper.Start(Pump.MaxVoltage); // set pump to full blast for easy detection of air flow.

            // First switch solenoid to route air to hose.  Then attempt to route 
            // it back to the diffusion lid and verify that it successfully did so.
            Master.Instance.ControllerWrapper.SetCradleSolenoid(AccessoryPumpSetting.Installed);
            Thread.Sleep(1000);
            Master.Instance.ControllerWrapper.SetCradleSolenoid(AccessoryPumpSetting.Uninstalled);

            message = GetText(DiagnosticResources.CRADLE_SOLENOID_LID_PROMPT, string.Empty, DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT);
            key = GetPassFailKey(message);
            ReportDiagnostic(DiagnosticResources.CRADLE_SOLENOID_LID, key, (key != Controller.Key.Left));

            // Throw solenoid to direct flow to pump hose.
            Master.Instance.ControllerWrapper.SetCradleSolenoid(AccessoryPumpSetting.Installed);

            message = GetText(DiagnosticResources.CRADLE_SOLENOID_PUMP_PROMPT, string.Empty, DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT);
            key = GetPassFailKey(message);
            ReportDiagnostic(DiagnosticResources.CRADLE_SOLENOID_PUMP, key, (key != Controller.Key.Left));

            // Route air back to diffusion lid before continuing on with flow offset adjustment.
            Master.Instance.ControllerWrapper.SetCradleSolenoid(AccessoryPumpSetting.Uninstalled);

            // Stop the pump and close the solenoid.
            Master.Instance.PumpWrapper.Stop();
            Master.Instance.PumpWrapper.CloseValve(gasPort, false);
        }
Пример #5
0
        /// <summary>
        /// Test the cradle gas flow without solenoid
        /// </summary>
        private void TestCradleGasFlowWithoutSolenoid()
        {
            const int gasPort = 1;

            //Prompt the user to connect the tubing adapter
            string message = GetText(DiagnosticResources.TUBING_ADAPTER_PROMPT, DiagnosticResources.PRESS_ANY_TO_CONTINUE, string.Empty);
            GetAnyKey(message);

            //Start the pump after adapter has confirmed as connected
            Master.Instance.PumpWrapper.OpenValve(gasPort, false);
            Master.Instance.PumpWrapper.Start(Pump.MaxVoltage); // set pump to full blast for easy detection of air flow.

            Controller.Key key = Controller.Key.None;

            //Prompt the user to verify the flow through the adapter
            message = GetText(DiagnosticResources.TUBING_ADAPTER_FLOW_PROMPT, string.Empty, DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT);
            key = GetPassFailKey(message);
            ReportDiagnostic(DiagnosticResources.TUBING_ADAPTER_FLOW, key, (key != Controller.Key.Left));

            // Stop the pump.
            Master.Instance.PumpWrapper.Stop();
            Master.Instance.PumpWrapper.CloseValve(gasPort, false);
        }
Пример #6
0
        /// <summary>
		/// Test the flow rate.
		/// </summary>
		private void TestFlowRate()
        {
            const int gasPort = 2;
            ushort rawFlow;
            int flowOffset;

            // Prompt to start pump.
            string message = GetText( DiagnosticResources.PRESS_ANY_TO_START_PUMP, DiagnosticResources.GAS_PORT, string.Empty );
            message = message.Replace( "#", gasPort.ToString() );
			GetAnyKey( message );

			Controller.Key key = Controller.Key.None;

			// Open solenoid.
            Master.Instance.PumpWrapper.OpenValve( gasPort, false );
           
            // SGF  19-May-2011  INS-2041 -- establish the initial pump voltage in a manner unique to the flow offset calibration
            int pumpVoltage = FlowOffsetStartVoltage;

            // Start the pump at the specified voltage.
            Master.Instance.PumpWrapper.Start( pumpVoltage );

            // For DSX, if we just turned on the pump, we need to wait a bit to give the flow 
            // sensor time to stabilize. If we don't wait, then first flow reading will be too 
            // high. 2 seconds seems to be minimum we need to wait, based on some informal 
            // experiments I did. We sleep only 1.5 seconds here, since there is an additional
            // half second wait in the loop below. Note that there's a similar initial sleep
            // in Pump's CheckFlow routine. - JMP, 10/2014
            Thread.Sleep( 1500 );

			do
			{
                Master.Instance.PumpWrapper.SetNewPumpVoltage( Convert.ToByte( pumpVoltage ) );

                // Allow some time for the pump to adjust to the new voltage.
				Thread.Sleep( 500 );

				// Check for correct flow rating.
				rawFlow = Master.Instance.PumpWrapper.GetRawFlow();
                flowOffset = rawFlow - Pump.StandardFlowCounts;

				// Diagnostic flow adjustment.
                message = GetText( DiagnosticResources.FLOW_ADJUST, 
                                   DiagnosticResources.FLOW_LABEL + " " + rawFlow.ToString(), 
                                   DiagnosticResources.OFFSET_LABEL + " " + flowOffset.ToString() );
                key = GetAnyKey(message);

                // Compute the new pump voltage.
				switch ( key )
				{
					case Controller.Key.Left:
                        pumpVoltage += 2;
                        pumpVoltage = Math.Min( pumpVoltage, Pump.MaxVoltage );
                        if ( pumpVoltage == Pump.MaxVoltage )
                            Controller.Buzz( 0.01 );
						break;

					case Controller.Key.Right:
						pumpVoltage -= 2;
                        pumpVoltage = Math.Max( pumpVoltage, Pump.MinVoltage );
                        if ( pumpVoltage == Pump.MinVoltage )
                            Controller.Buzz( 0.01 );
						break;
				}

                Log.Debug( "*** keypad=" + key.ToString() + " pumpVoltage=" + pumpVoltage + " flowOffset=" + flowOffset + " rawFlow=" + rawFlow );
			}
			while ( key != Controller.Key.Middle );

			// Report the results.
            if ( Configuration.DockingStation.Reservoir ) // Viper / iNetDS ?
			    ReportDiagnostic(  DiagnosticResources.FLOW, rawFlow , ( rawFlow < 180 || rawFlow > 300 ) );
            else  // Burton / DSX
                ReportDiagnostic( DiagnosticResources.FLOW, rawFlow, ( rawFlow < 150 || rawFlow > 500 ) );

            flowOffset = rawFlow - Pump.StandardFlowCounts; 

            Log.Debug( "*** pumpVoltage=" + pumpVoltage + " flowOffset=" + flowOffset + " rawFlow=" + rawFlow );

            Configuration.DockingStation.FlowOffset = flowOffset;
            Configuration.SaveFlowOffset();
            Log.Debug( "RawFlow: " + rawFlow + " FlowOffset: " + Configuration.DockingStation.FlowOffset );

			// Report the results.
            ReportDiagnostic( DiagnosticResources.FLOW_OFFSET, Configuration.DockingStation.FlowOffset, false );

            // Stop pump and close the solenoid.
            Master.Instance.PumpWrapper.Stop();
            Master.Instance.PumpWrapper.CloseValve( gasPort, false );
		}
Пример #7
0
        /// <summary>
		/// Test the iGas.
		/// </summary>
		private void TestiGas( )
		{
            string message;
            bool val;

            string gasPortsPrompt = DiagnosticResources.NUM_GAS_PORTS_PROMPT.Replace( "#", Configuration.DockingStation.NumGasPorts.ToString() );
            message = GetText( gasPortsPrompt, DiagnosticResources.PRESS_LEFT_SUCCESS_PROMPT, string.Empty );
            Controller.Key keyPressed = GetPassFailKey( message );
            bool failed = keyPressed != Controller.Key.Left; // left passes, anything else fails.
            ReportDiagnostic( DiagnosticResources.NUM_GAS_PORTS_TEST, Configuration.DockingStation.NumGasPorts.ToString(), failed );

            // If DS was serialized with wrong number of ports, then don't do any more tests.
            // The DS should be re-searialized
            if ( failed )
                return;

            // Try to detect the presence of any pressure switches or iGas cards on any of the three iGas ports.
            // If anything is detected, then log a failure.

            // Check for lack of pressure switches.
            for ( int n = 1; n <= Configuration.DockingStation.NumGasPorts; n++ )
            {
                val = Master.Instance.SmartCardWrapper.IsPressureSwitchPresent( n );
                ReportDiagnostic( _details.GetText( "NO_PRESSURE_SWITCH_" + n ), val, ( val == true ) );
            }

            // Check for lack of smart card.
            for ( int n = 1; n <= Configuration.DockingStation.NumGasPorts; n++ )
            {
                val = Master.Instance.SmartCardWrapper.IsCardPresent( n );
                ReportDiagnostic( _details.GetText( "NO_SMART_CARD_" + n ), val, ( val == true ) );
            }

            // Prompt the user to attach iGas readers to all iGas ports on the iNetDS.  It is assumed that the 
            // iGas readers contain iGas cards, and that pressure switches are also attached to the iGas readers.
            message = GetText( DiagnosticResources.CONNECT_IGAS_CONNECTOR, DiagnosticResources.PRESS_ANY_TO_CONTINUE, string.Empty );
            GetAnyKey( message );

            // The user has pressed a key pad key to indicate that the connections are complete.  So...

            // Check for the presence of iGas cards on all three ports.
            for ( int n = 1; n <= Configuration.DockingStation.NumGasPorts; n++ )
            {
                val = Master.Instance.SmartCardWrapper.IsCardPresent( n );
                ReportDiagnostic( _details.GetText( "SMART_CARD_PRESENT_" + n ), val, ( val == false ) );
            }

			// skip pressure test if pressure switch was not detected to be present
			bool[] wasPressureSwitchPresent = new bool[Configuration.DockingStation.NumGasPorts];

            // Check for the presence of pressure switches on all three ports.
            for ( int n = 1; n <= Configuration.DockingStation.NumGasPorts; n++ )
            {
                val = Master.Instance.SmartCardWrapper.IsPressureSwitchPresent( n );
                ReportDiagnostic( _details.GetText( "PRESSURE_SWITCH_PRESENT_" + n ), val, ( val == false ) );

				wasPressureSwitchPresent[n - 1] = val;
            }

            // Check for the activition of pressure switches on all three ports.
            for ( int n = 1; n <= Configuration.DockingStation.NumGasPorts; n++ )
            {
				if ( wasPressureSwitchPresent[n - 1] )
				{
					val = Master.Instance.SmartCardWrapper.CheckPressureSwitch( n );
					ReportDiagnostic( _details.GetText( "PRESSURE_SWITCH_PRESSURE_" + n ), val, ( val == false ) );
				}
				else
				{
					ReportDiagnosticSkipped( _details.GetText( "PRESSURE_SWITCH_PRESSURE_" + n ) );
				}
            }
        }