private void loadChannelControls() { int vPos = 2; channelControls = new Dictionary <int, RcChannelControl>(); RcChannelControl ctl = null; for (int i = 0; i < 8; i++) { ctl = new RcChannelControl(); ctl.ColoredBorders = coloredBorders; ctl.ChannelNumber = i; ctl.SettingsChanged += new EventHandler(ctl_SettingsChanged); ctl.Location = new System.Drawing.Point(2, vPos); ctl.BorderColor = GuiStandards.ChannelColors[i]; channelControls.Add(i, ctl); this.Controls.Add(ctl); vPos += ctl.Size.Height + 3; } vPos = createFrequencyEditor(vPos); this.Size = new System.Drawing.Size(ctl.Size.Width + 6, vPos + 2); }
private void applyNewSettings() { for (int i = 0; i < 8; i++) { RcChannelControl ctl = channelControls[i]; connector.channelSettings[i].DutyCycleS = calculateDutyCycle(ctl.Value, ctl.Calibration_center, ctl.Calibration_maxDeviation); connector.channelSettings[i].Enabled = ctl.ChannelEnabled; connector.channelSettings[i].Frequency = pwmFrequency; } connector.SynchronousFrequency = pwmFrequency; connector.applyChannelSettings(); }
private void loadChannelControls() { int vPos = 2; channelControls = new Dictionary<int, RcChannelControl>(); RcChannelControl ctl = null; for (int i = 0; i < 8; i++) { ctl = new RcChannelControl(); ctl.ColoredBorders = coloredBorders; ctl.ChannelNumber = i; ctl.SettingsChanged += new EventHandler(ctl_SettingsChanged); ctl.Location = new System.Drawing.Point(2, vPos); ctl.BorderColor = GuiStandards.ChannelColors[i]; channelControls.Add(i, ctl); this.Controls.Add(ctl); vPos += ctl.Size.Height + 3; } vPos = createFrequencyEditor(vPos); this.Size = new System.Drawing.Size(ctl.Size.Width + 6, vPos + 2); }