/// <summary> /// Добавить параметры калибровки /// </summary> private void AddCalibration(CalibrationProperties calibrationsProperies) { const uint PYTHON_CALIBRATOR_TIME_PULSE = 1; const uint PYTHON_CALIBRATOR_TIME_PERIOD = 2; const uint PYTHON_CALIBRATOR_AMPLITUDE_POSITIVE = 3; const uint PYTHON_CALIBRATOR_AMPLITUDE_NEGATIVE = 4; var calibParam = new RshRegister(); SetCalibrationParam(calibParam, PYTHON_CALIBRATOR_AMPLITUDE_POSITIVE, calibrationsProperies.PlusAmp / 8); SetCalibrationParam(calibParam, PYTHON_CALIBRATOR_AMPLITUDE_NEGATIVE, calibrationsProperies.MinusAmp / 8); SetCalibrationParam(calibParam, PYTHON_CALIBRATOR_TIME_PULSE, calibrationsProperies.Length); SetCalibrationParam(calibParam, PYTHON_CALIBRATOR_TIME_PERIOD, calibrationsProperies.Period); }
public void Init(bool TimerChecked, RshInitMemory rshMemory, RshInitPort rshPort, CalibrationProperties calibrationProperties) { Logging.WriteToLog("Connection.Init(...)"); AddCalibration(calibrationProperties); InitRshMemory(rshMemory); InitRshPort(rshPort); }
public void Connect(bool TimerChecked, RshInitMemory rshMemory, RshInitPort rshPort, CalibrationProperties calibrationProperties) { Connected = connection.Connect(TimerChecked, rshMemory, rshPort, calibrationProperties); if (Processor.Scenario.Any(x => x.GetType() == typeof(ProcessingSynchro))) InitSynchroOperation(rshMemory); }
/// <summary> /// Выполнить подключение к прибору /// </summary> public bool Connect(bool TimerChecked, RshInitMemory rshMemory, RshInitPort rshPort, CalibrationProperties calibrationProperties) { RSH_API st; //Код выполнения операции. bool res = true; Logging.WriteToLog("Connection.Connect(...)"); try { EstablishConnection(); AddCalibration(calibrationProperties); AddBoardPortInfo(); InitRshMemory(rshMemory); InitRshPort(rshPort); Connected = true; Logging.WriteToLog(" the device is connected!"); } catch (IOException e) { Connected = false; st = RSH_API.NET_TCPSOCKETCONNECTFAILED;//(RSH_API)Enum.Parse(typeof(RSH_API), e.Message.Substring(9)); SayGoodBye(st); res = false; } return res; }
private void buttonOk_Click(object sender, EventArgs e) { // TemporaryFileInfo //propsTfl.comment = textBoxDescription.Text; propsTfl.pythonSettings.startType = (uint)RshInitADC.StartTypeBit.Internal; if (this.radioButtonIncrease.Checked) propsTfl.pythonSettings.controlSynchro = (uint)RshInitADC.ControlSynchroBit.SlopeFront; else propsTfl.pythonSettings.controlSynchro = (uint)RshInitADC.ControlSynchroBit.SlopeDecline; propsTfl.pythonSettings.threshold = (double)(numericUpDownSynchronization.Value) / 16 / 128 / 10; if (this.radioButtonOneChannel.Checked) { propsTfl.pythonSettings.channels = new RshChannel[1]; propsTfl.pythonSettings.channels[0] = new RshChannel(); propsTfl.pythonSettings.channels[0].control = (uint)RshChannel.ControlBit.Used; propsTfl.pythonSettings.channels[0].delta = (double)numericUpDownDelta1.Value; propsTfl.pythonSettings.channels[0].gain = Convert.ToUInt32(comboBoxGain1.SelectedItem); } else { propsTfl.pythonSettings.channels = new RshChannel[2]; propsTfl.pythonSettings.channels[0] = new RshChannel(); propsTfl.pythonSettings.channels[0].control = (uint)RshChannel.ControlBit.Used; propsTfl.pythonSettings.channels[0].delta = (double)numericUpDownDelta1.Value; propsTfl.pythonSettings.channels[0].gain = Convert.ToUInt32(comboBoxGain1.SelectedItem); propsTfl.pythonSettings.channels[1] = new RshChannel(); propsTfl.pythonSettings.channels[1].control = (uint)RshChannel.ControlBit.Used; propsTfl.pythonSettings.channels[1].delta = (double)numericUpDownDelta2.Value; propsTfl.pythonSettings.channels[1].gain = Convert.ToUInt32(comboBoxGain2.SelectedItem); } propsTfl.pythonSettings.frequency = Convert.ToUInt32(Convert.ToDouble(comboBoxFrequency.SelectedItem) * 10e5); propsTfl.pythonSettings.bufferSize = (uint)(Convert.ToUInt32(comboBoxAscanLength.SelectedItem)); propsTfl.pythonSettings.hysteresis = (uint)numericUpDownHysteresis.Value; propsTfl.pythonSettings.preHistory = (uint)numericUpDownPrehistory.Value / 8; propsTfl.pythonSettings.waitTime = (uint) numericUpDownWaittime.Value; // Digital Port uint portVal = 0; portVal += Convert.ToUInt32(checkBox1.Checked); portVal += Convert.ToUInt32(checkBox3.Checked) * 2; portVal += Convert.ToUInt32(checkBox5.Checked) * 4; portVal += Convert.ToUInt32(checkBox7.Checked) * 8; portVal += Convert.ToUInt32(radioButtonAttenuation2.Checked) * 16; portVal += Convert.ToUInt32(checkBoxCalibration.Checked) * 32; portVal += Convert.ToUInt32(radioButtonAttenuation4.Checked) * 64; portVal += Convert.ToUInt32(checkBox15.Checked) * 128; propsTfl.pythonSettings.digitalPort = portVal; // Centipede.Settings CalibrationProperties cp; if (checkBoxCalibration.Checked) cp = new CalibrationProperties( (uint)this.numericUpDownPlusPulseAmp.Value, (uint)this.numericUpDownMinusPulseAmp.Value, (uint)this.numericUpDownPulseLength.Value, (uint)this.numericUpDownPeriod.Value); else cp = new CalibrationProperties(0, 0, 8, 1020); Settings.Instance.Init( PictureCoords.Zoom, Convert.ToDouble(this.numericUpDownAcquisitionStep.Value), 1 / Convert.ToDouble(this.comboBoxFrequency.SelectedItem) * 10e2, Convert.ToDouble(this.trackBarWetness.Value), Convert.ToString(this.comboBoxPalette.SelectedItem), Convert.ToInt32(this.numericUpDownRepetitionRate.Value), cp); Settings.Instance.GroundTypeIndex = comboBoxGroundType.SelectedIndex; if (radioButtonChannel1.Checked) Settings.Instance.ChannelNum = 0; else if (radioButtonChannel2.Checked) Settings.Instance.ChannelNum = 1; if (radioButtonManual.Checked) Settings.Instance.Timer = false; else if (radioButtonTimer.Checked) Settings.Instance.Timer = true; Settings.Instance.GpsMode = (GPSMode)(comboBoxGPS.SelectedIndex); // other //ColorPalette.Instance.Set(comboBoxPalette.Items[comboBoxPalette.SelectedIndex].ToString()); if (this.checkBoxMakeDefault.Checked) SaveDefaultSettings(propsTfl); RawDataProcessingInit(propsTfl.pythonSettings); this.DialogResult = DialogResult.OK; logger.Info("Closing FormProperties!"); }