bool ProcessCalibrationNoAttenuator(UInt16 nCaptureDelay = 0) { if (!DeviceInterface.IsPortOpen()) { LOGWarning("Port not open, i try to autodetect analyzer"); AutoDetectSerialPort(); } if (DeviceInterface.GetDevice().HaveLogDetector) { LOGDraw("Calibration in progress using logarithmic detector..", true); DeviceInterface.RunCalibration(MyNotifier, 9999, false); } if (DeviceInterface.GetDevice().HaveLinDetector) { LOGDraw("Calibration in progress using linear detector..", true); DeviceInterface.RunCalibration(MyNotifier, 9999, true); } DeviceInterface.SaveCalibration(Program.CalibrationPath); bCalibrationAvailable = true; LOGDraw("done."); return(true); }
bool ProcessCalibration(bool AllAttenuatorforced = false, UInt16 nCaptureDelay = 0) { if (!CurrentDeviceDef.Attenuator) { return(ProcessCalibrationNoAttenuator()); } DialogResult Result; if (AllAttenuatorforced) { Result = MessageBox.Show("We will run calibration for all attenuators setup", "Need calibration", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } else { Result = MessageBox.Show("Run calibration for all attenuators setup ?", "Need calibration", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); } if (Result == DialogResult.Cancel) { LOGDraw(" canceled", true); return(false); } else { AttLevel Current = (AttLevel)AttLevelcomboBox.SelectedItem; if (Result == DialogResult.No) { if (DeviceInterface.GetDevice().HaveLogDetector) { LOGDraw("Calibration for " + Current.ToString() + " attenuator, using logarithmic detector", true); DeviceInterface.SetAttenuatorLevel(Current, Current); DeviceInterface.RunCalibration(MyNotifier, 9999, false); } if (DeviceInterface.GetDevice().HaveLinDetector) { LOGDraw("Calibration for " + Current.ToString() + " attenuator, using linear detector..", true); DeviceInterface.SetAttenuatorLevel(Current, Current); DeviceInterface.RunCalibration(MyNotifier, 9999, true); } DeviceInterface.SaveCalibration(Program.CalibrationPath); bCalibrationAvailable = true; LOGDraw("done."); } else { foreach (AttLevel Level in Enum.GetValues(typeof(AttLevel))) { if (DeviceInterface.GetDevice().HaveLogDetector) { LOGDraw("Calibration for " + Level.ToString() + " attenuator, using logarihtmic detector..", true); DeviceInterface.SetAttenuatorLevel(Level, Level); DeviceInterface.RunCalibration(MyNotifier, 4000, false); } if (DeviceInterface.GetDevice().HaveLinDetector) { LOGDraw("Calibration for " + Level.ToString() + " attenuator, using linear detector..", true); DeviceInterface.SetAttenuatorLevel(Level, Level); DeviceInterface.RunCalibration(MyNotifier, 4000, true); } LOGDraw("done."); } DeviceInterface.SaveCalibration(Program.CalibrationPath); bCalibrationAvailable = true; if (Program.Save.AttCal) { DeviceInterface.SetAttenuatorLevel(Current, Current); } else { DeviceInterface.SetAttenuatorLevel(Current, AttLevel._0dB); } } return(true); } }