public void Activate() { if (MainV2.comPort.MAV.param["H_SWASH_TYPE"] == null) { this.Enabled = false; return; } timer.Tick += new EventHandler(timer_Tick); timer.Enabled = true; timer.Interval = 100; timer.Start(); // swash servo pos mavlinkNumericUpDown1min.setup(800, 1400, 1, 1, "HS1_MIN", MainV2.comPort.MAV.param); mavlinkNumericUpDown1max.setup(1600, 2200, 1, 1, "HS1_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDown2min.setup(800, 1400, 1, 1, "HS2_MIN", MainV2.comPort.MAV.param); mavlinkNumericUpDown2max.setup(1600, 2200, 1, 1, "HS2_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDown3min.setup(800, 1400, 1, 1, "HS3_MIN", MainV2.comPort.MAV.param); mavlinkNumericUpDown3max.setup(1600, 2200, 1, 1, "HS3_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDownpitchmax.setup(10, 65, 100, 1, "H_PIT_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDownrollmax.setup(10, 65, 100, 1, "H_ROL_MAX", MainV2.comPort.MAV.param); mavlinkComboBoxTailType.setup(Utilities.ParameterMetaDataRepository.GetParameterOptionsInt("H_TAIL_TYPE"), "H_TAIL_TYPE", MainV2.comPort.MAV.param); mavlinkNumericUpDowntailspeed.setup(0, 1000, 1, 1, "H_TAIL_SPEED", MainV2.comPort.MAV.param); mavlinkNumericUpDownland_col_min.setup(0, 1000, 1, 1, "H_LAND_COL_MIN", MainV2.comPort.MAV.param); H_STAB_COL_MAX.setup(50, 100, 1, 1, "H_STAB_COL_MAX", MainV2.comPort.MAV.param); H_STAB_COL_MIN.setup(0, 50, 1, 1, "H_STAB_COL_MIN", MainV2.comPort.MAV.param); H_COLYAW.setup(0, 5, 1, 1, "H_COLYAW", MainV2.comPort.MAV.param); mavlinkudH_RSC_RATE.setup(0, 60, 1, 1, "H_RSC_RAMP_TIME", MainV2.comPort.MAV.param); mavlinkNumericUpDownrunuptime.setup(0, 60, 1, 1, "H_RSC_RUNUP_TIME", MainV2.comPort.MAV.param); H_RSC_MODE.setup(Utilities.ParameterMetaDataRepository.GetParameterOptionsInt("H_RSC_MODE"), "H_RSC_MODE", MainV2.comPort.MAV.param); mavlinkudH_RSC_SETPOINT.setup(800, 2200, 1, 1, "H_RSC_SETPOINT", MainV2.comPort.MAV.param); startup = true; try { if (MainV2.comPort.MAV.param.ContainsKey("H_SWASH_TYPE")) { CCPM.Checked = MainV2.comPort.MAV.param["H_SWASH_TYPE"].ToString() == "0" ? true : false; H_SWASH_TYPE.Checked = !CCPM.Checked; } if (MainV2.comPort.MAV.param.ContainsKey("H_FLYBAR_MODE")) { fbl_modeFBL.Checked = MainV2.comPort.MAV.param["H_FLYBAR_MODE"].ToString() == "0" ? true : false; } foreach (string value in MainV2.comPort.MAV.param.Keys) { if (value == "") { continue; } Control[] control = this.Controls.Find(value, true); if (control.Length > 0) { if (control[0].GetType() == typeof(TextBox)) { TextBox temp = (TextBox)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Text = option; } if (control[0].GetType() == typeof(NumericUpDown)) { NumericUpDown temp = (NumericUpDown)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Text = option; } if (control[0].GetType() == typeof(CheckBox)) { CheckBox temp = (CheckBox)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Checked = option == "1" ? true : false; } if (control[0].GetType() == typeof(MyTrackBar)) { Controls.MyTrackBar temp = (MyTrackBar)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Value = int.Parse(option); } } } HS1_REV.Checked = MainV2.comPort.MAV.param["HS1_REV"].ToString() == "-1"; HS2_REV.Checked = MainV2.comPort.MAV.param["HS2_REV"].ToString() == "-1"; HS3_REV.Checked = MainV2.comPort.MAV.param["HS3_REV"].ToString() == "-1"; HS4_REV.Checked = MainV2.comPort.MAV.param["HS4_REV"].ToString() == "-1"; } catch { } startup = false; }
public void Activate() { if (MainV2.comPort.MAV.param["H_SWASH_TYPE"] == null) { this.Enabled = false; return; } timer.Tick += new EventHandler(timer_Tick); timer.Enabled = true; timer.Interval = 100; timer.Start(); mavlinkNumericUpDown1min.setup(800, 1400, 1, 1, "HS1_MIN", MainV2.comPort.MAV.param); mavlinkNumericUpDown1max.setup(1600, 2200, 1, 1, "HS1_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDown2min.setup(800, 1400, 1, 1, "HS2_MIN", MainV2.comPort.MAV.param); mavlinkNumericUpDown2max.setup(1600, 2200, 1, 1, "HS2_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDown3min.setup(800, 1400, 1, 1, "HS3_MIN", MainV2.comPort.MAV.param); mavlinkNumericUpDown3max.setup(1600, 2200, 1, 1, "HS3_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDownpitchmax.setup(10, 65, 100, 1, "H_PIT_MAX", MainV2.comPort.MAV.param); mavlinkNumericUpDownrollmax.setup(10, 65, 100, 1, "H_ROL_MAX", MainV2.comPort.MAV.param); H_STAB_COL_MAX.setup(50, 100, 1, 1, "H_STAB_COL_MAX", MainV2.comPort.param); H_STAB_COL_MIN.setup(0, 50, 1, 1, "H_STAB_COL_MIN", MainV2.comPort.param); H_COLYAW.setup(0, 5, 1, 1, "H_COLYAW", MainV2.comPort.param); H_RSC_RATE.setup(0, 60, 100, 1, "H_RSC_RATE", MainV2.comPort.param); H_RSC_MODE.setup(typeof(rsc_mode), "H_RSC_MODE", MainV2.comPort.param); H_GOV_SETPOINT.setup(800, 2200, 1, 1, "H_GOV_SETPOINT", MainV2.comPort.param); startup = true; try { if (MainV2.comPort.MAV.param.ContainsKey("H_SWASH_TYPE")) { CCPM.Checked = MainV2.comPort.MAV.param["H_SWASH_TYPE"].ToString() == "0" ? true : false; H_SWASH_TYPE.Checked = !CCPM.Checked; } if (MainV2.comPort.MAV.param.ContainsKey("H_FLYBAR_MODE")) { fbl_modeFBL.Checked = MainV2.comPort.MAV.param["H_FLYBAR_MODE"].ToString() == "0" ? true : false; Flybar_mode_flybar.Checked = !fbl_modeFBL.Checked; } foreach (string value in MainV2.comPort.MAV.param.Keys) { if (value == "") { continue; } Control[] control = this.Controls.Find(value, true); if (control.Length > 0) { if (control[0].GetType() == typeof(TextBox)) { TextBox temp = (TextBox)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Text = option; } if (control[0].GetType() == typeof(NumericUpDown)) { NumericUpDown temp = (NumericUpDown)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Text = option; } if (control[0].GetType() == typeof(CheckBox)) { CheckBox temp = (CheckBox)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Checked = option == "1" ? true : false; } if (control[0].GetType() == typeof(MyTrackBar)) { ArdupilotMega.Controls.MyTrackBar temp = (MyTrackBar)control[0]; string option = MainV2.comPort.MAV.param[value].ToString(); temp.Value = int.Parse(option); } } } HS1_REV.Checked = MainV2.comPort.MAV.param["HS1_REV"].ToString() == "-1"; HS2_REV.Checked = MainV2.comPort.MAV.param["HS2_REV"].ToString() == "-1"; HS3_REV.Checked = MainV2.comPort.MAV.param["HS3_REV"].ToString() == "-1"; HS4_REV.Checked = MainV2.comPort.MAV.param["HS4_REV"].ToString() == "-1"; } catch { } startup = false; }