/// <summary> /// Constructor of TestFunction /// </summary> /// <param name="serialNumber"></param> /// <param name="UsbBridge"></param> public TestFunction(string serialNumber, USB_I2C UsbBridge, TrackpadConfig trackpadConfig, string testStation) { dut = new DUT(); dut.SerailNumber = serialNumber; dut.RawCount = new List <int>(); dut.RawCountX = new List <int>(); dut.RawCountY = new List <int>(); dut.Noise = new List <int>(); dut.StdDev = new List <double>(); dut.IDAC = new List <int>(); dut.Global_IDAC = new List <int>(); dut.IDACGain = new List <byte>(); dut.IDAC_Erased = new List <int>(); dut.Local_IDAC = new List <int>(); dut.Signal = new List <int>(); dut.SNR = new List <double>(); dut.RawCount_Single = new List <int>(); dut.Signal_Single = new List <int>(); dut.Finger_Positions = new List <Point>(); m_TPCONFIG = trackpadConfig; if (testStation == "TMT") { m_TPCONFIGtestItems = m_TPCONFIG.TMT; } if (testStation == "OQC") { m_TPCONFIGtestItems = m_TPCONFIG.OQC; } if (testStation == "TPT") { m_TPCONFIGtestItems = m_TPCONFIG.TPT; } NUM_COLS = m_TPCONFIGtestItems.FW_INFO_NUM_COLS; NUM_ROWS = m_TPCONFIGtestItems.FW_INFO_NUM_ROWS; RAW_DATA_READS = m_TPCONFIGtestItems.RAW_DATA_READS; bridge = UsbBridge; bridge.DeviceAddress = m_TPCONFIG.I2C_ADDRESS; VDD_DEFAULT = Convert.ToString(m_TPCONFIG.VDD_OP_PS); if (m_TPCONFIG.TRACKPAD_PLATFORM == TPCONFIG.TP_FUNCTION_APA) { I2CReadDelay = DelayTime.I2C_MS / 2; } else { I2CReadDelay = DelayTime.I2C_MS; } }
/// <summary> /// Constructor of TestFunction /// </summary> /// <param name="serialNumber"></param> /// <param name="UsbBridge"></param> public TestFunction(string serialNumber, USB_I2C UsbBridge, TrackpadConfig trackpadConfig, string testStation) { dut = new DUT(); dut.SerailNumber = serialNumber; dut.RawCount = new List<int>(); dut.Noise = new List<int>(); dut.StdDev = new List<double>(); dut.IDAC = new List<int>(); dut.Global_IDAC = new List<int>(); dut.IDACGain = new List<byte>(); dut.IDAC_Erased = new List<int>(); dut.Local_IDAC = new List<int>(); dut.Signal = new List<int>(); dut.SNR = new List<double>(); dut.RawCount_Single = new List<int>(); dut.Signal_Single = new List<int>(); m_TPCONFIG = trackpadConfig; if (testStation == "TMT") { m_TPCONFIGtestItems = m_TPCONFIG.TMT; } if (testStation == "OQC") { m_TPCONFIGtestItems = m_TPCONFIG.OQC; } if (testStation == "TPT") { m_TPCONFIGtestItems = m_TPCONFIG.TPT; } NUM_COLS = m_TPCONFIGtestItems.FW_INFO_NUM_COLS; NUM_ROWS = m_TPCONFIGtestItems.FW_INFO_NUM_ROWS; RAW_DATA_READS = m_TPCONFIGtestItems.RAW_DATA_READS; bridge = UsbBridge; bridge.DeviceAddress = m_TPCONFIG.I2C_ADDRESS; VDD_DEFAULT = Convert.ToString(m_TPCONFIG.VDD_OP_PS); }
private void startTest() { timer.Restart(); //string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Please contact your Test engineer for the config file", "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); test_running = true; } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void buttonStart_Click(object sender, EventArgs e) { if (textBoxSN.Text.Length == 19 || textBoxSN.Text.Length == 20) { serialNumber = textBoxSN.Text; string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); string identifier = serialNumber.Substring(PARTNUMBER_LENGTH, (textBoxSN.Text.Length - PARTNUMBER_LENGTH)); serialNumber = partType + identifier; if (validateSerialNumber(serialNumber)) { textBoxSN.Text = identifier; textBoxMPN.Text = partType; serialNumberScanned = true; } else { MessageBox.Show("invalid serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxSN.Text = ""; textBoxMPN.Text = ""; serialNumberScanned = false; } } timer.Restart(); //string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ////show the workID panel if work ID is not valid. //while (DeviceConfig.Items.trackpad_ShopFloor == DeviceConfig.TPCONFIG.TP_TEST_ONLINE && TestFunction.WorkerID == "") //{ // FormOperaterID formWorkerID = new FormOperaterID(); // formWorkerID.ShowDialog(); // TestFunction.WorkerID = formWorkerID.WorkerID; //} //check if serial number is valid if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); //start test process in test main thread //testReadMainThread = new Thread(testProcess); //testReadMainThread.IsBackground = true; //testReadMainThread.Start(); //testDataMainThread = new Thread(dataProcess); //testDataMainThread.IsBackground = true; //testDataMainThread.Start(); test_running = true; //wait for the test main thread alive. //while (!testReadMainThread.IsAlive) //{ // testReadMainThread.Join(); // //System.Threading.Thread.Sleep(10); //} } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void buttonStart_Click(object sender, EventArgs e) { string partType = "11600200"; currentMode = new Mode(EngineeringMode); this.ClientSize = currentMode.UISize; tabControlMain.Visible = true; productionModeToolStripMenuItem.Checked = false; engineeringModeToolStripMenuItem.Checked = true; debugModeToolStripMenuItem.Checked = false; //timer.Start(); timer.Restart(); if (serialNumber != "") { partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); } //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ////show the workID panel if work ID is not valid. //while (DeviceConfig.Items.trackpad_ShopFloor == DeviceConfig.TPCONFIG.TP_TEST_ONLINE && TestFunction.WorkerID == "") //{ // FormOperaterID formWorkerID = new FormOperaterID(); // formWorkerID.ShowDialog(); // TestFunction.WorkerID = formWorkerID.WorkerID; //} //check if serial number is valid if (true) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(partType); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); //start test process in test main thread //testReadMainThread = new Thread(testProcess); //testReadMainThread.IsBackground = true; //testReadMainThread.Start(); //testDataMainThread = new Thread(dataProcess); //testDataMainThread.IsBackground = true; //testDataMainThread.Start(); test_running = true; //wait for the test main thread alive. //while (!testReadMainThread.IsAlive) //{ // testReadMainThread.Join(); // //System.Threading.Thread.Sleep(10); //} } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void startTest() { //timer.Start(); timer.Restart(); string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //check if serial number is valid if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } resolutionX.Text = Convert.ToString(tpConfig.RESOLUTION_X); resolutionY.Text = Convert.ToString(tpConfig.RESOLUTION_Y); int positonPanelX = Convert.ToInt32(Convert.ToInt32(resolutionX.Text) / positionPanelScale); int positonPanelY = Convert.ToInt32(Convert.ToInt32(resolutionY.Text) / positionPanelScale); PositionPanel.Size = new Size(positonPanelX, positonPanelY); textBoxSwitchL.BackColor = Color.White; textBoxSwitchR.BackColor = Color.White; //testFunction.targetPoint = new List<Point>(new Point[] { new Point(60, 60), new Point(tpConfig.RESOLUTION_X - 60, tpConfig.RESOLUTION_Y - 60) }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); int radiusR = 0; testFunction.targetPoint = new List<Point>(new Point[] { new Point(radius, radius), new Point(radius, tpConfig.RESOLUTION_Y - radiusR), new Point(tpConfig.RESOLUTION_X - radiusR, radius), new Point(tpConfig.RESOLUTION_X - radiusR, tpConfig.RESOLUTION_Y - radiusR), new Point(radius, radius) }); //radius = Convert.ToInt32(radius / positionPanelScale); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); test_running = true; } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void buttonStart_Click(object sender, EventArgs e) { //timer.Start(); timer.Restart(); string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ////show the workID panel if work ID is not valid. //while (DeviceConfig.Items.trackpad_ShopFloor == DeviceConfig.TPCONFIG.TP_TEST_ONLINE && TestFunction.WorkerID == "") //{ // FormOperaterID formWorkerID = new FormOperaterID(); // formWorkerID.ShowDialog(); // TestFunction.WorkerID = formWorkerID.WorkerID; //} //check if serial number is valid if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } resolutionX.Text = Convert.ToString(tpConfig.RESOLUTION_X); resolutionY.Text = Convert.ToString(tpConfig.RESOLUTION_Y); if (tpConfig.RESOLUTION_X > 600 || tpConfig.RESOLUTION_Y > 325) { positionPanelScale = 2; while ((tpConfig.RESOLUTION_X / positionPanelScale) > 600 || (tpConfig.RESOLUTION_Y / positionPanelScale) > 325) { positionPanelScale = positionPanelScale * 2; } } else { positionPanelScale = 0.5; while ((tpConfig.RESOLUTION_X / positionPanelScale) * 2 < 600 && (tpConfig.RESOLUTION_Y / positionPanelScale) * 2 < 325) { positionPanelScale = positionPanelScale * 0.5; } } int positonPanelX = Convert.ToInt32(Convert.ToInt32(resolutionX.Text) / positionPanelScale); int positonPanelY = Convert.ToInt32(Convert.ToInt32(resolutionY.Text) / positionPanelScale); PositionPanel.Size = new Size(positonPanelX, positonPanelY); textBoxSwitchL.BackColor = Color.White; textBoxSwitchR.BackColor = Color.White; //testFunction.targetPoint = new List<Point>(new Point[] { new Point(60, 60), new Point(tpConfig.RESOLUTION_X - 60, tpConfig.RESOLUTION_Y - 60) }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); testFunction.targetPoint = new List<Point>(new Point[] { new Point(radius, radius), new Point(radius, tpConfig.RESOLUTION_Y - radius), new Point(tpConfig.RESOLUTION_X - radius, radius), new Point(tpConfig.RESOLUTION_X - radius, tpConfig.RESOLUTION_Y - radius), new Point(radius, radius) }); //radius = Convert.ToInt32(radius / positionPanelScale); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); test_running = true; } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }