/// <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; } }
private void SetGridDisplay(DUT dt) { if (this.dataGridViewIntegrated.InvokeRequired) { SetGridDisplayCallback d = new SetGridDisplayCallback(SetGridDisplay); this.dataGridViewIntegrated.Invoke(d, new object[] { dt }); } else { if (dataGridViewIntegrated.Columns.Count != tpConfig.TMT.FW_INFO_NUM_COLS || dataGridViewIntegrated.Rows.Count != tpConfig.TMT.FW_INFO_NUM_ROWS) // initiate dataGridViewIntegrated; { //clear data grid columns and rows dataGridViewIntegrated.Columns.Clear(); dataGridViewIntegrated.Rows.Clear(); //structure new data grid for (int j = 0; j < tpConfig.TMT.FW_INFO_NUM_COLS; j++) { dataGridViewIntegrated.Columns.Add("Columns", Convert.ToString(j + 1)); dataGridViewIntegrated.Columns[j].Width = 35; } dataGridViewIntegrated.Rows.Add(tpConfig.TMT.FW_INFO_NUM_ROWS - 1); for (int i = 0; i < tpConfig.TMT.FW_INFO_NUM_ROWS; i++) { dataGridViewIntegrated.Rows[i].HeaderCell.Value = Convert.ToString(i + 1); } dataGridViewIntegrated.RowHeadersWidth = 50; } dataGridViewIntegrated.Rows[0].Selected = false; List<int> DisplayInfo = new List<int>(); //dt.RawCount; try { switch (ComboBoxDisplayInfo.Text) { case "Noise": // DisplayInfo.Clear(); foreach (int temp in dt.Noise) { DisplayInfo.Add(temp); } break; case "Local IDAC": // DisplayInfo.Clear(); foreach (int temp in dt.Local_IDAC) { DisplayInfo.Add(temp); } break; case "Global IDAC": // DisplayInfo.Clear(); foreach (int temp in dt.Global_IDAC) //IDAC is equal to Global IDAC for APA. { DisplayInfo.Add(temp); } break; case "Gain": // DisplayInfo.Clear(); foreach (byte gain in dt.IDACGain) { DisplayInfo.Add(Convert.ToInt32(gain)); } break; case "Signal": // DisplayInfo.Clear(); foreach (int temp in dt.Signal_Single) { DisplayInfo.Add(temp); } break; case "SNR": //int i = 0; // DisplayInfo.Clear(); foreach (double SNRTemp in dt.SNR) { DisplayInfo.Add(Convert.ToInt32(SNRTemp)); } break; default: // DisplayInfo.Clear(); foreach (int temp in dt.RawCount_Single) { DisplayInfo.Add(temp); } break; } for (int i = DisplayInfo.Count; i < tpConfig.TMT.FW_INFO_NUM_COLS * tpConfig.TMT.FW_INFO_NUM_ROWS; i++) { DisplayInfo.Add(0); } } catch { //if (tabControl1.SelectedIndex == 2) //{ // MessageBox.Show("Please make sure you selected Signal Test item.\n" + ex.Message, "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); //} //ComboBoxDisplayInfo.SelectedIndex = 0; } try { for (int i = 0; i < tpConfig.TMT.FW_INFO_NUM_ROWS; i++) { for (int j = 0; j < tpConfig.TMT.FW_INFO_NUM_COLS; j++) { dataGridViewIntegrated[j, (tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i)].Value = DisplayInfo[j + i * tpConfig.TMT.FW_INFO_NUM_COLS]; int DisplayInfoTemp = DisplayInfo[j + i * tpConfig.TMT.FW_INFO_NUM_COLS]; switch (ComboBoxDisplayInfo.Text) { case "Noise": if (DisplayInfoTemp >= 6) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.Green; else if (DisplayInfoTemp > 3 && DisplayInfoTemp < 6) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.LightGreen; else dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.White; break; case "Signal": if (DisplayInfoTemp >= 40) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.Green; else if (DisplayInfoTemp > 20 && DisplayInfoTemp < 40) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.LightGreen; else dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.White; break; case "Local IDAC": if (DisplayInfoTemp >= 30 || DisplayInfoTemp <= 2) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.Green; else dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.White; break; case "SNR": if (DisplayInfoTemp <= 15) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.Green; else dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.White; break; case "RawCount": if (DisplayInfoTemp >= 160) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.Green; else if (DisplayInfoTemp > 120 && DisplayInfoTemp < 160) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.LightGreen; else if (DisplayInfoTemp < 80) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.Red; else dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.White; break; default: if (DisplayInfoTemp == 0) dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.Black; else dataGridViewIntegrated[j, tpConfig.TMT.FW_INFO_NUM_ROWS - 1 - i].Style.BackColor = Color.White; break; } } } } catch { //if (tabControl1.SelectedIndex == 2) //{ // MessageBox.Show("Please make sure you selected Signal Test item.\n" + ex.Message, "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); //} //ComboBoxDisplayInfo.SelectedIndex = 0; } finally { //return; } } }
private void SetDisplayChart(DUT tmpData) { if (this.chart1.InvokeRequired) { SetChartFormCallback d3 = new SetChartFormCallback(SetDisplayChart); this.chart1.Invoke(d3, new object[] { tmpData }); } else { chart1.Series[0].Points.DataBindY(tmpData.RawCount); chart1.Series[1].Points.DataBindY(tmpData.Noise); chart1.Series[2].Points.DataBindY(tmpData.Global_IDAC); } }
private void textBoxSerialNumber_TextChanged(object sender, EventArgs e) { if (textBoxSN.Text.Length == Config.SERIAL_NUMBER_LENGTH) { dut = new DUT(); serialNumber = textBoxSN.Text; string partType = serialNumber.Substring(0, Config.PARTNUMBER_LENGTH); string identifier = serialNumber.Substring(Config.PARTNUMBER_LENGTH, (Config.SERIAL_NUMBER_LENGTH - Config.PARTNUMBER_LENGTH)); serialNumber = partType + identifier; textBoxSN.Text = identifier; textBoxMPN.Text = partType; serialNumberScanned = true; dut.SerailNumber = serialNumber; if (validateSerialNumber(serialNumber)) { SetTextBoxSleepResult("", Color.White); SetTextBoxDeepSleepResult("", Color.White); sleep1_test_done = false; deepsleep_test_done = false; } else { MessageBox.Show("invalid serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxSN.Text = ""; textBoxMPN.Text = ""; serialNumberScanned = false; } } }
/// <summary> /// The StateMachine EVENT of class MultiMeter /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mm_fucntion_STEvent(object sender, StateMachineEventArgs e) { //Multi-Meter Init if (e.CurrentState == STATE.states.initialize) { if (e.PassOrFail) { mm_ready = true; if (tp_ready) { EnableButtonConnect(false); EnableButtonSleep(true); EnableButtonDeepSleep(true); } } } //Multi-Meter Exit if (e.CurrentState == STATE.states.exit) { if (tp_ready) { try { EnableButtonConnect(true); EnableButtonSleep(false); EnableButtonDeepSleep(false); serialNumberScanned = false; SetTxtBoxSN(""); tp_thread.exit(); } catch { } } mm_fucntion = null; mm_thread = null; mm_ready = false; } //sleep1 current if (e.CurrentState == STATE.states.MM_CalcSleep1Curr) { sleep1_test_done = true; dut.IDDValue_Sleep = Convert.ToDouble(e.Message); SetListBoxStatus(false, "Sleep1 Current:" + e.Message + "uA"); if (e.PassOrFail) { SetTextBoxSleepResult("PASS", Color.Green); //Log.info("[" + serialNumber + "]" + "Sleep1 PASS:\t\t\t" + e.Average.ToString() + "uA"); } else { SetTextBoxSleepResult("FAIL", Color.Red); //Log.info("[" + serialNumber + "]" + "Sleep1 FAIL:\t\t\t" + e.Average.ToString() + "uA"); if (dut.ErrorCode == 0) { dut.ErrorCode += ErrorCode.ERROR_IDD_HIGH; } //No need to test the deep sleep. deepsleep_test_done = true; } tp_thread.en_queue(STATE.states.TP_PowerOff); if (sleep1_test_done && deepsleep_test_done) { serialNumberScanned = false; SetTxtBoxSN(""); WriteTestReport(); if (Config.ONLINE) { UploadResult(); } dut = null; } } //deep sleep current if (e.CurrentState==STATE.states.MM_CalcDeepSleepCurr) { deepsleep_test_done = true; dut.IDDValue_DeepSleep = Convert.ToDouble(e.Message); SetListBoxStatus(false, "Deep Sleep Current:" + e.Message + "uA"); if (e.PassOrFail) { SetTextBoxDeepSleepResult("PASS", Color.Green); //Log.info("[" + serialNumber + "]" + "Deep Sleep PASS:\t\t" + e.Average.ToString() + "uA"); } else { SetTextBoxDeepSleepResult("FAIL", Color.Red); //Log.info("[" + serialNumber + "]" + "Deep Sleep FAIL:\t\t" + e.Average.ToString() + "uA"); if (dut.ErrorCode == 0) { dut.ErrorCode = ErrorCode.ERROR_IDD_LOW; } //No need to test the sleep1. sleep1_test_done = true; } tp_thread.en_queue(STATE.states.TP_PowerOff); if (sleep1_test_done && deepsleep_test_done) { serialNumberScanned = false; SetTxtBoxSN(""); WriteTestReport(); if (Config.ONLINE) { UploadResult(); } dut = null; } } if (e.CurrentState == STATE.states.MM_ReadCurr) { SetListBoxStatus(false, "Current: " + e.Message + "uA"); } }