void serial_AllConfigCommunicationReceived(Communication.Frames.Configuration.AllConfig config) { updating_gui = true; this.config = config; MethodInvoker m = delegate() { _cbInvert1.Checked = config.servo_reverse[0]; _cbInvert2.Checked = config.servo_reverse[1]; _cbInvert3.Checked = config.servo_reverse[2]; _cbInvert4.Checked = config.servo_reverse[3]; _lblInterpretation1.Text = ""; _lblInterpretation2.Text = ""; _lblInterpretation3.Text = ""; _lblInterpretation4.Text = ""; ComboBox[] cbn = { _cbInputFunction1, _cbInputFunction2, _cbInputFunction3, _cbInputFunction4 }; cbn[0].SelectedIndex = 4; cbn[1].SelectedIndex = 4; cbn[2].SelectedIndex = 4; cbn[3].SelectedIndex = 4; if (config.channel_ap <= cbn.Length && config.channel_ap > 0) cbn[config.channel_ap - 1].SelectedIndex = 3; if (config.channel_motor <= cbn.Length && config.channel_motor > 0) cbn[config.channel_motor - 1].SelectedIndex = 2; if (config.channel_pitch <= cbn.Length && config.channel_pitch > 0) cbn[config.channel_pitch - 1].SelectedIndex = 0; if (config.channel_roll <= cbn.Length && config.channel_roll > 0) cbn[config.channel_roll - 1].SelectedIndex = 1; //if (config.channel_yaw <= cbn.Length && config.channel_yaw > 0) // cbn[config.channel_yaw - 1].SelectedIndex = 2; if (config.control_mixing < _cbMixing.Items.Count) _cbMixing.SelectedIndex = Math.Max(0, Math.Min(10, config.control_mixing)); _hsPitchSensitivity.Value = Math.Max(0, (int)(config.pid_pitch2elevator_p * 10.0)); _hsRollSensitivity.Value = Math.Max(0, (int)(config.pid_roll2aileron_p * 10.0)); _cbAutothrottle.Checked = config.auto_throttle_enabled; _hsbCruiseThrottle.Value = Math.Max(0, config.auto_throttle_cruise_pct); _hsbCruiseThrottle_Scroll(null, new ScrollEventArgs(ScrollEventType.EndScroll, _hsbCruiseThrottle.Value)); updating_gui = false; }; try { BeginInvoke(m); } catch { ; } }
void serial_AllConfigCommunicationReceived(Communication.Frames.Configuration.AllConfig config) { MethodInvoker m = delegate() { timer.Stop(); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }; try { BeginInvoke(m); } catch { ; } }
void serial_AllConfigCommunicationReceived(Communication.Frames.Configuration.AllConfig config) { if (this.config_original == null) config_original = config; guiUpdateBusy = true; _tmrGuiUpdateBusy.Enabled = true; _tmrGuiUpdateBusy.Start(); this.config = config; MethodInvoker m = delegate() { _cbInvert1.Checked = config.servo_reverse[0]; _cbInvert2.Checked = config.servo_reverse[1]; _cbInvert3.Checked = config.servo_reverse[2]; _cbInvert4.Checked = config.servo_reverse[3]; _cbInvert5.Checked = config.servo_reverse[4]; _cbInvert6.Checked = config.servo_reverse[5]; ComboBox[] cbn = { _cbInputFunction1, _cbInputFunction2, _cbInputFunction3, _cbInputFunction4, _cbInputFunction5, _cbInputFunction6 }; cbn[0].SelectedIndex = 5; cbn[1].SelectedIndex = 5; cbn[2].SelectedIndex = 5; cbn[3].SelectedIndex = 5; cbn[4].SelectedIndex = 5; cbn[5].SelectedIndex = 5; if (config.channel_ap <= 6 && config.channel_ap > 0) cbn[config.channel_ap - 1].SelectedIndex = 4; if (config.channel_motor <= 6 && config.channel_motor > 0) cbn[config.channel_motor - 1].SelectedIndex = 3; if (config.channel_pitch <= 6 && config.channel_pitch > 0) cbn[config.channel_pitch - 1].SelectedIndex = 0; if (config.channel_roll <= 6 && config.channel_roll > 0) cbn[config.channel_roll - 1].SelectedIndex = 1; if (config.channel_yaw <= 6 && config.channel_yaw > 0) cbn[config.channel_yaw - 1].SelectedIndex = 2; if (config.control_mixing < _cbMixing.Items.Count) _cbMixing.SelectedIndex = config.control_mixing; _hsPitchSensitivity.Value = Math.Max(0, (int)(config.pid_pitch2elevator_p * 10.0)); _hsRollSensitivity.Value = Math.Max(0, (int)(config.pid_roll2aileron_p * 10.0)); //_hsRollSensitivity_ValueChanged(null, ScrollEventArgs.Empty); //_hsPitchSensitivity_ValueChanged(null, ScrollEventArgs.Empty); _cbAutothrottle.Checked = config.auto_throttle_enabled; _hsbCruiseThrottle.Value = Math.Max(0, config.auto_throttle_cruise_pct); _hsbCruiseThrottle_Scroll(null, new ScrollEventArgs(ScrollEventType.EndScroll, _hsbCruiseThrottle.Value)); }; try { BeginInvoke(m); } catch { ; } }
void serial_AllConfigCommunicationReceived(Communication.Frames.Configuration.AllConfig config) { if (this.config_original == null) { config_original = config; } guiUpdateBusy = true; _tmrGuiUpdateBusy.Enabled = true; _tmrGuiUpdateBusy.Start(); this.config = config; MethodInvoker m = delegate() { _cbInvert1.Checked = config.servo_reverse[0]; _cbInvert2.Checked = config.servo_reverse[1]; _cbInvert3.Checked = config.servo_reverse[2]; _cbInvert4.Checked = config.servo_reverse[3]; _cbInvert5.Checked = config.servo_reverse[4]; _cbInvert6.Checked = config.servo_reverse[5]; ComboBox[] cbn = { _cbInputFunction1, _cbInputFunction2, _cbInputFunction3, _cbInputFunction4, _cbInputFunction5, _cbInputFunction6 }; cbn[0].SelectedIndex = 5; cbn[1].SelectedIndex = 5; cbn[2].SelectedIndex = 5; cbn[3].SelectedIndex = 5; cbn[4].SelectedIndex = 5; cbn[5].SelectedIndex = 5; if (config.channel_ap <= 6 && config.channel_ap > 0) { cbn[config.channel_ap - 1].SelectedIndex = 4; } if (config.channel_motor <= 6 && config.channel_motor > 0) { cbn[config.channel_motor - 1].SelectedIndex = 3; } if (config.channel_pitch <= 6 && config.channel_pitch > 0) { cbn[config.channel_pitch - 1].SelectedIndex = 0; } if (config.channel_roll <= 6 && config.channel_roll > 0) { cbn[config.channel_roll - 1].SelectedIndex = 1; } if (config.channel_yaw <= 6 && config.channel_yaw > 0) { cbn[config.channel_yaw - 1].SelectedIndex = 2; } if (config.control_mixing < _cbMixing.Items.Count) { _cbMixing.SelectedIndex = config.control_mixing; } _hsPitchSensitivity.Value = Math.Max(0, (int)(config.pid_pitch2elevator_p * 10.0)); _hsRollSensitivity.Value = Math.Max(0, (int)(config.pid_roll2aileron_p * 10.0)); //_hsRollSensitivity_ValueChanged(null, ScrollEventArgs.Empty); //_hsPitchSensitivity_ValueChanged(null, ScrollEventArgs.Empty); _cbAutothrottle.Checked = config.auto_throttle_enabled; _hsbCruiseThrottle.Value = Math.Max(0, config.auto_throttle_cruise_pct); _hsbCruiseThrottle_Scroll(null, new ScrollEventArgs(ScrollEventType.EndScroll, _hsbCruiseThrottle.Value)); }; try { BeginInvoke(m); } catch { ; } }
void serial_AllConfigCommunicationReceived(Communication.Frames.Configuration.AllConfig config) { updating_gui = true; this.config = config; MethodInvoker m = delegate() { _cbInvert1.Checked = config.servo_reverse[0]; _cbInvert2.Checked = config.servo_reverse[1]; _cbInvert3.Checked = config.servo_reverse[2]; _cbInvert4.Checked = config.servo_reverse[3]; _lblInterpretation1.Text = ""; _lblInterpretation2.Text = ""; _lblInterpretation3.Text = ""; _lblInterpretation4.Text = ""; ComboBox[] cbn = { _cbInputFunction1, _cbInputFunction2, _cbInputFunction3, _cbInputFunction4 }; cbn[0].SelectedIndex = 4; cbn[1].SelectedIndex = 4; cbn[2].SelectedIndex = 4; cbn[3].SelectedIndex = 4; if (config.channel_ap <= cbn.Length && config.channel_ap > 0) { cbn[config.channel_ap - 1].SelectedIndex = 3; } if (config.channel_motor <= cbn.Length && config.channel_motor > 0) { cbn[config.channel_motor - 1].SelectedIndex = 2; } if (config.channel_pitch <= cbn.Length && config.channel_pitch > 0) { cbn[config.channel_pitch - 1].SelectedIndex = 0; } if (config.channel_roll <= cbn.Length && config.channel_roll > 0) { cbn[config.channel_roll - 1].SelectedIndex = 1; } //if (config.channel_yaw <= cbn.Length && config.channel_yaw > 0) // cbn[config.channel_yaw - 1].SelectedIndex = 2; if (config.control_mixing < _cbMixing.Items.Count) { _cbMixing.SelectedIndex = Math.Max(0, Math.Min(10, config.control_mixing)); } _hsPitchSensitivity.Value = Math.Max(0, (int)(config.pid_pitch2elevator_p * 10.0)); _hsRollSensitivity.Value = Math.Max(0, (int)(config.pid_roll2aileron_p * 10.0)); _cbAutothrottle.Checked = config.auto_throttle_enabled; _hsbCruiseThrottle.Value = Math.Max(0, config.auto_throttle_cruise_pct); _hsbCruiseThrottle_Scroll(null, new ScrollEventArgs(ScrollEventType.EndScroll, _hsbCruiseThrottle.Value)); updating_gui = false; }; try { BeginInvoke(m); } catch { ; } }
void _serial_AllConfigCommunicationReceived(Communication.Frames.Configuration.AllConfig config) { MethodInvoker m = delegate() { is_updating = true; UncheckAll(); if ((config.osd_bitmask & 4) != 0) { Check("horizon"); } if ((config.osd_bitmask & 8192) != 0) { Check("Voltage battery 1"); } if ((config.osd_bitmask & 16384) != 0) { Check("Voltage battery 2"); } if ((config.osd_bitmask & 16) != 0) { Check("Current battery 1"); } if ((config.osd_bitmask & 256) != 0) { Check("mAh"); } if ((config.osd_bitmask & 512) != 0) { Check("Autopilot mode"); } if ((config.osd_bitmask & 128) != 0) { Check("GPS"); } if ((config.osd_bitmask & 2) != 0) { Check("Home arrow"); } if ((config.osd_bitmask & 32) != 0) { Check("Distance"); } if ((config.osd_bitmask & 1024) != 0) { Check("RC-receiver"); } if ((config.osd_bitmask & 32) != 0) { Check("Distance to home"); } if ((config.osd_bitmask & 4096) != 0) { Check("Vario"); } if ((config.osd_bitmask & 64) != 0) { Check("time"); } if ((config.osd_bitmask & 2048) != 0) { Check("Speed"); } if ((config.osd_bitmask & 1) != 0) { Check("Altitude"); } if ((config.osd_bitmask & 32768) != 0) { Check("block name"); } last_bitmask = config.osd_bitmask; try { _nud_rssi_low.Value = (decimal)config.osd_voltage_low; _nud_rssi_high.Value = (decimal)config.osd_voltage_high; } catch (Exception ex) { } if (config.osd_RssiMode >= 0 && config.osd_RssiMode < _cbRssi.Items.Count) { _cbRssi.SelectedIndex = config.osd_RssiMode; } is_updating = false; }; try { BeginInvoke(m); } catch { } }