示例#1
0
        public void Activate()
        {
            Hashtable copy = new Hashtable(MainV2.comPort.MAV.param);

            foreach (string item in copy.Keys)
            {
                if (item.EndsWith("_FUNCTION"))
                {
                    switch (MainV2.comPort.MAV.param[item].ToString())
                    {
                    case "6":
                        mavlinkComboBoxPan.Text = item.Replace("_FUNCTION", "");
                        break;

                    case "7":
                        mavlinkComboBoxTilt.Text = item.Replace("_FUNCTION", "");
                        break;

                    case "8":
                        mavlinkComboBoxRoll.Text = item.Replace("_FUNCTION", "");
                        break;

                    case "10":
                        comboBox1.Text = item.Replace("_FUNCTION", "");
                        break;

                    default:
                        break;
                    }
                }
            }

            startup = false;

            try
            {
                updateShutter();
                updatePitch();
                updateRoll();
                updateYaw();

                CHK_stab_tilt.setup(1, 0, ParamHead + "STAB_TILT", MainV2.comPort.MAV.param);
                CHK_stab_roll.setup(1, 0, ParamHead + "STAB_ROLL", MainV2.comPort.MAV.param);
                CHK_stab_pan.setup(1, 0, ParamHead + "STAB_PAN", MainV2.comPort.MAV.param);

                NUD_CONTROL_x.setup(-180, 180, 100, 1, ParamHead + "CONTROL_X", MainV2.comPort.MAV.param);
                NUD_CONTROL_y.setup(-180, 180, 100, 1, ParamHead + "CONTROL_Y", MainV2.comPort.MAV.param);
                NUD_CONTROL_z.setup(-180, 180, 100, 1, ParamHead + "CONTROL_Z", MainV2.comPort.MAV.param);

                NUD_NEUTRAL_x.setup(-180, 180, 100, 1, ParamHead + "NEUTRAL_X", MainV2.comPort.MAV.param);
                NUD_NEUTRAL_y.setup(-180, 180, 100, 1, ParamHead + "NEUTRAL_Y", MainV2.comPort.MAV.param);
                NUD_NEUTRAL_z.setup(-180, 180, 100, 1, ParamHead + "NEUTRAL_Z", MainV2.comPort.MAV.param);

                NUD_RETRACT_x.setup(-180, 180, 100, 1, ParamHead + "RETRACT_X", MainV2.comPort.MAV.param);
                NUD_RETRACT_y.setup(-180, 180, 100, 1, ParamHead + "RETRACT_Y", MainV2.comPort.MAV.param);
                NUD_RETRACT_z.setup(-180, 180, 100, 1, ParamHead + "RETRACT_Z", MainV2.comPort.MAV.param);
            }
            catch (Exception ex) { CustomMessageBox.Show("Failed to set Param\n" + ex.ToString()); this.Enabled = false; return; }
        }
示例#2
0
        public void Activate()
        {
            var copy = new Dictionary <string, double>((Dictionary <string, double>)MainV2.comPort.MAV.param);

            if (!copy.ContainsKey("CAM_TRIGG_TYPE"))
            {
                Enabled = false;
                return;
            }

            startup = true;

            CMB_shuttertype.SelectedItem = Enum.GetName(typeof(ChannelCameraShutter),
                                                        (Int32)MainV2.comPort.MAV.param["CAM_TRIGG_TYPE"]);

            foreach (string item in copy.Keys)
            {
                if (item.EndsWith("_FUNCTION"))
                {
                    switch (MainV2.comPort.MAV.param[item].ToString())
                    {
                    case "6":
                        mavlinkComboBoxPan.Text = item.Replace("_FUNCTION", "");
                        break;

                    case "7":
                        mavlinkComboBoxTilt.Text = item.Replace("_FUNCTION", "");
                        break;

                    case "8":
                        mavlinkComboBoxRoll.Text = item.Replace("_FUNCTION", "");
                        break;

                    case "10":
                        CMB_shuttertype.Text = item.Replace("_FUNCTION", "");
                        break;

                    default:
                        break;
                    }
                }
            }

            startup = false;

            try
            {
                updateShutter();
                updatePitch();
                updateRoll();
                updateYaw();

                CHK_stab_tilt.setup(1, 0, ParamHead + "STAB_TILT", MainV2.comPort.MAV.param);
                CHK_stab_roll.setup(1, 0, ParamHead + "STAB_ROLL", MainV2.comPort.MAV.param);
                CHK_stab_pan.setup(1, 0, ParamHead + "STAB_PAN", MainV2.comPort.MAV.param);

                NUD_CONTROL_x.setup(-180, 180, 1, 1, ParamHead + "CONTROL_X", MainV2.comPort.MAV.param);
                NUD_CONTROL_y.setup(-180, 180, 1, 1, ParamHead + "CONTROL_Y", MainV2.comPort.MAV.param);
                NUD_CONTROL_z.setup(-180, 180, 1, 1, ParamHead + "CONTROL_Z", MainV2.comPort.MAV.param);

                NUD_NEUTRAL_x.setup(-180, 180, 1, 1, ParamHead + "NEUTRAL_X", MainV2.comPort.MAV.param);
                NUD_NEUTRAL_y.setup(-180, 180, 1, 1, ParamHead + "NEUTRAL_Y", MainV2.comPort.MAV.param);
                NUD_NEUTRAL_z.setup(-180, 180, 1, 1, ParamHead + "NEUTRAL_Z", MainV2.comPort.MAV.param);

                NUD_RETRACT_x.setup(-180, 180, 1, 1, ParamHead + "RETRACT_X", MainV2.comPort.MAV.param);
                NUD_RETRACT_y.setup(-180, 180, 1, 1, ParamHead + "RETRACT_Y", MainV2.comPort.MAV.param);
                NUD_RETRACT_z.setup(-180, 180, 1, 1, ParamHead + "RETRACT_Z", MainV2.comPort.MAV.param);
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show("Failed to set Param\n" + ex);
                Enabled = false;
            }
        }