/// <summary> /// Get settings from sensor flash /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RefreshFlashSettings_Click(object sender, EventArgs e) { bool backgroundWasRunning = AcquisitionWorker.IsBusy; if (backgroundWasRunning) { StopAcquisitionThread(); } if (!activeSingleTact.PullSettingsFromHardware()) { MessageBox.Show( "Failed to retrieve current settings.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { byte fwRev = activeSingleTact.firmwareVersion; firmwareLabel.Text = fwRev.ToString(); textAddress.Text = "0x" + activeSingleTact.Settings.I2CAddress.ToString("X2"); textGain.Text = activeSingleTact.Settings.ReferenceGain.ToString("00") + " (" + (activeSingleTact.Settings.ReferenceGain + 1).ToString("0") + "x)"; textTare.Text = activeSingleTact.Settings.Baselines.ElementAt(0).ToString("0000"); textScale.Text = activeSingleTact.Settings.Scaling.ToString(); i2cAddressInputComboBox_.SelectedIndex = activeSingleTact.Settings.I2CAddress - reservedAddresses; } catch (Exception ex) { Console.WriteLine(ex.ToString()); MessageBox.Show("Invalid settings", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (backgroundWasRunning) { StartAcquisitionThread(); } }
private void RefreshFlashSettings_Click(object sender, EventArgs e) { bool backgroundWasRunning = AcquisitionWorker.IsBusy; if (backgroundWasRunning) { StopAcquisitionThread(); } if (!activeSingleTact.PullSettingsFromHardware()) { MessageBox.Show( "Failed to retrieve current settings.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (backgroundWasRunning) { StartAcquisitionThread(); } }