Ejemplo n.º 1
0
        private MTKTestError RunTestUART()
        {
            //TO DO something...
            MTKTestError RetVal = MTKTestError.Pending;

            try
            {
                MTKInstruments.DUTCurrent = MTKInstruments.MeasureChannelCurrent(CurrentDUT);



                return(RetVal);
            }
            catch
            {
                RetVal            = MTKTestError.TestFailed;
                TestResult.Result = "FAIL";
                TestResultUpdate(TestResult);
                return(RetVal);
            }
            finally
            {
                //Recover all duts' power on after testing.
                if (!MTKInstruments.SwitchAllDutOn())
                {
                    this.Log.PrintLog(this, "Fail to recover power after current test.", LogDetailLevel.LogRelevant);
                }
            }
        }
        //Connect Btn
        private void button1_Click(object sender, EventArgs e)
        {
            SaveParameters();

            try
            {
                MTKInstruments.ConnectDMM();
                if (MTKInstruments.DmmConnected)
                {
                    logger.PrintLog(this, "DMM " + MultiMeter.IDN_MultiMeter + " has been connected successfully.", LogDetailLevel.LogRelevant);
                }
                else
                {
                    logger.PrintLog(this, "DMM Not Connected: " + MultiMeter.IDN_MultiMeter, LogDetailLevel.LogRelevant);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fail to connect DMM ... \n\n" + ex.ToString(), "MTK Instrument Error");
                return;
            }

            try
            {
                MTKInstruments.ConnectSwitch();
                if (MTKInstruments.SwConnected)
                {
                    logger.PrintLog(this, "Switch " + Agilent.IDN_SwitchA + " has been connected successfully.", LogDetailLevel.LogRelevant);
                }
                else
                {
                    logger.PrintLog(this, "Switch Not Connected: " + Agilent.IDN_SwitchA, LogDetailLevel.LogRelevant);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fail to connect Swtich ... \n\n" + ex.ToString(), "MTK Instrument Error");
                return;
            }

            if (MTKInstruments.AlldevReady)
            {
                logger.PrintLog(this, "DMM and Switch have been connected successfully.", LogDetailLevel.LogRelevant);
            }
        }
        public void SaveParameters()
        {
            bool changed = false;

            if (textBox_dmm_alias.Text.ToLower() != CyBLE_MTK_Application.Properties.Settings.Default.DMM_Alias.ToLower())
            {
                CyBLE_MTK_Application.Properties.Settings.Default.DMM_Alias = textBox_dmm_alias.Text;
                CyBLE_MTK_Application.Properties.Settings.Default.Save();
                changed = true;
            }

            if (textBox_sw_alias.Text.ToLower() != CyBLE_MTK_Application.Properties.Settings.Default.Switch_Alias.ToLower())
            {
                CyBLE_MTK_Application.Properties.Settings.Default.Switch_Alias = textBox_sw_alias.Text;
                CyBLE_MTK_Application.Properties.Settings.Default.Save();
                changed = true;
            }

            if (comboBox_CurrUnit.Text.ToLower() != CyBLE_MTK_Application.Properties.Settings.Default.DUTCurrentMeasureUnit.ToLower())
            {
                CyBLE_MTK_Application.Properties.Settings.Default.DUTCurrentMeasureUnit = comboBox_CurrUnit.Text;
                CyBLE_MTK_Application.Properties.Settings.Default.Save();
                changed = true;
            }

            if (numericUpDown_RelayDelay.Value != CyBLE_MTK_Application.Properties.Settings.Default.RelayDelayInMS)
            {
                CyBLE_MTK_Application.Properties.Settings.Default.RelayDelayInMS = numericUpDown_RelayDelay.Value;
                CyBLE_MTK_Application.Properties.Settings.Default.Save();
                changed = true;
            }


            if (changed)
            {
                MTKInstruments.SyncParams();
                logger.PrintLog(this, "Parameters Sync done.", LogDetailLevel.LogRelevant);
            }
            else
            {
                //logger.PrintLog(this, "Parameters hasn't been changed.", LogDetailLevel.LogRelevant);
            }
        }