public Generator(Device dev) { InitializeComponent(); zedGraphControl_gen_ch1.MasterPane[0].IsFontsScaled = false; zedGraphControl_gen_ch1.MasterPane[0].Title.IsVisible = false; zedGraphControl_gen_ch1.MasterPane[0].XAxis.MajorGrid.IsVisible = true; zedGraphControl_gen_ch1.MasterPane[0].XAxis.Title.IsVisible = false; zedGraphControl_gen_ch1.MasterPane[0].XAxis.IsVisible = false; zedGraphControl_gen_ch1.MasterPane[0].YAxis.MajorGrid.IsVisible = true; zedGraphControl_gen_ch1.MasterPane[0].YAxis.Title.IsVisible = false; zedGraphControl_gen_ch2.MasterPane[0].IsFontsScaled = false; zedGraphControl_gen_ch2.MasterPane[0].Title.IsVisible = false; zedGraphControl_gen_ch2.MasterPane[0].XAxis.MajorGrid.IsVisible = true; zedGraphControl_gen_ch2.MasterPane[0].XAxis.Title.IsVisible = false; zedGraphControl_gen_ch2.MasterPane[0].XAxis.IsVisible = false; zedGraphControl_gen_ch2.MasterPane[0].YAxis.MajorGrid.IsVisible = true; zedGraphControl_gen_ch2.MasterPane[0].YAxis.Title.IsVisible = false; channel1Pane = zedGraphControl_gen_ch1.GraphPane; channel2Pane = zedGraphControl_gen_ch2.GraphPane; this.device = dev; this.trackBar_ampl_ch1.Maximum = dev.genCfg.VRef; this.trackBar_ampl_ch2.Maximum = dev.genCfg.VRef; this.trackBar_ampl_ch1.Value = dev.genCfg.VRef / 2; this.trackBar_ampl_ch2.Value = dev.genCfg.VRef / 2; this.textBox_ampl_ch1.Text = (dev.genCfg.VRef / 2).ToString(); this.textBox_ampl_ch2.Text = (dev.genCfg.VRef / 2).ToString(); this.trackBar_offset_ch1.Maximum = dev.genCfg.VRef; this.trackBar_offset_ch2.Maximum = dev.genCfg.VRef; this.trackBar_offset_ch1.Value = dev.genCfg.VRef / 2; this.trackBar_offset_ch2.Value = dev.genCfg.VRef / 2; this.trackBar_offset_ch1.Text = (dev.genCfg.VRef / 2).ToString(); this.trackBar_offset_ch2.Text = (dev.genCfg.VRef / 2).ToString(); this.trackBar_phase_ch2.Value = 900; freq_ch1 = trackBar_freq_ch1.Value/10; freq_ch2 = trackBar_freq_ch2.Value/10; signal_leng = int.Parse(this.toolStripTextBox_signal_leng.Text); validate_control_ch2(); signalTimer = new System.Timers.Timer(200); signalTimer.Elapsed += new ElapsedEventHandler(Update_signal); signalTimer.Start(); dataSendingTimer = new System.Timers.Timer(5); dataSendingTimer.Elapsed += new ElapsedEventHandler(data_sending); }
public void connect_device(string port) { this.commState = CommsStates.CONNECTING; foreach (Device d in devices) { if (port.Equals(d.get_port())) { this.connectedDevice = d; break; } } if (connectedDevice.open_port()) { this.commState = CommsStates.CONNECTED; } else { this.commState = CommsStates.ERROR; } }
public Scope(Device dev) { InitializeComponent(); zedGraphControl_scope.MasterPane[0].IsFontsScaled = false; zedGraphControl_scope.MasterPane[0].Title.IsVisible = false; zedGraphControl_scope.MasterPane[0].XAxis.MajorGrid.IsVisible = true; zedGraphControl_scope.MasterPane[0].XAxis.Title.IsVisible = false; zedGraphControl_scope.MasterPane[0].YAxis.MajorGrid.IsVisible = true; zedGraphControl_scope.MasterPane[0].YAxis.Title.IsVisible = false; this.device = dev; ScopeDevice=device.scopeCfg; set_scope_default(); label_meas1.Text = ""; label_meas2.Text = ""; label_meas3.Text = ""; label_meas4.Text = ""; label_meas5.Text = ""; this.toolStripMenuItem_XY_plot.Enabled = false; validate_radio_btns(); validate_menu(); scopePane = zedGraphControl_scope.GraphPane; GUITimer = new System.Timers.Timer(5); GUITimer.Elapsed += new ElapsedEventHandler(Update_GUI); GUITimer.Start(); ZedTimer = new System.Timers.Timer(50); ZedTimer.Elapsed += new ElapsedEventHandler(Zed_update); ZedTimer.Start(); processSignal_th = new Thread(process_signals); Thread.Sleep(10); scope_start(); }