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;
        }
        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)
            {
                Enabled = false;
                return;
            }

            timer.Tick += timer_Tick;

            timer.Enabled  = true;
            timer.Interval = 100;
            timer.Start();

            // setup graph
            GraphPane myPane = zedGraphControl1.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text            = "Collective Control";
            myPane.XAxis.Title.Text      = "Collective Input (%)";
            myPane.XAxis.Scale.Min       = 0;
            myPane.XAxis.Scale.Max       = 100;
            myPane.XAxis.Scale.BaseTic   = 0;
            myPane.XAxis.Scale.MinorStep = 10;
            myPane.XAxis.Scale.MajorStep = 20;
            myPane.YAxis.Title.Text      = "Collective Output";
            myPane.YAxis.Scale.Min       = 0;
            myPane.YAxis.Scale.Max       = 1000;
            myPane.YAxis.Scale.BaseTic   = 0;
            myPane.YAxis.Scale.MinorStep = 100;
            myPane.YAxis.Scale.MajorStep = 200;

            mavlinkNumericUpDownH_PHANG.setup(0, 99, 1, 1f, "H_PHANG", MainV2.comPort.MAV.param);
            mavlinkCheckBoxatc_piro_comp.setup(1, 0, "ATC_PIRO_COMP", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownh_sv_test.setup(0, 99, 1, 1, "H_SV_TEST", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownatc_hovr_rol_trm.setup(0, 99, 100, 0.1f, "ATC_HOVR_ROL_TRM", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownh_cyc_max.setup(0, 99, 100f, 0.1f, "H_CYC_MAX", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownH_RSC_CRITICAL.setup(0, 99, 1, 1f, "H_RSC_CRITICAL", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownh_rsc_max.setup(800, 2200, 1, 1f, "H_RSC_MAX", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownh_rsc_min.setup(800, 2200, 1, 1f, "H_RSC_MIN", MainV2.comPort.MAV.param);
            h_rsc_rev.setup(-1, 1, "H_RSC_REV", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownh_rsc_power_high.setup(0, 99, 1, 1f, "H_RSC_POWER_HIGH", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownh_rsc_power_low.setup(0, 99, 1, 1f, "H_RSC_POWER_LOW", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownh_rsc_idle.setup(0, 99, 1, 1f, "H_RSC_IDLE", MainV2.comPort.MAV.param);

            mavlinkNumericUpDownim_stab_col_1.setup(0, 1000, 1, 1f, "IM_STAB_COL_1", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownim_stab_col_2.setup(0, 1000, 1, 1f, "IM_STAB_COL_2", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownim_stab_col_3.setup(0, 1000, 1, 1f, "IM_STAB_COL_3", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownim_stab_col_4.setup(0, 1000, 1, 1f, "IM_STAB_COL_4", MainV2.comPort.MAV.param);
            mavlinkNumericUpDownim_acro_col_exp.setup(0, 1, 1, 0.01f, "IM_ACRO_COL_EXP", MainV2.comPort.MAV.param);

            mavlinkComboBoxTailType.setup(
                ParameterMetaDataRepository.GetParameterOptionsInt("H_TAIL_TYPE",
                                                                   MainV2.comPort.MAV.cs.firmware.ToString()), "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_COLYAW.setup(0, 5, 1, 0.01f, "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(
                ParameterMetaDataRepository.GetParameterOptionsInt("H_RSC_MODE",
                                                                   MainV2.comPort.MAV.cs.firmware.ToString()), "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;
                    }

                    var control = Controls.Find(value, true);
                    if (control.Length > 0)
                    {
                        if (control[0].GetType() == typeof(TextBox))
                        {
                            var temp   = (TextBox)control[0];
                            var option = MainV2.comPort.MAV.param[value].ToString();
                            temp.Text = option;
                        }
                        if (control[0].GetType() == typeof(NumericUpDown))
                        {
                            var temp   = (NumericUpDown)control[0];
                            var option = MainV2.comPort.MAV.param[value].ToString();
                            temp.Text = option;
                        }
                        if (control[0].GetType() == typeof(CheckBox))
                        {
                            var temp   = (CheckBox)control[0];
                            var option = MainV2.comPort.MAV.param[value].ToString();
                            temp.Checked = option == "1" ? true : false;
                        }
                        if (control[0].GetType() == typeof(MyTrackBar))
                        {
                            var temp   = (MyTrackBar)control[0];
                            var 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;
        }