/// <summary> /// STarts calibration /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void calibrateToolStripMenuItem_Click(object sender, EventArgs e) { if (BadFirmwareVersion) { MessageBox.Show("The firmware must be updated before calibrating"); return; } SlowUpdateBtn.On = true; SlowUpdateBtn_ButtonPressed(null, null); AcqTimer.Enabled = false; DlgCalibrate2 dlg = new DlgCalibrate2(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { CalData = dlg.calData; if (CalData.IsDefault == false) { UncalLabel.Text = ""; } if (lightedButton28.On) { SetHighRange(); } else if (lightedButton29.On) { SetLowRange(); } } AcqTimer.Enabled = true; }
private void Form1_Load(object sender, EventArgs e) { #if !DEBUG flashVirginDeviceToolStripMenuItem.Visible = false; #endif statusStrip1.Items.Add(""); statusStrip1.Items.Add(""); if (File.Exists(Constants.SettingsFile)) { // There's a settings file here. See if we can load it try { AppSettings = (Settings)SerDes.Deserialize(typeof(Settings), File.ReadAllText(Constants.SettingsFile)); } catch (Exception ex) { // Something went wrong. Delete it. MessageBox.Show(string.Format("There was a problem loading your settings from: {0}. The exception was: {1}", Constants.SettingsFile, ex.Message)); File.Delete(Constants.SettingsFile); } } // Never want this to persist. Too confusing AppSettings.Math = 1.0; AppSettings.MathLabel = ""; label12.Visible = false; // If needed directories aren't present, create them if (Directory.Exists(Constants.DataFilePath) == false) { Directory.CreateDirectory(Constants.DataFilePath); } // Check if cal data exists and use it if it does if (File.Exists(Constants.CalibrationFile)) { CalData = (CalibrationClass)SerDes.Deserialize(typeof(CalibrationClass), File.ReadAllText(Constants.CalibrationFile)); } else { MessageBox.Show("A calibration file could not be loaded. A default file will be created"); CalData = new CalibrationClass(); } // Check if the user has calibrated the device yet if (CalData.IsDefault) { UncalLabel.Text = "UNCALIBRATED"; } else { UncalLabel.Text = ""; } // Indicate we are NOT in relative mode by hiding the label RelModeLabel.Visible = false; LoggingLabel.Visible = false; //Label_2p5sps.Visible = true; //Label_1ksps.Visible = false; //SampleRate = SampleRateEnum.Slow_2p5Hz; DcBtn_Pressed(null, null); LoadFontData(); InitGraphs(); Text += " (" + Constants.Version.ToString("0.000") + ")"; // Not ready yet analysisToolStripMenuItem.Visible = false; LEDKickerTimer.Enabled = true; TryConnect(); SetTempStatus(int.MaxValue); }