diff --git a/ExtLibs/ArduPilot/Joystick/JoyButton.cs b/ExtLibs/ArduPilot/Joystick/JoyButton.cs index f912006f62..48ca94b695 100644 --- a/ExtLibs/ArduPilot/Joystick/JoyButton.cs +++ b/ExtLibs/ArduPilot/Joystick/JoyButton.cs @@ -1,4 +1,7 @@ -namespace MissionPlanner.Joystick +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace MissionPlanner.Joystick { public struct JoyButton { @@ -10,6 +13,7 @@ public struct JoyButton /// /// Fucntion we are doing for this button press /// + [JsonConverter(typeof(StringEnumConverter))] public buttonfunction function; /// diff --git a/ExtLibs/ArduPilot/Joystick/JoyChannel.cs b/ExtLibs/ArduPilot/Joystick/JoyChannel.cs index 1bc7385139..c87a71a84d 100644 --- a/ExtLibs/ArduPilot/Joystick/JoyChannel.cs +++ b/ExtLibs/ArduPilot/Joystick/JoyChannel.cs @@ -1,8 +1,12 @@ -namespace MissionPlanner.Joystick +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace MissionPlanner.Joystick { public struct JoyChannel { public int channel; + [JsonConverter(typeof(StringEnumConverter))] public joystickaxis axis; public bool reverse; public int expo; diff --git a/ExtLibs/ArduPilot/Joystick/JoystickBase.cs b/ExtLibs/ArduPilot/Joystick/JoystickBase.cs index f9576cc82d..5bb1114606 100644 --- a/ExtLibs/ArduPilot/Joystick/JoystickBase.cs +++ b/ExtLibs/ArduPilot/Joystick/JoystickBase.cs @@ -1,13 +1,14 @@ -using System; +using log4net; +using MissionPlanner.ArduPilot; +using MissionPlanner.Utilities; +using System; using System.Collections; using System.Collections.Generic; using System.IO; +using System.IO.Compression; using System.Linq; using System.Reflection; using System.Threading; -using log4net; -using MissionPlanner.ArduPilot; -using MissionPlanner.Utilities; namespace MissionPlanner.Joystick { @@ -1302,5 +1303,59 @@ public static JoystickBase Create(Func func) return new JoystickWindows(func); } } + + public void ExportConfig(string fileName) + { + // compress all joystick config files from user data directory + string userDataDir = Settings.GetUserDataDirectory(); + + // find all joystick config files (buttons and axis) + var buttonFiles = Directory.GetFiles(userDataDir, "joystickbutton*.xml", SearchOption.TopDirectoryOnly); + var axisFiles = Directory.GetFiles(userDataDir, "joystickaxis*.xml", SearchOption.TopDirectoryOnly); + + var allFiles = buttonFiles.Concat(axisFiles).ToList(); + + if (allFiles.Count == 0) + { + throw new FileNotFoundException("No joystick configuration files found in " + userDataDir); + } + + if (File.Exists(fileName)) + File.Delete(fileName); + + // create archive with all config files + using (var archive = ZipFile.Open(fileName, ZipArchiveMode.Create)) + { + foreach (var file in allFiles) + { + archive.CreateEntryFromFile(file, Path.GetFileName(file)); + } + } + } + + public void ImportConfig(string fileName) + { + // decompress all joystick config files to user data directory + string userDataDir = Settings.GetUserDataDirectory(); + + if (!File.Exists(fileName)) + { + throw new FileNotFoundException($"Archive file not found: {fileName}"); + } + + // extract all files from archive to user data directory + using (var archive = ZipFile.OpenRead(fileName)) + { + foreach (var entry in archive.Entries) + { + // only extract joystick config files + if (entry.Name.StartsWith("joystickbutton") || entry.Name.StartsWith("joystickaxis")) + { + string outputPath = Path.Combine(userDataDir, entry.Name); + entry.ExtractToFile(outputPath, true); + } + } + } + } } } \ No newline at end of file diff --git a/ExtLibs/SvgNet/SvgNet.csproj b/ExtLibs/SvgNet/SvgNet.csproj index 570697afa3..446543a9b8 100644 --- a/ExtLibs/SvgNet/SvgNet.csproj +++ b/ExtLibs/SvgNet/SvgNet.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + net472;netstandard2.0;net8.0 portable true false diff --git a/Joystick/JoystickSetup.Designer.cs b/Joystick/JoystickSetup.Designer.cs index 623807a4b5..f875d28d72 100644 --- a/Joystick/JoystickSetup.Designer.cs +++ b/Joystick/JoystickSetup.Designer.cs @@ -1,36 +1,36 @@ -using MissionPlanner.Controls; +using MissionPlanner.Controls; using System.Windows.Forms; -namespace MissionPlanner.Joystick -{ - partial class JoystickSetup - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { +namespace MissionPlanner.Joystick +{ + partial class JoystickSetup + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(JoystickSetup)); this.CMB_joysticks = new System.Windows.Forms.ComboBox(); @@ -45,6 +45,8 @@ private void InitializeComponent() this.BUT_save = new MissionPlanner.Controls.MyButton(); this.label14 = new System.Windows.Forms.Label(); this.chk_manualcontrol = new System.Windows.Forms.CheckBox(); + this.but_export = new MissionPlanner.Controls.MyButton(); + this.but_import = new MissionPlanner.Controls.MyButton(); this.SuspendLayout(); // // CMB_joysticks @@ -94,17 +96,17 @@ private void InitializeComponent() // // BUT_enable // - this.BUT_enable.DialogResult = System.Windows.Forms.DialogResult.None; resources.ApplyResources(this.BUT_enable, "BUT_enable"); this.BUT_enable.Name = "BUT_enable"; + this.BUT_enable.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_enable.UseVisualStyleBackColor = true; this.BUT_enable.Click += new System.EventHandler(this.BUT_enable_Click); // // BUT_save // - this.BUT_save.DialogResult = System.Windows.Forms.DialogResult.None; resources.ApplyResources(this.BUT_save, "BUT_save"); this.BUT_save.Name = "BUT_save"; + this.BUT_save.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_save.UseVisualStyleBackColor = true; this.BUT_save.Click += new System.EventHandler(this.BUT_save_Click); // @@ -120,9 +122,26 @@ private void InitializeComponent() this.chk_manualcontrol.UseVisualStyleBackColor = true; this.chk_manualcontrol.CheckedChanged += new System.EventHandler(this.chk_manualcontrol_CheckedChanged); // + // but_export + // + resources.ApplyResources(this.but_export, "but_export"); + this.but_export.Name = "but_export"; + this.but_export.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); + this.but_export.UseVisualStyleBackColor = true; + this.but_export.Click += new System.EventHandler(this.but_export_Click); + // + // but_import + // + resources.ApplyResources(this.but_import, "but_import"); + this.but_import.Name = "but_import"; + this.but_import.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); + this.but_import.UseVisualStyleBackColor = true; + this.but_import.Click += new System.EventHandler(this.but_import_Click); + // // JoystickSetup // - resources.ApplyResources(this, "$this"); + this.Controls.Add(this.but_import); + this.Controls.Add(this.but_export); this.Controls.Add(this.chk_manualcontrol); this.Controls.Add(this.label14); this.Controls.Add(this.CHK_elevons); @@ -134,29 +153,30 @@ private void InitializeComponent() this.Controls.Add(this.BUT_enable); this.Controls.Add(this.BUT_save); this.Controls.Add(this.CMB_joysticks); + resources.ApplyResources(this, "$this"); this.Name = "JoystickSetup"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.JoystickSetup_FormClosed); this.Load += new System.EventHandler(this.Joystick_Load); this.ResumeLayout(false); this.PerformLayout(); - } - - #endregion - - private System.Windows.Forms.ComboBox CMB_joysticks; - private Controls.MyButton BUT_save; - private Controls.MyButton BUT_enable; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Timer timer1; - private System.Windows.Forms.CheckBox CHK_elevons; - private System.Windows.Forms.Label label14; - private System.Windows.Forms.CheckBox chk_manualcontrol; + } + + #endregion - - } + private System.Windows.Forms.ComboBox CMB_joysticks; + private Controls.MyButton BUT_save; + private Controls.MyButton BUT_enable; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.CheckBox CHK_elevons; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.CheckBox chk_manualcontrol; + private MyButton BUT_export; + private MyButton BUT_import; + } } \ No newline at end of file diff --git a/Joystick/JoystickSetup.cs b/Joystick/JoystickSetup.cs index 4baff5bf98..a6f0b29ffd 100644 --- a/Joystick/JoystickSetup.cs +++ b/Joystick/JoystickSetup.cs @@ -1,99 +1,100 @@ -using MissionPlanner.Controls; -using MissionPlanner.Utilities; -using SharpDX.DirectInput; -using System; -using System.Drawing; -using System.Linq; -using System.Windows.Forms; - - -namespace MissionPlanner.Joystick +using MissionPlanner.Controls; +using MissionPlanner.Utilities; +using SharpDX.DirectInput; +using System; +using System.Drawing; +using System.IO.Compression; +using System.Linq; +using System.Windows.Forms; + + +namespace MissionPlanner.Joystick { - public partial class JoystickSetup : MyUserControl, IDeactivate - { - bool startup = true; - - int noButtons = 0; - private int maxaxis = 16; - - public JoystickSetup() - { - InitializeComponent(); - - MissionPlanner.Utilities.Tracking.AddPage(this.GetType().ToString(), this.Text); - } - - private void Joystick_Load(object sender, EventArgs e) - { - try - { - var joysticklist = JoystickBase.getDevices(); - - foreach (var device in joysticklist) - { - CMB_joysticks.Items.Add(device); - } - } - catch - { - CustomMessageBox.Show("Error geting joystick list: do you have the directx redist installed?"); - this.Close(); - return; - } - - if (CMB_joysticks.Items.Count > 0 && CMB_joysticks.SelectedIndex == -1) - CMB_joysticks.SelectedIndex = 0; - - try - { - if (Settings.Instance.ContainsKey("joystick_name") && Settings.Instance["joystick_name"].ToString() != "") - CMB_joysticks.Text = Settings.Instance["joystick_name"].ToString(); - } - catch - { - } - - try - { - if (Settings.Instance.ContainsKey("joy_elevons")) - CHK_elevons.Checked = bool.Parse(Settings.Instance["joy_elevons"].ToString()); - } - catch - { - } // IF 1 DOESNT EXIST NONE WILL - - var tempjoystick = JoystickBase.Create(() => MainV2.comPort); - - label14.Text += " " + MainV2.comPort.MAV.cs.firmware.ToString(); - - var y = label8.Bottom; - - this.SuspendLayout(); - - for (int a = 1; a <= maxaxis; a++) - { - var config = tempjoystick.getChannel(a); - - var ax = new JoystickAxis() - { - ChannelNo = a, - Label = "RC " + a, - AxisArray = (Enum.GetValues(typeof(joystickaxis))), - ChannelValue = config.axis.ToString(), - ExpoValue = config.expo.ToString(), - ReverseValue = config.reverse, - Location = new Point(0, y), - Name = "axis" + a - }; - - ax.Detect = () => JoystickBase.getMovingAxis(CMB_joysticks.Text, 16000).ToString(); - ax.Reverse = () => MainV2.joystick?.setReverse(ax.ChannelNo, ax.ReverseValue); - ax.SetAxis = () => MainV2.joystick?.setAxis(ax.ChannelNo, - (joystickaxis)Enum.Parse(typeof(joystickaxis), ax.ChannelValue)); - ax.GetValue = () => - { - return (short)MainV2.comPort.MAV.cs.GetType().GetField("rcoverridech" + ax.ChannelNo) - .GetValue(MainV2.comPort.MAV.cs); + public partial class JoystickSetup : MyUserControl, IDeactivate + { + bool startup = true; + + int noButtons = 0; + private int maxaxis = 16; + + public JoystickSetup() + { + InitializeComponent(); + + MissionPlanner.Utilities.Tracking.AddPage(this.GetType().ToString(), this.Text); + } + + private void Joystick_Load(object sender, EventArgs e) + { + try + { + var joysticklist = JoystickBase.getDevices(); + + foreach (var device in joysticklist) + { + CMB_joysticks.Items.Add(device); + } + } + catch + { + CustomMessageBox.Show("Error geting joystick list: do you have the directx redist installed?"); + this.Close(); + return; + } + + if (CMB_joysticks.Items.Count > 0 && CMB_joysticks.SelectedIndex == -1) + CMB_joysticks.SelectedIndex = 0; + + try + { + if (Settings.Instance.ContainsKey("joystick_name") && Settings.Instance["joystick_name"].ToString() != "") + CMB_joysticks.Text = Settings.Instance["joystick_name"].ToString(); + } + catch + { + } + + try + { + if (Settings.Instance.ContainsKey("joy_elevons")) + CHK_elevons.Checked = bool.Parse(Settings.Instance["joy_elevons"].ToString()); + } + catch + { + } // IF 1 DOESNT EXIST NONE WILL + + var tempjoystick = JoystickBase.Create(() => MainV2.comPort); + + label14.Text += " " + MainV2.comPort.MAV.cs.firmware.ToString(); + + var y = label8.Bottom; + + this.SuspendLayout(); + + for (int a = 1; a <= maxaxis; a++) + { + var config = tempjoystick.getChannel(a); + + var ax = new JoystickAxis() + { + ChannelNo = a, + Label = "RC " + a, + AxisArray = (Enum.GetValues(typeof(joystickaxis))), + ChannelValue = config.axis.ToString(), + ExpoValue = config.expo.ToString(), + ReverseValue = config.reverse, + Location = new Point(0, y), + Name = "axis" + a + }; + + ax.Detect = () => JoystickBase.getMovingAxis(CMB_joysticks.Text, 16000).ToString(); + ax.Reverse = () => MainV2.joystick?.setReverse(ax.ChannelNo, ax.ReverseValue); + ax.SetAxis = () => MainV2.joystick?.setAxis(ax.ChannelNo, + (joystickaxis)Enum.Parse(typeof(joystickaxis), ax.ChannelValue)); + ax.GetValue = () => + { + return (short)MainV2.comPort.MAV.cs.GetType().GetField("rcoverridech" + ax.ChannelNo) + .GetValue(MainV2.comPort.MAV.cs); }; ax.Expo = () => { @@ -105,307 +106,307 @@ private void Joystick_Load(object sender, EventArgs e) Controls.Add(ax); - y += ax.Height; - - - if ((ax.Bottom + 30) > this.Height) - this.Height = ax.Bottom; - - if ((ax.Right) > this.Width) - this.Width = ax.Right; - } - - this.ResumeLayout(); - - if (MainV2.joystick != null && MainV2.joystick.enabled) - { - timer1.Start(); - BUT_enable.Text = "Disable"; - } - - startup = false; - } - - int[] getButtonNumbers() - { - int[] temp = new int[128]; - temp[0] = -1; - for (int a = 0; a < temp.Length - 1; a++) - { - temp[a + 1] = a; - } - return temp; - } - - private void BUT_enable_Click(object sender, EventArgs e) - { - if (MainV2.joystick == null || MainV2.joystick.enabled == false) - { - try - { - if (MainV2.joystick != null) - MainV2.joystick.UnAcquireJoyStick(); - } - catch - { - } - - // all config is loaded from the xmls - var joy = JoystickBase.Create(() => MainV2.comPort); - - joy.elevons = CHK_elevons.Checked; - - //show error message if a joystick is not connected when Enable is clicked - if (!joy.start(CMB_joysticks.Text)) - { - CustomMessageBox.Show("Please Connect a Joystick", "No Joystick"); - joy.Dispose(); - return; - } - - Settings.Instance["joystick_name"] = CMB_joysticks.Text; - - MainV2.joystick = joy; - MainV2.joystick.enabled = true; - - BUT_enable.Text = "Disable"; - - //timer1.Start(); - } - else - { - MainV2.joystick.enabled = false; - - MainV2.joystick.clearRCOverride(); - - MainV2.joystick = null; - - - //timer1.Stop(); - - BUT_enable.Text = "Enable"; - } - } - - private void BUT_save_Click(object sender, EventArgs e) - { - if (MainV2.joystick == null) - { - CustomMessageBox.Show("Please select a joystick"); - return; - } - MainV2.joystick.saveconfig(); - - Settings.Instance["joy_elevons"] = CHK_elevons.Checked.ToString(); - } - - private void timer1_Tick(object sender, EventArgs e) - { - try - { - if (MainV2.joystick == null || MainV2.joystick.enabled == false) - { - //Console.WriteLine(DateTime.Now.Millisecond + " start "); - var joy = MainV2.joystick; - if (joy == null) - { - joy = JoystickBase.Create(() => MainV2.comPort); - for (int a = 1; a <= maxaxis; a++) - { - var config = joy.getChannel(a); - - joy.setChannel(a, config.axis, config.reverse, config.expo); - } - - joy.elevons = CHK_elevons.Checked; - - joy.AcquireJoystick(CMB_joysticks.Text); - - joy.name = CMB_joysticks.Text; - - noButtons = joy.getNumButtons(); - - noButtons = Math.Min(16, noButtons); - - SuspendLayout(); - - MainV2.joystick = joy; - - var maxctl = Controls.Find("axis" + 1, false).FirstOrDefault(); - - for (int f = 0; f < noButtons; f++) - { - string name = (f).ToString(); - - doButtontoUI(name, maxctl.Right + 100, maxctl.Top + f * maxctl.Height); - - var config = joy.getButton(f); - - joy.setButton(f, config); - } - - ResumeLayout(); - - ThemeManager.ApplyThemeTo(this); - - CMB_joysticks.SelectedIndex = CMB_joysticks.Items.IndexOf(joy.name); - } - - MainV2.joystick.elevons = CHK_elevons.Checked; - - MainV2.comPort.MAV.cs.rcoverridech1 = joy.getValueForChannel(1); - MainV2.comPort.MAV.cs.rcoverridech2 = joy.getValueForChannel(2); - MainV2.comPort.MAV.cs.rcoverridech3 = joy.getValueForChannel(3); - MainV2.comPort.MAV.cs.rcoverridech4 = joy.getValueForChannel(4); - MainV2.comPort.MAV.cs.rcoverridech5 = joy.getValueForChannel(5); - MainV2.comPort.MAV.cs.rcoverridech6 = joy.getValueForChannel(6); - MainV2.comPort.MAV.cs.rcoverridech7 = joy.getValueForChannel(7); - MainV2.comPort.MAV.cs.rcoverridech8 = joy.getValueForChannel(8); - MainV2.comPort.MAV.cs.rcoverridech9 = joy.getValueForChannel(9); - MainV2.comPort.MAV.cs.rcoverridech10 = joy.getValueForChannel(10); - MainV2.comPort.MAV.cs.rcoverridech11 = joy.getValueForChannel(11); - MainV2.comPort.MAV.cs.rcoverridech12 = joy.getValueForChannel(12); - MainV2.comPort.MAV.cs.rcoverridech13 = joy.getValueForChannel(13); - MainV2.comPort.MAV.cs.rcoverridech14 = joy.getValueForChannel(14); - MainV2.comPort.MAV.cs.rcoverridech15 = joy.getValueForChannel(15); - MainV2.comPort.MAV.cs.rcoverridech16 = joy.getValueForChannel(16); - MainV2.comPort.MAV.cs.rcoverridech17 = joy.getValueForChannel(17); - MainV2.comPort.MAV.cs.rcoverridech18 = joy.getValueForChannel(18); - - //Console.WriteLine(DateTime.Now.Millisecond + " end "); - } - } - catch (SharpDX.SharpDXException ex) - { - ex.ToString(); - if (MainV2.joystick != null && MainV2.joystick.enabled == true) - { - BUT_enable_Click(null, null); - } - - if (ex.Message.Contains("DIERR_NOTACQUIRED")) - MainV2.joystick = null; - } - catch - { - - } - - try - { - for (int f = 0; f < noButtons; f++) - { - string name = (f).ToString(); - - var items = this.Controls.Find("hbar" + name, false); - + y += ax.Height; + + + if ((ax.Bottom + 30) > this.Height) + this.Height = ax.Bottom; + + if ((ax.Right) > this.Width) + this.Width = ax.Right; + } + + this.ResumeLayout(); + + if (MainV2.joystick != null && MainV2.joystick.enabled) + { + timer1.Start(); + BUT_enable.Text = "Disable"; + } + + startup = false; + } + + int[] getButtonNumbers() + { + int[] temp = new int[128]; + temp[0] = -1; + for (int a = 0; a < temp.Length - 1; a++) + { + temp[a + 1] = a; + } + return temp; + } + + private void BUT_enable_Click(object sender, EventArgs e) + { + if (MainV2.joystick == null || MainV2.joystick.enabled == false) + { + try + { + if (MainV2.joystick != null) + MainV2.joystick.UnAcquireJoyStick(); + } + catch + { + } + + // all config is loaded from the xmls + var joy = JoystickBase.Create(() => MainV2.comPort); + + joy.elevons = CHK_elevons.Checked; + + //show error message if a joystick is not connected when Enable is clicked + if (!joy.start(CMB_joysticks.Text)) + { + CustomMessageBox.Show("Please Connect a Joystick", "No Joystick"); + joy.Dispose(); + return; + } + + Settings.Instance["joystick_name"] = CMB_joysticks.Text; + + MainV2.joystick = joy; + MainV2.joystick.enabled = true; + + BUT_enable.Text = "Disable"; + + //timer1.Start(); + } + else + { + MainV2.joystick.enabled = false; + + MainV2.joystick.clearRCOverride(); + + MainV2.joystick = null; + + + //timer1.Stop(); + + BUT_enable.Text = "Enable"; + } + } + + private void BUT_save_Click(object sender, EventArgs e) + { + if (MainV2.joystick == null) + { + CustomMessageBox.Show("Please select a joystick"); + return; + } + MainV2.joystick.saveconfig(); + + Settings.Instance["joy_elevons"] = CHK_elevons.Checked.ToString(); + } + + private void timer1_Tick(object sender, EventArgs e) + { + try + { + if (MainV2.joystick == null || MainV2.joystick.enabled == false) + { + //Console.WriteLine(DateTime.Now.Millisecond + " start "); + var joy = MainV2.joystick; + if (joy == null) + { + joy = JoystickBase.Create(() => MainV2.comPort); + for (int a = 1; a <= maxaxis; a++) + { + var config = joy.getChannel(a); + + joy.setChannel(a, config.axis, config.reverse, config.expo); + } + + joy.elevons = CHK_elevons.Checked; + + joy.AcquireJoystick(CMB_joysticks.Text); + + joy.name = CMB_joysticks.Text; + + noButtons = joy.getNumButtons(); + + noButtons = Math.Min(16, noButtons); + + SuspendLayout(); + + MainV2.joystick = joy; + + var maxctl = Controls.Find("axis" + 1, false).FirstOrDefault(); + + for (int f = 0; f < noButtons; f++) + { + string name = (f).ToString(); + + doButtontoUI(name, maxctl.Right + 100, maxctl.Top + f * maxctl.Height); + + var config = joy.getButton(f); + + joy.setButton(f, config); + } + + ResumeLayout(); + + ThemeManager.ApplyThemeTo(this); + + CMB_joysticks.SelectedIndex = CMB_joysticks.Items.IndexOf(joy.name); + } + + MainV2.joystick.elevons = CHK_elevons.Checked; + + MainV2.comPort.MAV.cs.rcoverridech1 = joy.getValueForChannel(1); + MainV2.comPort.MAV.cs.rcoverridech2 = joy.getValueForChannel(2); + MainV2.comPort.MAV.cs.rcoverridech3 = joy.getValueForChannel(3); + MainV2.comPort.MAV.cs.rcoverridech4 = joy.getValueForChannel(4); + MainV2.comPort.MAV.cs.rcoverridech5 = joy.getValueForChannel(5); + MainV2.comPort.MAV.cs.rcoverridech6 = joy.getValueForChannel(6); + MainV2.comPort.MAV.cs.rcoverridech7 = joy.getValueForChannel(7); + MainV2.comPort.MAV.cs.rcoverridech8 = joy.getValueForChannel(8); + MainV2.comPort.MAV.cs.rcoverridech9 = joy.getValueForChannel(9); + MainV2.comPort.MAV.cs.rcoverridech10 = joy.getValueForChannel(10); + MainV2.comPort.MAV.cs.rcoverridech11 = joy.getValueForChannel(11); + MainV2.comPort.MAV.cs.rcoverridech12 = joy.getValueForChannel(12); + MainV2.comPort.MAV.cs.rcoverridech13 = joy.getValueForChannel(13); + MainV2.comPort.MAV.cs.rcoverridech14 = joy.getValueForChannel(14); + MainV2.comPort.MAV.cs.rcoverridech15 = joy.getValueForChannel(15); + MainV2.comPort.MAV.cs.rcoverridech16 = joy.getValueForChannel(16); + MainV2.comPort.MAV.cs.rcoverridech17 = joy.getValueForChannel(17); + MainV2.comPort.MAV.cs.rcoverridech18 = joy.getValueForChannel(18); + + //Console.WriteLine(DateTime.Now.Millisecond + " end "); + } + } + catch (SharpDX.SharpDXException ex) + { + ex.ToString(); + if (MainV2.joystick != null && MainV2.joystick.enabled == true) + { + BUT_enable_Click(null, null); + } + + if (ex.Message.Contains("DIERR_NOTACQUIRED")) + MainV2.joystick = null; + } + catch + { + + } + + try + { + for (int f = 0; f < noButtons; f++) + { + string name = (f).ToString(); + + var items = this.Controls.Find("hbar" + name, false); + if (items.Length > 0) ((HorizontalProgressBar)items[0]).Value = - MainV2.joystick.isButtonPressed(f) ? 100 : 0; - } - } - catch - { - } // this is for buttons - silent fail - } - - private void CMB_joysticks_Click(object sender, EventArgs e) - { - CMB_joysticks.Items.Clear(); - - var joysticklist = JoystickBase.getDevices(); - - foreach (var device in joysticklist) - { - CMB_joysticks.Items.Add(device); - } - - if (CMB_joysticks.Items.Count > 0 && CMB_joysticks.SelectedIndex == -1) - CMB_joysticks.SelectedIndex = 0; - } - - private void cmbbutton_SelectedIndexChanged(object sender, EventArgs e) - { - if (startup) - return; - - string name = ((ComboBox)sender).Name.Replace("cmbbutton", ""); - - MainV2.joystick.changeButton((int.Parse(name)), int.Parse(((ComboBox)sender).Text)); - } - - private void BUT_detbutton_Click(object sender, EventArgs e) - { - string name = ((MyButton)sender).Name.Replace("mybut", ""); - - ComboBox cmb = (ComboBox)(this.Controls.Find("cmbbutton" + name, false)[0]); - cmb.Text = JoystickBase.getPressedButton(CMB_joysticks.Text).ToString(); - } - - void doButtontoUI(string name, int x, int y) - { - MyLabel butlabel = new MyLabel(); - ComboBox butnumberlist = new ComboBox(); - Controls.MyButton but_detect = new Controls.MyButton(); - HorizontalProgressBar hbar = new HorizontalProgressBar(); - ComboBox cmbaction = new ComboBox(); - Controls.MyButton but_settings = new Controls.MyButton(); - - if (MainV2.joystick == null) - { - butlabel.Dispose(); - butnumberlist.Dispose(); - but_detect.Dispose(); - hbar.Dispose(); - cmbaction.Dispose(); - but_settings.Dispose(); - return; - } - - var config = MainV2.joystick.getButton(int.Parse(name)); - - - butlabel.Location = new Point(x, y); - butlabel.Size = new Size(47, 13); - butlabel.Text = "But " + (int.Parse(name) + 1); - - butnumberlist.Location = new Point(butlabel.Right, y); - butnumberlist.Size = new Size(70, 21); - //butnumberlist.DataSource = getButtonNumbers(); + MainV2.joystick.isButtonPressed(f) ? 100 : 0; + } + } + catch + { + } // this is for buttons - silent fail + } + + private void CMB_joysticks_Click(object sender, EventArgs e) + { + CMB_joysticks.Items.Clear(); + + var joysticklist = JoystickBase.getDevices(); + + foreach (var device in joysticklist) + { + CMB_joysticks.Items.Add(device); + } + + if (CMB_joysticks.Items.Count > 0 && CMB_joysticks.SelectedIndex == -1) + CMB_joysticks.SelectedIndex = 0; + } + + private void cmbbutton_SelectedIndexChanged(object sender, EventArgs e) + { + if (startup) + return; + + string name = ((ComboBox)sender).Name.Replace("cmbbutton", ""); + + MainV2.joystick.changeButton((int.Parse(name)), int.Parse(((ComboBox)sender).Text)); + } + + private void BUT_detbutton_Click(object sender, EventArgs e) + { + string name = ((MyButton)sender).Name.Replace("mybut", ""); + + ComboBox cmb = (ComboBox)(this.Controls.Find("cmbbutton" + name, false)[0]); + cmb.Text = JoystickBase.getPressedButton(CMB_joysticks.Text).ToString(); + } + + void doButtontoUI(string name, int x, int y) + { + MyLabel butlabel = new MyLabel(); + ComboBox butnumberlist = new ComboBox(); + Controls.MyButton but_detect = new Controls.MyButton(); + HorizontalProgressBar hbar = new HorizontalProgressBar(); + ComboBox cmbaction = new ComboBox(); + Controls.MyButton but_settings = new Controls.MyButton(); + + if (MainV2.joystick == null) + { + butlabel.Dispose(); + butnumberlist.Dispose(); + but_detect.Dispose(); + hbar.Dispose(); + cmbaction.Dispose(); + but_settings.Dispose(); + return; + } + + var config = MainV2.joystick.getButton(int.Parse(name)); + + + butlabel.Location = new Point(x, y); + butlabel.Size = new Size(47, 13); + butlabel.Text = "But " + (int.Parse(name) + 1); + + butnumberlist.Location = new Point(butlabel.Right, y); + butnumberlist.Size = new Size(70, 21); + //butnumberlist.DataSource = getButtonNumbers(); butnumberlist.Items.AddRange(getButtonNumbers().Select(item => item.ToString()).ToArray()); butnumberlist.SelectedIndex = 0; - butnumberlist.DropDownStyle = ComboBoxStyle.DropDownList; + butnumberlist.DropDownStyle = ComboBoxStyle.DropDownList; butnumberlist.Name = "cmbbutton" + name; //butnumberlist.SelectedItem = "-1"; - butnumberlist.SelectedItem = config.buttonno.ToString(); - + butnumberlist.SelectedItem = config.buttonno.ToString(); + //if (Settings.Instance["butno" + name] != null) - // butnumberlist.Text = (Settings.Instance["butno" + name].ToString()); + // butnumberlist.Text = (Settings.Instance["butno" + name].ToString()); //if (config.buttonno != -1) - - //butnumberlist.Text = config.buttonno.ToString(); - - butnumberlist.SelectedIndexChanged += new EventHandler(cmbbutton_SelectedIndexChanged); - - but_detect.Location = new Point(butnumberlist.Right, y); - //but_detect.Size = BUT_detch1.Size; - but_detect.Text = "Detect"; - but_detect.AutoSize = true; - - but_detect.Name = "mybut" + name; - but_detect.Click += new EventHandler(BUT_detbutton_Click); - - hbar.Location = new Point(but_detect.Right, y); - hbar.Size = new Size(100, 21); - hbar.Name = "hbar" + name; - - cmbaction.Location = new Point(hbar.Right + 5, y); - cmbaction.Size = new Size(100, 21); - + + //butnumberlist.Text = config.buttonno.ToString(); + + butnumberlist.SelectedIndexChanged += new EventHandler(cmbbutton_SelectedIndexChanged); + + but_detect.Location = new Point(butnumberlist.Right, y); + //but_detect.Size = BUT_detch1.Size; + but_detect.Text = "Detect"; + but_detect.AutoSize = true; + + but_detect.Name = "mybut" + name; + but_detect.Click += new EventHandler(BUT_detbutton_Click); + + hbar.Location = new Point(but_detect.Right, y); + hbar.Size = new Size(100, 21); + hbar.Name = "hbar" + name; + + cmbaction.Location = new Point(hbar.Right + 5, y); + cmbaction.Size = new Size(100, 21); + //cmbaction.DataSource = Enum.GetNames(typeof(buttonfunction)); cmbaction.Items.AddRange(Enum.GetNames(typeof(buttonfunction))); @@ -413,124 +414,180 @@ void doButtontoUI(string name, int x, int y) //Common.getModesList(MainV2.comPort.MAV.cs); //cmbaction.ValueMember = "Key"; //cmbaction.DisplayMember = "Value"; - cmbaction.Tag = name; - cmbaction.DropDownStyle = ComboBoxStyle.DropDownList; - cmbaction.Name = "cmbaction" + name; - //if (Settings.Instance["butaction" + name] != null) - // cmbaction.Text = Settings.Instance["butaction" + name].ToString(); - //if (config.function != buttonfunction.ChangeMode) - cmbaction.Text = config.function.ToString(); - cmbaction.SelectedIndexChanged += cmbaction_SelectedIndexChanged; - - but_settings.Location = new Point(cmbaction.Right + 5, y); - //but_settings.Size = BUT_detch1.Size; - but_settings.Text = "Settings"; - but_settings.Name = "butsettings" + name; - but_settings.Click += but_settings_Click; - but_settings.Tag = cmbaction; - - // do this here so putting in text works - this.Controls.AddRange(new Control[] { butlabel, butnumberlist, but_detect, hbar, cmbaction, but_settings }); - - if ((but_settings.Bottom + 30) > this.Height) - this.Height += 25; - - if ((but_settings.Right) > this.Width) - this.Width = but_settings.Right + 5; - } - - void cmbaction_SelectedIndexChanged(object sender, EventArgs e) - { - int num = int.Parse(((Control)sender).Tag.ToString()); - var config = MainV2.joystick.getButton(num); - config.function = - (buttonfunction)Enum.Parse(typeof(buttonfunction), ((Control)sender).Text); - MainV2.joystick.setButton(num, config); - } - - void but_settings_Click(object sender, EventArgs e) - { - var cmb = ((Control)sender).Tag as ComboBox; - - switch ((buttonfunction)Enum.Parse(typeof(buttonfunction), cmb.SelectedItem.ToString())) - { - case buttonfunction.ChangeMode: - new Joy_ChangeMode((string)cmb.Tag).ShowDialog(); - break; - case buttonfunction.Mount_Mode: - new Joy_Mount_Mode((string)cmb.Tag).ShowDialog(); - break; - case buttonfunction.Do_Repeat_Relay: - new Joy_Do_Repeat_Relay((string)cmb.Tag).ShowDialog(); - break; - case buttonfunction.Do_Repeat_Servo: - new Joy_Do_Repeat_Servo((string)cmb.Tag).ShowDialog(); - break; - case buttonfunction.Do_Set_Relay: - new Joy_Do_Set_Relay((string)cmb.Tag).ShowDialog(); - break; - case buttonfunction.Do_Set_Servo: - new Joy_Do_Set_Servo((string)cmb.Tag).ShowDialog(); - break; - case buttonfunction.Button_axis0: - new Joy_Button_axis((string)cmb.Tag).ShowDialog(); - break; - case buttonfunction.Button_axis1: - new Joy_Button_axis((string)cmb.Tag).ShowDialog(); - break; - default: - CustomMessageBox.Show("No settings to set", "No settings"); - break; - } - } - - private void CMB_joysticks_SelectedIndexChanged(object sender, EventArgs e) - { - try - { - if (MainV2.joystick != null && MainV2.joystick.enabled == false) - MainV2.joystick.UnAcquireJoyStick(); - } - catch - { - } - } - - - private void JoystickSetup_FormClosed(object sender, FormClosedEventArgs e) - { - timer1.Stop(); - - if (MainV2.joystick != null && MainV2.joystick.enabled == false) - { - MainV2.joystick.UnAcquireJoyStick(); - MainV2.joystick = null; - } - } - - private void CHK_elevons_CheckedChanged(object sender, EventArgs e) - { - if (MainV2.joystick == null) - { - return; - } - MainV2.joystick.elevons = CHK_elevons.Checked; - } - - private void chk_manualcontrol_CheckedChanged(object sender, EventArgs e) - { - MainV2.joystick.manual_control = chk_manualcontrol.Checked; + cmbaction.Tag = name; + cmbaction.DropDownStyle = ComboBoxStyle.DropDownList; + cmbaction.Name = "cmbaction" + name; + //if (Settings.Instance["butaction" + name] != null) + // cmbaction.Text = Settings.Instance["butaction" + name].ToString(); + //if (config.function != buttonfunction.ChangeMode) + cmbaction.Text = config.function.ToString(); + cmbaction.SelectedIndexChanged += cmbaction_SelectedIndexChanged; + + but_settings.Location = new Point(cmbaction.Right + 5, y); + //but_settings.Size = BUT_detch1.Size; + but_settings.Text = "Settings"; + but_settings.Name = "butsettings" + name; + but_settings.Click += but_settings_Click; + but_settings.Tag = cmbaction; + + // do this here so putting in text works + this.Controls.AddRange(new Control[] { butlabel, butnumberlist, but_detect, hbar, cmbaction, but_settings }); + + if ((but_settings.Bottom + 30) > this.Height) + this.Height += 25; + + if ((but_settings.Right) > this.Width) + this.Width = but_settings.Right + 5; + } + + void cmbaction_SelectedIndexChanged(object sender, EventArgs e) + { + int num = int.Parse(((Control)sender).Tag.ToString()); + var config = MainV2.joystick.getButton(num); + config.function = + (buttonfunction)Enum.Parse(typeof(buttonfunction), ((Control)sender).Text); + MainV2.joystick.setButton(num, config); + } + + void but_settings_Click(object sender, EventArgs e) + { + var cmb = ((Control)sender).Tag as ComboBox; + + switch ((buttonfunction)Enum.Parse(typeof(buttonfunction), cmb.SelectedItem.ToString())) + { + case buttonfunction.ChangeMode: + new Joy_ChangeMode((string)cmb.Tag).ShowDialog(); + break; + case buttonfunction.Mount_Mode: + new Joy_Mount_Mode((string)cmb.Tag).ShowDialog(); + break; + case buttonfunction.Do_Repeat_Relay: + new Joy_Do_Repeat_Relay((string)cmb.Tag).ShowDialog(); + break; + case buttonfunction.Do_Repeat_Servo: + new Joy_Do_Repeat_Servo((string)cmb.Tag).ShowDialog(); + break; + case buttonfunction.Do_Set_Relay: + new Joy_Do_Set_Relay((string)cmb.Tag).ShowDialog(); + break; + case buttonfunction.Do_Set_Servo: + new Joy_Do_Set_Servo((string)cmb.Tag).ShowDialog(); + break; + case buttonfunction.Button_axis0: + new Joy_Button_axis((string)cmb.Tag).ShowDialog(); + break; + case buttonfunction.Button_axis1: + new Joy_Button_axis((string)cmb.Tag).ShowDialog(); + break; + default: + CustomMessageBox.Show("No settings to set", "No settings"); + break; + } + } + + private void CMB_joysticks_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + if (MainV2.joystick != null && MainV2.joystick.enabled == false) + MainV2.joystick.UnAcquireJoyStick(); + } + catch + { + } + } + + + private void JoystickSetup_FormClosed(object sender, FormClosedEventArgs e) + { + timer1.Stop(); + + if (MainV2.joystick != null && MainV2.joystick.enabled == false) + { + MainV2.joystick.UnAcquireJoyStick(); + MainV2.joystick = null; + } + } + + private void CHK_elevons_CheckedChanged(object sender, EventArgs e) + { + if (MainV2.joystick == null) + { + return; + } + MainV2.joystick.elevons = CHK_elevons.Checked; + } + + private void chk_manualcontrol_CheckedChanged(object sender, EventArgs e) + { + MainV2.joystick.manual_control = chk_manualcontrol.Checked; } public void Deactivate() { - timer1.Stop(); - - if (MainV2.joystick != null && MainV2.joystick.enabled == false) - { - MainV2.joystick.UnAcquireJoyStick(); - MainV2.joystick = null; + timer1.Stop(); + + if (MainV2.joystick != null && MainV2.joystick.enabled == false) + { + MainV2.joystick.UnAcquireJoyStick(); + MainV2.joystick = null; + } + } + + private void but_export_Click(object sender, EventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Filter = "Joystick config files (*.joycfg)|*.joycfg|All files (*.*)|*.*"; + if (sfd.ShowDialog() == DialogResult.OK) + { + if (MainV2.joystick == null) + { + CustomMessageBox.Show("No joystick configuration is available to export.", "Export Joystick Config", MessageBoxButtons.OK); + return; + } + + try + { + MainV2.joystick.saveconfig(); + MainV2.joystick.ExportConfig(sfd.FileName); + } + catch (Exception ex) + { + CustomMessageBox.Show("Failed to export joystick configuration:\n" + ex.Message, "Export Joystick Config", MessageBoxButtons.OK); + } + } + } + + private void but_import_Click(object sender, EventArgs e) + { + if (CustomMessageBox.Show("NOTE: this will replace any existing joystick configuration.\nPlease make sure you have saved your current configuration if needed.", "Import Joystick Config", MessageBoxButtons.OKCancel) == (int)DialogResult.OK) + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "Joystick config files (*.joycfg)|*.joycfg|All files (*.*)|*.*"; + if (ofd.ShowDialog() == DialogResult.OK) + { + if (MainV2.joystick == null) + { + CustomMessageBox.Show("No joystick is currently initialized. Please initialize a joystick before importing a configuration.", "Import Joystick Config", MessageBoxButtons.OK); + return; + } + try + { + MainV2.joystick.ImportConfig(ofd.FileName); + MainV2.joystick.loadconfig(); + CustomMessageBox.Show("Please reopen joystick for changes to take effect"); + this.BeginInvoke((Action)delegate () + { + this.Close(); + ((Form)this.Parent).Close(); + }); + } + catch (Exception ex) + { + CustomMessageBox.Show("Failed to import joystick configuration.\n\nError: " + ex.Message, "Import Error"); + } + } } } - } + } } \ No newline at end of file diff --git a/Joystick/JoystickSetup.resx b/Joystick/JoystickSetup.resx index 5c604e0b89..2eb4ed44d3 100644 --- a/Joystick/JoystickSetup.resx +++ b/Joystick/JoystickSetup.resx @@ -138,7 +138,7 @@ $this - 10 + 12 True @@ -169,7 +169,7 @@ $this - 7 + 9 True @@ -199,7 +199,7 @@ $this - 6 + 8 True @@ -229,7 +229,7 @@ $this - 5 + 7 True @@ -259,7 +259,7 @@ $this - 4 + 6 True @@ -289,7 +289,7 @@ $this - 3 + 5 17, 17 @@ -322,7 +322,7 @@ $this - 2 + 4 NoControl @@ -331,7 +331,7 @@ 280, 12 - 75, 23 + 58, 23 22 @@ -343,22 +343,22 @@ BUT_enable - MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this - 8 + 10 NoControl - 361, 12 + 344, 12 - 75, 23 + 44, 23 21 @@ -370,19 +370,19 @@ BUT_save - MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this - 9 + 11 True - 442, 17 + 500, 17 91, 13 @@ -403,7 +403,7 @@ $this - 1 + 3 True @@ -433,95 +433,70 @@ $this + 2 + + + NoControl + + + 394, 12 + + + 49, 23 + + + 59 + + + Export + + + but_export + + + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 1 + + + NoControl + + + 449, 12 + + + 49, 23 + + + 60 + + + Import + + + but_import + + + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + 0 True - - 702, 331 - - - - AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA - AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADOxkjAtnoOAKpJ4vyiK - c+8nh3D/J4Zv/yeHcP8oi3PvKpJ4vy6fg4AzsZIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjGo2AyspPfLZ+D/yiQ - d/8hlXj/G6F9/xeqg/8XqYL/GKqD/xuhfv8ilnn/KZB3/y2fhP8yspPfN8ajYAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvRrDA1vpzfL6uN/yel - hP8XvJD/DMyY/wfQl/8FzJP/A8qS/wPJkf8EypL/BsyU/wnRmP8PzZn/Gb2R/yemhP8tqoz/Mb2a3zbQ - qkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAA4y6ZgMbWV/yin - iP8WwZP/Btqf/wDPlf8AyI7/A8aP/yfNnv9T2LP/UNax/03XsP8506b/G8ya/wHKkf8F0Zf/CNuf/xLB - kv8fpYT/J7KQ/y7IomAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAANcajny+w - kf8hqoj/CNSd/wDRlf8Axor/Hcyd/3Lhwf+p7Nj/o+vV/57m0/+X5dD/k+TN/4/jzf+K5Mz/fuHH/0PW - rf8HzJT/ANCT/wDRlv8OpX//HayI/yrFn58AAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAADDC - nmAtro7/H62J/wPWmv8Ay47/AMaO/3XhxP+e6tT/mObP/5Pjy/+Q4sr/jODJ/4ffx/+C3MT/f9vC/3nb - wf9y2r7/adq7/2DauP8ZzZv/Fdae/8T/9/9WxKj/HKuI/y7IomAAAAAAAAAAAAAAAAD///8AAAAAAAAA - AAAiuZMwKKyM/x6ohf8C1Zr/AMmL/wHGjv+49OL///////////9+3ML/f9zD/4Dcwv9+28L/e9rA/3bZ - vv9w1rr/Z9S4/17Rs/9Qz63/Qcyn/3LewP////////////n///8MpH7/JbKP/zXQqUAAAAAAAAAAAP// - /wAAAAAAAAAAABymhN8dnn//BNGa/wDKjP8AxY3/sfHf/////////////////2nXt/9w1rv/c9e8/3TX - vP9x17z/a9W5/2TTtf9Y0K//SMyp/zXFoP9i07X/////////////////f/LR/wDQlf8epYT/Mb2a3wAA - AAAAAAAA////AAAAAAADlnJgFZR1/wq4iv8AzpH/AMCD/4rmzf//////////////////////WdGv/2PU - tf9p1rf/atS4/2nUtv9i0rT/Vc+u/0fKpv8zxZz/Ws+w//////////////////////8GyJL/ANCS/xLB - kv8tq4z/OMajYAAAAAD///8AAAAAAACHZt8NkW//ANKV/wDChP9i27r//////////////////////9Dx - 6P9MzKn/Vc+v/17Rsv9g0rP/XNCx/1XNrv9Fyaf/McSd/1fPr///////////////////////QM2m/ynK - oP8JzJX/C9yh/ymmhf80spPfAAAAAP///wAAcUwwAHtc/wCrfP8AyIv/AMKK//////////////////// - /////////////5Dgyv9Gyqb/TMyq/07Nq/9MzKn/Qcmj/y/Fnf9Wzq3//////////////////////57k - 0v8av5T/Lceg/yzOo/8M05v/Hr6T/zCghf80spIw////AABoRYAAclT/AL2H/wDBhf9R1rL///////// - ////////4vfw//////////////////H8+P9KzKn/Ocah/zTFnv8qwpj/Us2t//////////////////// - ////////DLqM/yDBlv8wxp//OM6m/xPPm/8Xz53/LZF5/y+fg4////8AAGNAvwB7Wf8Aw4j/ALyC/4bj - yP+g5tL/g93E/2HSsv9Pzqz/Us6s//////////////////////9Yzq//Gr2S/0jLp/////////////// - /////////////yrDm/8SvI//JMGY/zDHn/81zKT/Is2e/xTUnf8nl3v/LJJ5v////wAAXz3vAIlg/wDA - hf8AuoD/quzZ/5Hjyv9628D/ada2/1jRsP9Jy6f/a9a4//////////////////////+Y4s7///////// - //////////////////+c4tD/AbaH/xW8kf8jwZj/LcWd/y/Jn/8kzJ3/E9Ca/yGjgf8ri3Tv////AABd - PP8Ak2b/AL6D/w/Ekv+m6tf/j+HJ/3vawP9p1rf/W9Gx/0rNqf85yJ//Nsaf//////////////////// - /////////////////////////////wCwe/8AtoT/ELqP/xu+k/8jwZj/KMeb/yHKm/8QzZf/HqyG/ymI - cf////8AAF07/wCSZP8AvYL/GMWU/6Dn1P+K38f/ddi+/27Wuf+E3MX/leHN/6fm1f+l5tX/neLQ//// - ////////////////////////////////////////j9/J/27Vuv9Tzq7/JsKY/xa/kv8aw5T/FcaW/wvL - lf8aqoT/J4dw/////wAAXTv/AJFk/wC9gP8GwY3/mObQ/5rkz/+26dv/y/Hl/8Dt3/+06tz/pebV/5bg - zP+g5NL//////////////v///f7+//7+/v//////7fn2////////////tOnb/6Ll0v+v6Nj/jeDI/zXK - o/8IxJD/BMqS/xaqgv8lh2//////AABeO+8AgVf/AL1//wDBif/R9uv/1PPq/8Tv5P+36t3/rujY/6Lk - 0v+U4cv/jt7J//j8+///////+/38//f8+//2+/r/+Pz7//3+/v/m9/P/9Pv6//D6+P9/28L/jd7J/5jj - z/+h5dL/qOvX/4Hmyf8f1J//E596/yOJcO////8AAGA8vwB3U/8p06P/hufM/8Ty5f/D7+T/s+vb/6bm - 1P+c4c//j9/K/4vcyP/t+fb///7///j8/P/0+/r/8vr5//P7+f/1+/r/+/39///////i9fL/ZNO1/3HW - vP992sH/htzG/4vhyv+S5dD/mO7W/6X74v80noT/Io90v////wAAZkCAAHla/33ny/945cb/nunV/7Xr - 3v+l5tT/luDN/4ndxv992cL/1vLq//v9/P/1+/n/8vv4//L69//z+/j/9Pv5/7Xo2//x+vn///////// - //+y59n/aNS3/3LWvP932r//fNzD/4Ljyf+J7ND/l/bd/yORdf8knH6A////AABuRzAAdlT/Xc6x/23o - xv9s4MH/qurZ/5jiz/+I3cb/edjA/8ju5f/3/Pv/8vv4//H6+P/y+/j/6/f0/7np3v/7/fz//v7+/6fk - 1f+56tz///////////9h0bT/aNW4/23Wu/9v3L//dOLG/37w0f9m1rn/Hpt8/ymujTD///8AAAAAAACD - X98po4X/Z+7K/1vgvP+A4sf/jOHK/3rZwv+r59f/9Pv6/+/69//v+vf/8vr4/9fy6/9n0rf/VM6t/6Di - 0v/N7+f/adO4/1PMrf9t1Lr/i9zI/1/Rs/9h0rX/ZNe4/2bbvf9s5sb/ePfV/z2ylf8lrozfAAAAAP// - /wAAAAAAAJNsYAWQbf9U1rP/Vee//0rYsf993sb/pebV//P7+v/s+Pb/6/f1/+749v+s5tj/Vc2u/1jP - r/9ZzrD/btW5/1bOr/9Wza//Vs6v/1fOr/9Z0LD/WdCy/1vTtP9d1rX/Xt+8/2btyP9k4L//IaaF/y7D - nmAAAAAA////AAAAAAAAAAAAD6J9zyCjgv9S68L/P9+0/2Pevv/5////7/v6/+v59//j9/L/gtvF/1PN - r/9Wz7D/Wc+x/1nQsf9Zz7H/WM6w/1fPsP9UzrD/VM+w/1TPrv9U0a//U9Oy/1Tatv9Z5sD/Y/LL/zSx - lP8qupbPAAAAAAAAAAD///8AAAAAAAAAAAAYto4wGaeE/y23lP8+5rn/6/////j////w//3/ve/i/2bV - uP9Tzq7/Vc+v/1jPsP9Z0LL/WM+w/1fOsf9Wz7D/Us2w/1HOrf9Qzq3/T9Cu/0zSr/9M2LP/TeC5/1bt - xP9HxaX/KLKQ/zTPqDAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAkvpdgG6iF/y++m//e/////P///3rl - yf9G0K3/VdKy/1bPsf9Wz7H/Vs6w/1bPsP9Sza//Ucyu/0/Nrf9NzKz/S82s/0fOrP9G0a7/QdWv/0Le - tP9I6L7/Q8Ok/yitjP8yyKJgAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAmwJlgG6iF/yK3 - kP8k3q7/H9el/x7Pn/8tzKT/Q9Cs/1HQsP9Q0K7/TM6u/0nMrf9Hzaz/RMyp/0LNqf8+zqn/ONGo/zTV - qf833rD/O+S4/zvCof8orIv/MMSfYAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAA - AAAkvpdgG6iE/xukgv8gy53/HNql/xzRn/8czJz/HcmZ/yXJnP8qyp7/Lcqg/yzLn/8nypz/JMqc/yTO - n/8l1KT/KN2r/y3Tpv8nq4n/JaqJ/yzAm2AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAato8wFKN/zxCScv8RnHn/DbqM/wjIlP8GyZT/BsaS/wbFkf8GxZH/B8WR/wfH - k/8IypX/DMmV/xG3jP8WoX3/Fph2/xqkgs8ft5EwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJVvYACGZM8Aelr/AHlZ/wCFX/8AiWL/AJlr/wCb - bP8AlGf/AI5k/wB/W/8AeFj/AHtb/wCHZd8ClXBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwSzAAaESAAGI/vwBf - Pd8AXTz/AF08/wBdPP8AXz3fAGJAvwBoRIAAcUswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A/+AD//+AAP/+AAA//AAAH/gAAA/wAAAH4AAAA+AAAAPAAAABwAAAAYAA - AACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAwAAAAcAAAAHgAAAD4AAAA/AA - AAf4AAAP/AAAH/4AAD//gAD//+AD//////8= - - 495, 246 - - Joystick + + 702, 331 timer1 @@ -533,6 +508,6 @@ JoystickSetup - System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.MyUserControl, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null \ No newline at end of file