Ejemplo n.º 1
0
        private void RunTest()
        {
            try
            {
                DateTime startTime, stopTime;
                startTime = DateTime.Now;

                if (m_flagCa310Mode)
                {
                    Dictionary <string, CIE1931Value> items = new Dictionary <string, CIE1931Value>();
                    fixture.RotateOn();
                    Thread.Sleep(1000);
                    foreach (TestItem testItem in xml.Items)
                    {
                        log.WriteUartLog(string.Format("Ca310Mode - Set panel to {0}\r\n", testItem.TestName));

                        if (dut.ChangePanelColor(testItem.TestName))
                        {
                            Thread.Sleep(3000);
                            CIE1931Value cie = ca310Pipe.GetCa310Data();
                            log.WriteUartLog(string.Format("Ca310Mode - CIE1931xyY: {0}\r\n", cie.ToString()));
                            items.Add(testItem.TestName, cie.Copy());
                        }
                        else
                        {
                            string str = string.Format("Can't set panel color to {0}\r\n", testItem.TestName);
                            sslStatus.Text = str;
                            pf             = false;
                            break;
                        }
                    }
                    fixture.RotateOff();
                    Thread.Sleep(1000);
                    log.WriteCa310Log(serialNumber, items);
                }

                foreach (TestItem testItem in xml.Items)
                {
                    log.WriteUartLog(string.Format("Set panel to {0}\r\n", testItem.TestName));

                    if (dut.ChangePanelColor(testItem.TestName))
                    {
                        Thread.Sleep(3000);
                        m_colorimeter.ExposureTime = testItem.Exposure;
                        Bitmap bitmap = m_colorimeter.GrabImage();
                        pf &= this.DisplayTest(displaycornerPoints, bitmap, (ColorPanel)Enum.Parse(typeof(ColorPanel), testItem.TestName));
                        //this.Invoke(new Action<Bitmap, PictureBox>(this.refreshtestimage), bitmap, picturebox_test);
                    }
                    else
                    {
                        string str = string.Format("Can't set panel color to {0}\r\n", testItem.TestName);
                        sslStatus.Text = str;
                        pf             = false;
                        break;
                    }
                }

                if (pf)
                {
                    log.WriteUartLog("Test result is PASS\r\n");
                    this.Invoke(new Action(delegate() {
                        tbox_pf.Visible   = true;
                        tbox_pf.BackColor = Color.Green;
                        tbox_pf.Text      = "Pass";
                    }));
                }
                else
                {
                    log.WriteUartLog("Test result is FAIL\r\n");
                    this.Invoke(new Action(delegate() {
                        tbox_pf.Visible   = true;
                        tbox_pf.BackColor = Color.Red;
                        tbox_pf.Text      = "Fail";
                    }));
                }
                log.UartFlush();

                stopTime = DateTime.Now;
                log.WriteCsv(serialNumber, startTime, stopTime, xml.Items);
                //SFC.CreateResultFile(1, pf ? "PASS" : "FAIL");

                while (dut.checkDUT())
                {
                    this.Invoke(new Action(delegate(){
                        sslStatus.Text = "Please take out DUT.";
                    }));
                    Thread.Sleep(100);

                    if (m_flagExit)
                    {
                        break;
                    }
                }

                tbox_dut_connect.Text      = "TBD";
                tbox_dut_connect.BackColor = Color.FromArgb(224, 224, 224);
                tbox_sn.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void RunSignalSequence()
        {
            args.StatusInfo = "Checking DUT";
            dataChange.Invoke(this, args);

            // check dut
            while (!dut.checkDUT())
            {
                Thread.Sleep(100);
            }
            log.WriteUartLog(string.Format("DUT connected, DeviceID: {0}\r\n", dut.DeviceID));
            IsDutReady      = true;
            args.StatusInfo = "Checking SN, please type in 16 digit SN";
            dataChange.Invoke(this, args);

            // check sn
            while (SerialNumber.Length != 16)
            {
                ;
            }
            log.SerialNumber = SerialNumber;
            log.WriteUartLog(string.Format("Serial number: {0}\r\n", SerialNumber));
            args.StatusInfo = string.Format("Serial number: {0}", SerialNumber);
            dataChange.Invoke(this, args);

            // check shopfloor
            args.StatusInfo = "Checking Shopfloor";
            dataChange.Invoke(this, args);
            IsShopFlowReady = this.CheckShopFloor();

            if (!IsShopFlowReady)
            {
                args.StatusInfo = "Shopfloor system is not working";
                log.WriteUartLog("Shopfloor system is not working.\r\n");
                dataChange.Invoke(this, args);
            }
            else
            {
                log.WriteUartLog("Shopfloor has connected.\r\n");
                args.StatusInfo = "Testing...";
                dataChange.Invoke(this, args);

                // run Ca310 if the mode is Ca310Mode
                this.RunCa310Test();

                DateTime        startTime = DateTime.Now, stopTime;
                List <IntPoint> ptCorners = new List <IntPoint>();
                TestResult = true;

                foreach (TestItem testItem in xml.Items)
                {
                    log.WriteUartLog(string.Format("Set panel to {0}\r\n", testItem.TestName));

                    if (dut.ChangePanelColor(testItem.TestName))
                    {
                        Thread.Sleep(3000);
                        colorimeter.ExposureTime = testItem.Exposure;
                        Bitmap bitmap = colorimeter.GrabImage();
                        args.Image = bitmap;
                        dataChange.Invoke(this, args);
                        TestResult &= this.RunDisplayTest(testItem, bitmap, ptCorners);
                        //TestResult &= this.DisplayTest(ptCorners, bitmap, (ColorPanel)Enum.Parse(typeof(ColorPanel), testItem.TestName));
                        //this.Invoke(new Action<Bitmap, PictureBox>(this.refreshtestimage), bitmap, picturebox_test);
                    }
                    else
                    {
                        args.StatusInfo = string.Format("Can't set panel color to {0}\r\n", testItem.TestName);
                        dataChange.Invoke(this, args);
                        break;
                    }
                }
                log.WriteUartLog(string.Format("Test result is {0}\r\n", (TestResult ? "PASS" : "FAIL")));
                log.UartFlush();

                stopTime = DateTime.Now;
                log.WriteCsv(SerialNumber, startTime, stopTime, xml.Items);
                //SFC.CreateResultFile(1, pf ? "PASS" : "FAIL");

                args.StatusInfo = "Please take out DUT";
                dataChange.Invoke(this, args);
                while (dut.checkDUT())
                {
                    Thread.Sleep(200);
                }
                SerialNumber = "";
            }
        }