//Save or Quit the configuration panel private void buttonSettingSave_Click(object sender, EventArgs e) { try { DeviceConfig.Items.FW_INFO_FW_REV = Convert.ToByte(textBoxFwRev.Text); DeviceConfig.Items.FW_INFO_NUM_COLS = Convert.ToByte(textBoxNumCols.Text); DeviceConfig.Items.FW_INFO_NUM_ROWS = Convert.ToByte(textBoxNumRows.Text); DeviceConfig.Items.FW_INFO_FW_Ver = Convert.ToByte(textBoxFwVer.Text); DeviceConfig.Items.I2C_ADDRESS = Convert.ToByte(textBoxI2CAddress.Text); DeviceConfig.Items.IDAC_MAX = Convert.ToByte(textBoxIdacMax.Text); DeviceConfig.Items.IDAC_MIN = Convert.ToByte(textBoxIdacMin.Text); DeviceConfig.Items.RAW_AVG_MAX = Convert.ToInt32(textBoxRawCountMax.Text); DeviceConfig.Items.RAW_AVG_MIN = Convert.ToInt32(textBoxRawCountMin.Text); DeviceConfig.Items.RAW_DATA_READS = Convert.ToInt32(textBoxRawDataReads.Text); DeviceConfig.Items.RAW_NOISE_MAX = Convert.ToInt32(textBoxNoiseMax.Text); DeviceConfig.Items.RAW_STD_DEV_MAX = Convert.ToInt32(textBoxStdDevMax.Text); DeviceConfig.Items.IDD_MAX = Convert.ToDouble(textBoxIddMax.Text); DeviceConfig.Items.IDD_MIN = Convert.ToDouble(textBoxIddMin.Text); DeviceConfig.Items.IDD_OPEN = Convert.ToDouble(textBoxIddOpen.Text); DeviceConfig.Items.IDD_SHORT = Convert.ToDouble(textBoxIddShort.Text); DeviceConfig.Items.VDD_OP_MAX = Convert.ToDouble(textBoxVddPS.Text); DeviceConfig.Items.VDD_OP_MIN = Convert.ToDouble(textBoxVddIO.Text); //DeviceConfig.filePath = Application.StartupPath + "\\Production.ini"; DeviceConfig.partType = comboBoxModule.SelectedItem.ToString(); DeviceConfig.Write(); } catch (Exception ex) { MessageBox.Show("Failed to write Production.ini, " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Close(); }
private void SettingLoad() { if (!DeviceConfig.Read()) { MessageBox.Show("Cannot find " + DeviceConfig.partType.ToString() + " in Production.ini", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } textBoxVddPS.Text = DeviceConfig.Items.VDD_OP_MAX.ToString(); textBoxVddIO.Text = DeviceConfig.Items.VDD_OP_MIN.ToString(); textBoxIddMax.Text = DeviceConfig.Items.IDD_MAX.ToString(); textBoxIddMin.Text = DeviceConfig.Items.IDD_MIN.ToString(); textBoxIddOpen.Text = DeviceConfig.Items.IDD_OPEN.ToString(); textBoxIddShort.Text = DeviceConfig.Items.IDD_SHORT.ToString(); textBoxI2CAddress.Text = DeviceConfig.Items.I2C_ADDRESS.ToString(); textBoxRawCountMax.Text = DeviceConfig.Items.RAW_AVG_MAX.ToString(); textBoxRawCountMin.Text = DeviceConfig.Items.RAW_AVG_MIN.ToString(); textBoxRawDataReads.Text = DeviceConfig.Items.RAW_DATA_READS.ToString(); textBoxNoiseMax.Text = DeviceConfig.Items.RAW_NOISE_MAX.ToString(); textBoxStdDevMax.Text = DeviceConfig.Items.RAW_STD_DEV_MAX.ToString(); textBoxFwRev.Text = DeviceConfig.Items.FW_INFO_FW_REV.ToString(); textBoxNumCols.Text = DeviceConfig.Items.FW_INFO_NUM_COLS.ToString(); textBoxNumRows.Text = DeviceConfig.Items.FW_INFO_NUM_ROWS.ToString(); textBoxFwVer.Text = DeviceConfig.Items.FW_INFO_FW_Ver.ToString(); textBoxIdacMax.Text = DeviceConfig.Items.IDAC_MAX.ToString(); textBoxIdacMin.Text = DeviceConfig.Items.IDAC_MIN.ToString(); if (DeviceConfig.Items.trackpad_Bootloader == DeviceConfig.TPCONFIG.TP_WITH_BOOTLOADER) { checkBoxBootLoader.Checked = true; } else { checkBoxBootLoader.Checked = false; } if (DeviceConfig.Items.trackpad_ShopFloor == DeviceConfig.TPCONFIG.TP_TEST_ONLINE) { checkBoxSFCS.Checked = true; } else { checkBoxSFCS.Checked = false; } if (DeviceConfig.Items.trackpad_Function == DeviceConfig.TPCONFIG.TP_FUNCTION_ST) { radioButtonModel1.Checked = true; } if (DeviceConfig.Items.trackpad_Function == DeviceConfig.TPCONFIG.TP_FUNCTION_MTG) { radioButtonModel2.Checked = true; } if (DeviceConfig.Items.trackpad_Function == DeviceConfig.TPCONFIG.TP_FUNCTION_APA) { radioButtonModel3.Checked = true; } if (DeviceConfig.Items.trackpad_Interface == DeviceConfig.TPCONFIG.TP_INTERFACE_I2C) { radioButtonInterfaceI2C.Checked = true; } if (DeviceConfig.Items.trackpad_Interface == DeviceConfig.TPCONFIG.TP_INTERFACE_PS2) { radioButtonInterfacePS2.Checked = true; } if (DeviceConfig.Items.trackpad_Interface == DeviceConfig.TPCONFIG.TP_INTERFACE_SMB) { radioButtonInterfaceSMbus.Checked = true; } if (DeviceConfig.Items.trackpad_TactileSwitch == DeviceConfig.TPCONFIG.TP_REMOTE_CONTROL) { radioButtonSwitch1.Checked = true; } if (DeviceConfig.Items.trackpad_TactileSwitch == DeviceConfig.TPCONFIG.TP_NORMAL_BUTTON) { radioButtonSwitch2.Checked = true; } if (DeviceConfig.Items.trackpad_TactileSwitch == DeviceConfig.TPCONFIG.TP_CLICK_PAD) { radioButtonSwitch3.Checked = true; } }