diff --git a/Tools/ArdupilotMegaPlanner/Antenna/ArduTracker.cs b/Tools/ArdupilotMegaPlanner/Antenna/ArduTracker.cs index 8665324335198a82d8f73963fc05c5e8dc526f7d..8b4fee9116c31c6b7c190186c110292dc163aee0 100644 --- a/Tools/ArdupilotMegaPlanner/Antenna/ArduTracker.cs +++ b/Tools/ArdupilotMegaPlanner/Antenna/ArduTracker.cs @@ -7,7 +7,7 @@ namespace ArdupilotMega.Antenna { class ArduTracker : ITrackerOutput { - public SerialPort ComPort { get; set; } + public Comms.SerialPort ComPort { get; set; } /// <summary> /// 0-360 /// </summary> diff --git a/Tools/ArdupilotMegaPlanner/Antenna/ITrackerOutput.cs b/Tools/ArdupilotMegaPlanner/Antenna/ITrackerOutput.cs index bee2aa98dffcc3a961cf32942ec1d1cdb5fdb83f..4791cae5f9a6fbc7e196e7c703bc2016606f6b9d 100644 --- a/Tools/ArdupilotMegaPlanner/Antenna/ITrackerOutput.cs +++ b/Tools/ArdupilotMegaPlanner/Antenna/ITrackerOutput.cs @@ -7,7 +7,7 @@ namespace ArdupilotMega.Antenna { interface ITrackerOutput { - SerialPort ComPort { get; set; } + Comms.SerialPort ComPort { get; set; } double TrimPan { get; set; } double TrimTilt { get; set; } diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Maestro.cs b/Tools/ArdupilotMegaPlanner/Antenna/Maestro.cs index f77df0945010fd4f6689f7d79d525e3067eb1222..e7e52d3047fb31e8a8a64c2280174ed862974b0a 100644 --- a/Tools/ArdupilotMegaPlanner/Antenna/Maestro.cs +++ b/Tools/ArdupilotMegaPlanner/Antenna/Maestro.cs @@ -7,7 +7,7 @@ namespace ArdupilotMega.Antenna { class Maestro : ITrackerOutput { - public SerialPort ComPort { get; set; } + public Comms.SerialPort ComPort { get; set; } /// <summary> /// 0-360 /// </summary> diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.Designer.cs b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.Designer.cs index 7ac7ab2cdc95416054cc471a900b535d57727ed9..90eea7c067138c18139a250c6c32c21c2f7184f7 100644 --- a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.Designer.cs @@ -52,7 +52,7 @@ this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); - this.BUT_connect = new ArdupilotMega.MyButton(); + this.BUT_connect = new ArdupilotMega.Controls.MyButton(); this.LBL_pantrim = new System.Windows.Forms.Label(); this.LBL_tilttrim = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.TRK_pantrim)).BeginInit(); @@ -266,7 +266,7 @@ private System.Windows.Forms.ComboBox CMB_interface; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox CMB_baudrate; - private MyButton BUT_connect; + private ArdupilotMega.Controls.MyButton BUT_connect; private System.Windows.Forms.ComboBox CMB_serialport; private System.Windows.Forms.TrackBar TRK_pantrim; private System.Windows.Forms.TextBox TXT_panrange; diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs index 589f67111d03ae31e9b530065797d48f0e820397..d768645b786f05e0f20bb330437045a3bb036eb0 100644 --- a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs +++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Comms; namespace ArdupilotMega.Antenna { diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.resx b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.resx index ee9137adcd31599c48ca5dd2490ba9eceed8fa4c..74e13663a7444cdee5b1374cd43e127b1e15a81c 100644 --- a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.resx +++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.resx @@ -750,7 +750,7 @@ <value>BUT_connect</value> </data> <data name=">>BUT_connect.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_connect.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/ArduinoComms.cs b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoComms.cs similarity index 94% rename from Tools/ArdupilotMegaPlanner/ArduinoComms.cs rename to Tools/ArdupilotMegaPlanner/Arduino/ArduinoComms.cs index a685523550ad40551ff98b5f33a91862ce4d06ba..9647491a7470e50ad21a7464f7925562ae352f2f 100644 --- a/Tools/ArdupilotMegaPlanner/ArduinoComms.cs +++ b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoComms.cs @@ -1,38 +1,38 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO.Ports; -using System.IO; - -namespace ArdupilotMega -{ - public delegate void ProgressEventHandler(int progress,string status); - - /// <summary> - /// Arduino STK interface - /// </summary> - interface ArduinoComms - { - bool connectAP(); - bool keepalive(); - bool sync(); - byte[] download(short length); - byte[] downloadflash(short length); - bool setaddress(int address); - bool upload(byte[] data, short startfrom, short length, short startaddress); - bool uploadflash(byte[] data, int startfrom, int length, int startaddress); - - event ProgressEventHandler Progress; - - // from serialport class - int BaudRate { get; set; } - bool DtrEnable { get; set; } - string PortName { get; set; } - StopBits StopBits { get; set; } - Parity Parity { get; set; } - bool IsOpen { get; } - void Open(); - void Close(); - int DataBits { get; set; } - } -} +using System; +using System.Collections.Generic; +using System.Text; +using System.IO.Ports; +using System.IO; + +namespace ArdupilotMega.Arduino +{ + public delegate void ProgressEventHandler(int progress,string status); + + /// <summary> + /// Arduino STK interface + /// </summary> + interface ArduinoComms + { + bool connectAP(); + bool keepalive(); + bool sync(); + byte[] download(short length); + byte[] downloadflash(short length); + bool setaddress(int address); + bool upload(byte[] data, short startfrom, short length, short startaddress); + bool uploadflash(byte[] data, int startfrom, int length, int startaddress); + + event ProgressEventHandler Progress; + + // from serialport class + int BaudRate { get; set; } + bool DtrEnable { get; set; } + string PortName { get; set; } + StopBits StopBits { get; set; } + Parity Parity { get; set; } + bool IsOpen { get; } + void Open(); + void Close(); + int DataBits { get; set; } + } +} diff --git a/Tools/ArdupilotMegaPlanner/ArduinoDetect.cs b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoDetect.cs similarity index 96% rename from Tools/ArdupilotMegaPlanner/ArduinoDetect.cs rename to Tools/ArdupilotMegaPlanner/Arduino/ArduinoDetect.cs index ffa350cb5d18f5259ec2b03a00ba0c64564fc544..19c8bdea71180c9b64ed59af7d15f21b3d59c3de 100644 --- a/Tools/ArdupilotMegaPlanner/ArduinoDetect.cs +++ b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoDetect.cs @@ -1,460 +1,461 @@ -using System; -using System.Reflection; -using System.Management; -using System.Windows.Forms; -using System.Threading; -using log4net; -using System.Globalization; - -namespace ArdupilotMega -{ - class ArduinoDetect - { - private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// <summary> - /// detects STK version 1 or 2 - /// </summary> - /// <param name="port">comportname</param> - /// <returns>string either (1280/2560) or "" for none</returns> - public static string DetectVersion(string port) - { - SerialPort serialPort = new SerialPort(); - serialPort.PortName = port; - - if (serialPort.IsOpen) - serialPort.Close(); - - serialPort.DtrEnable = true; - serialPort.BaudRate = 57600; - serialPort.Open(); - - Thread.Sleep(100); - - int a = 0; - while (a < 20) // 20 * 50 = 1 sec - { - //Console.WriteLine("write " + DateTime.Now.Millisecond); - serialPort.DiscardInBuffer(); - serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); - a++; - Thread.Sleep(50); - - //Console.WriteLine("btr {0}", serialPort.BytesToRead); - if (serialPort.BytesToRead >= 2) - { - byte b1 = (byte)serialPort.ReadByte(); - byte b2 = (byte)serialPort.ReadByte(); - if (b1 == 0x14 && b2 == 0x10) - { - serialPort.Close(); - return "1280"; - } - } - } - - serialPort.Close(); - - log.Warn("Not a 1280"); - - Thread.Sleep(500); - - serialPort.DtrEnable = true; - serialPort.BaudRate = 115200; - serialPort.Open(); - - Thread.Sleep(100); - - a = 0; - while (a < 4) - { - byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 }; - temp = ArduinoDetect.genstkv2packet(serialPort, temp); - a++; - Thread.Sleep(50); - - try - { - if (temp[0] == 6 && temp[1] == 0 && temp.Length == 2) - { - serialPort.Close(); - - return "2560"; - - } - } - catch - { - } - } - - serialPort.Close(); - log.Warn("Not a 2560"); - return ""; - } - - /// <summary> - /// Detects APM board version - /// </summary> - /// <param name="port"></param> - /// <returns> (1280/2560/2560-2)</returns> - public static string DetectBoard(string port) - { - SerialPort serialPort = new SerialPort(); - serialPort.PortName = port; - - if (serialPort.IsOpen) - serialPort.Close(); - - serialPort.DtrEnable = true; - serialPort.BaudRate = 57600; - serialPort.Open(); - - Thread.Sleep(100); - - int a = 0; - while (a < 20) // 20 * 50 = 1 sec - { - //Console.WriteLine("write " + DateTime.Now.Millisecond); - serialPort.DiscardInBuffer(); - serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); - a++; - Thread.Sleep(50); - - //Console.WriteLine("btr {0}", serialPort.BytesToRead); - if (serialPort.BytesToRead >= 2) - { - byte b1 = (byte)serialPort.ReadByte(); - byte b2 = (byte)serialPort.ReadByte(); - if (b1 == 0x14 && b2 == 0x10) - { - serialPort.Close(); - return "1280"; - } - } - } - - serialPort.Close(); - - log.Warn("Not a 1280"); - - Thread.Sleep(500); - - serialPort.DtrEnable = true; - serialPort.BaudRate = 115200; - serialPort.Open(); - - Thread.Sleep(100); - - a = 0; - while (a < 4) - { - byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 }; - temp = ArduinoDetect.genstkv2packet(serialPort, temp); - a++; - Thread.Sleep(50); - - try - { - if (temp[0] == 6 && temp[1] == 0 && temp.Length == 2) - { - serialPort.Close(); - //HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_2341&PID_0010\640333439373519060F0\Device Parameters - if (!MainV2.MONO && !Thread.CurrentThread.CurrentUICulture.IsChildOf(CultureInfoEx.GetCultureInfo("zh-Hans"))) - { - ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_USBControllerDevice"); - ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); - foreach (ManagementObject obj2 in searcher.Get()) - { - //Console.WriteLine("Dependant : " + obj2["Dependent"]); - - // all apm 1-1.4 use a ftdi on the imu board. - - if (obj2["Dependent"].ToString().Contains(@"USB\\VID_2341&PID_0010")) - { - return "2560-2"; - } - } - - return "2560"; - } - else - { - if (DialogResult.Yes == CustomMessageBox.Show("Is this a APM 2?", "APM 2", MessageBoxButtons.YesNo)) - { - return "2560-2"; - } - else - { - return "2560"; - } - } - - } - } - catch { } - } - - serialPort.Close(); - log.Warn("Not a 2560"); - return ""; - } - - public enum ap_var_type - { - AP_PARAM_NONE = 0, - AP_PARAM_INT8, - AP_PARAM_INT16, - AP_PARAM_INT32, - AP_PARAM_FLOAT, - AP_PARAM_VECTOR3F, - AP_PARAM_VECTOR6F, - AP_PARAM_MATRIX3F, - AP_PARAM_GROUP - }; - - static string[] type_names = new string[] { - "NONE", "INT8", "INT16", "INT32", "FLOAT", "VECTOR3F", "VECTOR6F","MATRIX6F", "GROUP" -}; - - static byte type_size(ap_var_type type) -{ - switch (type) { - case ap_var_type.AP_PARAM_NONE: - case ap_var_type.AP_PARAM_GROUP: - return 0; - case ap_var_type.AP_PARAM_INT8: - return 1; - case ap_var_type.AP_PARAM_INT16: - return 2; - case ap_var_type.AP_PARAM_INT32: - return 4; - case ap_var_type.AP_PARAM_FLOAT: - return 4; - case ap_var_type.AP_PARAM_VECTOR3F: - return 3*4; - case ap_var_type.AP_PARAM_VECTOR6F: - return 6*4; - case ap_var_type.AP_PARAM_MATRIX3F: - return 3*3*4; - } - return 0; -} - - /// <summary> - /// return the software id from eeprom - /// </summary> - /// <param name="comport">Port</param> - /// <param name="version">Board type</param> - /// <returns></returns> - public static int decodeApVar(string comport, string version) - { - ArduinoComms port = new ArduinoSTK(); - if (version == "1280") - { - port = new ArduinoSTK(); - port.BaudRate = 57600; - } - else if (version == "2560" || version == "2560-2") - { - port = new ArduinoSTKv2(); - port.BaudRate = 115200; - } - else { return -1; } - port.PortName = comport; - port.DtrEnable = true; - port.Open(); - port.connectAP(); - byte[] buffer = port.download(1024 * 4); - port.Close(); - - if (buffer[0] != 'A' && buffer[0] != 'P' || buffer[1] != 'P' && buffer[1] != 'A') // this is the apvar header - { - return -1; - } - else - { - if (buffer[0] == 'A' && buffer[1] == 'P' && buffer[2] == 2) - { // apvar header and version - int pos = 4; - byte key = 0; - while (pos < (1024 * 4)) - { - int size = buffer[pos] & 63; - pos++; - key = buffer[pos]; - pos++; - - log.InfoFormat("{0:X4}: key {1} size {2}\n ", pos - 2, key, size + 1); - - if (key == 0xff) - { - log.InfoFormat("end sentinal at {0}", pos - 2); - break; - } - - if (key == 0) - { - //Array.Reverse(buffer, pos, 2); - return BitConverter.ToUInt16(buffer, pos); - } - - - for (int i = 0; i <= size; i++) - { - Console.Write(" {0:X2}", buffer[pos]); - pos++; - } - } - } - - if (buffer[0] == 'P' && buffer[1] == 'A' && buffer[2] == 5) // ap param - { - int pos = 4; - byte key = 0; - while (pos < (1024 * 4)) - { - key = buffer[pos]; - pos++; - int group = buffer[pos]; - pos++; - int type = buffer[pos]; - pos++; - - int size = type_size((ap_var_type)Enum.Parse(typeof(ap_var_type), type.ToString())); - - - Console.Write("{0:X4}: type {1} ({2}) key {3} group {4} size {5}\n ", pos - 2, type, type_names[type], key, group, size); - - if (key == 0xff) - { - log.InfoFormat("end sentinal at {0}", pos - 2); - break; - } - - if (key == 0) - { - //Array.Reverse(buffer, pos, 2); - return BitConverter.ToUInt16(buffer, pos); - } - - - for (int i = 0; i < size; i++) - { - Console.Write(" {0:X2}", buffer[pos]); - pos++; - } - } - } - } - return -1; - } - - /// <summary> - /// STK v2 generate packet - /// </summary> - /// <param name="serialPort"></param> - /// <param name="message"></param> - /// <returns></returns> - static byte[] genstkv2packet(SerialPort serialPort, byte[] message) - { - byte[] data = new byte[300]; - byte ck = 0; - - data[0] = 0x1b; - ck ^= data[0]; - data[1] = 0x1; - ck ^= data[1]; - data[2] = (byte)((message.Length >> 8) & 0xff); - ck ^= data[2]; - data[3] = (byte)(message.Length & 0xff); - ck ^= data[3]; - data[4] = 0xe; - ck ^= data[4]; - - int a = 5; - foreach (byte let in message) - { - data[a] = let; - ck ^= let; - a++; - } - data[a] = ck; - a++; - - serialPort.Write(data, 0, a); - //Console.WriteLine("about to read packet"); - - byte[] ret = ArduinoDetect.readpacket(serialPort); - - //if (ret[1] == 0x0) - { - //Console.WriteLine("received OK"); - } - - return ret; - } - - /// <summary> - /// - /// </summary> - /// <param name="serialPort"></param> - /// <returns></returns> - static byte[] readpacket(SerialPort serialPort) - { - byte[] temp = new byte[4000]; - byte[] mes = new byte[2] { 0x0, 0xC0 }; // fail - int a = 7; - int count = 0; - - serialPort.ReadTimeout = 1000; - - while (count < a) - { - //Console.WriteLine("count {0} a {1} mes leng {2}",count,a,mes.Length); - try - { - temp[count] = (byte)serialPort.ReadByte(); - } - catch { break; } - - - //Console.Write("{1}", temp[0], (char)temp[0]); - - if (temp[0] != 0x1b) - { - count = 0; - continue; - } - - if (count == 3) - { - a = (temp[2] << 8) + temp[3]; - mes = new byte[a]; - a += 5; - } - - if (count >= 5) - { - mes[count - 5] = temp[count]; - } - - count++; - } - - //Console.WriteLine("read ck"); - try - { - temp[count] = (byte)serialPort.ReadByte(); - } - catch { } - - count++; - - Array.Resize<byte>(ref temp, count); - - //Console.WriteLine(this.BytesToRead); - - return mes; - } - } +using System; +using System.Reflection; +using System.Management; +using System.Windows.Forms; +using System.Threading; +using log4net; +using System.Globalization; +using ArdupilotMega.Comms; + +namespace ArdupilotMega.Arduino +{ + class ArduinoDetect + { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// <summary> + /// detects STK version 1 or 2 + /// </summary> + /// <param name="port">comportname</param> + /// <returns>string either (1280/2560) or "" for none</returns> + public static string DetectVersion(string port) + { + SerialPort serialPort = new SerialPort(); + serialPort.PortName = port; + + if (serialPort.IsOpen) + serialPort.Close(); + + serialPort.DtrEnable = true; + serialPort.BaudRate = 57600; + serialPort.Open(); + + Thread.Sleep(100); + + int a = 0; + while (a < 20) // 20 * 50 = 1 sec + { + //Console.WriteLine("write " + DateTime.Now.Millisecond); + serialPort.DiscardInBuffer(); + serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); + a++; + Thread.Sleep(50); + + //Console.WriteLine("btr {0}", serialPort.BytesToRead); + if (serialPort.BytesToRead >= 2) + { + byte b1 = (byte)serialPort.ReadByte(); + byte b2 = (byte)serialPort.ReadByte(); + if (b1 == 0x14 && b2 == 0x10) + { + serialPort.Close(); + return "1280"; + } + } + } + + serialPort.Close(); + + log.Warn("Not a 1280"); + + Thread.Sleep(500); + + serialPort.DtrEnable = true; + serialPort.BaudRate = 115200; + serialPort.Open(); + + Thread.Sleep(100); + + a = 0; + while (a < 4) + { + byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 }; + temp = ArduinoDetect.genstkv2packet(serialPort, temp); + a++; + Thread.Sleep(50); + + try + { + if (temp[0] == 6 && temp[1] == 0 && temp.Length == 2) + { + serialPort.Close(); + + return "2560"; + + } + } + catch + { + } + } + + serialPort.Close(); + log.Warn("Not a 2560"); + return ""; + } + + /// <summary> + /// Detects APM board version + /// </summary> + /// <param name="port"></param> + /// <returns> (1280/2560/2560-2)</returns> + public static string DetectBoard(string port) + { + SerialPort serialPort = new SerialPort(); + serialPort.PortName = port; + + if (serialPort.IsOpen) + serialPort.Close(); + + serialPort.DtrEnable = true; + serialPort.BaudRate = 57600; + serialPort.Open(); + + Thread.Sleep(100); + + int a = 0; + while (a < 20) // 20 * 50 = 1 sec + { + //Console.WriteLine("write " + DateTime.Now.Millisecond); + serialPort.DiscardInBuffer(); + serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); + a++; + Thread.Sleep(50); + + //Console.WriteLine("btr {0}", serialPort.BytesToRead); + if (serialPort.BytesToRead >= 2) + { + byte b1 = (byte)serialPort.ReadByte(); + byte b2 = (byte)serialPort.ReadByte(); + if (b1 == 0x14 && b2 == 0x10) + { + serialPort.Close(); + return "1280"; + } + } + } + + serialPort.Close(); + + log.Warn("Not a 1280"); + + Thread.Sleep(500); + + serialPort.DtrEnable = true; + serialPort.BaudRate = 115200; + serialPort.Open(); + + Thread.Sleep(100); + + a = 0; + while (a < 4) + { + byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 }; + temp = ArduinoDetect.genstkv2packet(serialPort, temp); + a++; + Thread.Sleep(50); + + try + { + if (temp[0] == 6 && temp[1] == 0 && temp.Length == 2) + { + serialPort.Close(); + //HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_2341&PID_0010\640333439373519060F0\Device Parameters + if (!MainV2.MONO && !Thread.CurrentThread.CurrentUICulture.IsChildOf(CultureInfoEx.GetCultureInfo("zh-Hans"))) + { + ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_USBControllerDevice"); + ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); + foreach (ManagementObject obj2 in searcher.Get()) + { + //Console.WriteLine("Dependant : " + obj2["Dependent"]); + + // all apm 1-1.4 use a ftdi on the imu board. + + if (obj2["Dependent"].ToString().Contains(@"USB\\VID_2341&PID_0010")) + { + return "2560-2"; + } + } + + return "2560"; + } + else + { + if (DialogResult.Yes == CustomMessageBox.Show("Is this a APM 2?", "APM 2", MessageBoxButtons.YesNo)) + { + return "2560-2"; + } + else + { + return "2560"; + } + } + + } + } + catch { } + } + + serialPort.Close(); + log.Warn("Not a 2560"); + return ""; + } + + public enum ap_var_type + { + AP_PARAM_NONE = 0, + AP_PARAM_INT8, + AP_PARAM_INT16, + AP_PARAM_INT32, + AP_PARAM_FLOAT, + AP_PARAM_VECTOR3F, + AP_PARAM_VECTOR6F, + AP_PARAM_MATRIX3F, + AP_PARAM_GROUP + }; + + static string[] type_names = new string[] { + "NONE", "INT8", "INT16", "INT32", "FLOAT", "VECTOR3F", "VECTOR6F","MATRIX6F", "GROUP" +}; + + static byte type_size(ap_var_type type) +{ + switch (type) { + case ap_var_type.AP_PARAM_NONE: + case ap_var_type.AP_PARAM_GROUP: + return 0; + case ap_var_type.AP_PARAM_INT8: + return 1; + case ap_var_type.AP_PARAM_INT16: + return 2; + case ap_var_type.AP_PARAM_INT32: + return 4; + case ap_var_type.AP_PARAM_FLOAT: + return 4; + case ap_var_type.AP_PARAM_VECTOR3F: + return 3*4; + case ap_var_type.AP_PARAM_VECTOR6F: + return 6*4; + case ap_var_type.AP_PARAM_MATRIX3F: + return 3*3*4; + } + return 0; +} + + /// <summary> + /// return the software id from eeprom + /// </summary> + /// <param name="comport">Port</param> + /// <param name="version">Board type</param> + /// <returns></returns> + public static int decodeApVar(string comport, string version) + { + ArduinoComms port = new ArduinoSTK(); + if (version == "1280") + { + port = new ArduinoSTK(); + port.BaudRate = 57600; + } + else if (version == "2560" || version == "2560-2") + { + port = new ArduinoSTKv2(); + port.BaudRate = 115200; + } + else { return -1; } + port.PortName = comport; + port.DtrEnable = true; + port.Open(); + port.connectAP(); + byte[] buffer = port.download(1024 * 4); + port.Close(); + + if (buffer[0] != 'A' && buffer[0] != 'P' || buffer[1] != 'P' && buffer[1] != 'A') // this is the apvar header + { + return -1; + } + else + { + if (buffer[0] == 'A' && buffer[1] == 'P' && buffer[2] == 2) + { // apvar header and version + int pos = 4; + byte key = 0; + while (pos < (1024 * 4)) + { + int size = buffer[pos] & 63; + pos++; + key = buffer[pos]; + pos++; + + log.InfoFormat("{0:X4}: key {1} size {2}\n ", pos - 2, key, size + 1); + + if (key == 0xff) + { + log.InfoFormat("end sentinal at {0}", pos - 2); + break; + } + + if (key == 0) + { + //Array.Reverse(buffer, pos, 2); + return BitConverter.ToUInt16(buffer, pos); + } + + + for (int i = 0; i <= size; i++) + { + Console.Write(" {0:X2}", buffer[pos]); + pos++; + } + } + } + + if (buffer[0] == 'P' && buffer[1] == 'A' && buffer[2] == 5) // ap param + { + int pos = 4; + byte key = 0; + while (pos < (1024 * 4)) + { + key = buffer[pos]; + pos++; + int group = buffer[pos]; + pos++; + int type = buffer[pos]; + pos++; + + int size = type_size((ap_var_type)Enum.Parse(typeof(ap_var_type), type.ToString())); + + + Console.Write("{0:X4}: type {1} ({2}) key {3} group {4} size {5}\n ", pos - 2, type, type_names[type], key, group, size); + + if (key == 0xff) + { + log.InfoFormat("end sentinal at {0}", pos - 2); + break; + } + + if (key == 0) + { + //Array.Reverse(buffer, pos, 2); + return BitConverter.ToUInt16(buffer, pos); + } + + + for (int i = 0; i < size; i++) + { + Console.Write(" {0:X2}", buffer[pos]); + pos++; + } + } + } + } + return -1; + } + + /// <summary> + /// STK v2 generate packet + /// </summary> + /// <param name="serialPort"></param> + /// <param name="message"></param> + /// <returns></returns> + static byte[] genstkv2packet(SerialPort serialPort, byte[] message) + { + byte[] data = new byte[300]; + byte ck = 0; + + data[0] = 0x1b; + ck ^= data[0]; + data[1] = 0x1; + ck ^= data[1]; + data[2] = (byte)((message.Length >> 8) & 0xff); + ck ^= data[2]; + data[3] = (byte)(message.Length & 0xff); + ck ^= data[3]; + data[4] = 0xe; + ck ^= data[4]; + + int a = 5; + foreach (byte let in message) + { + data[a] = let; + ck ^= let; + a++; + } + data[a] = ck; + a++; + + serialPort.Write(data, 0, a); + //Console.WriteLine("about to read packet"); + + byte[] ret = ArduinoDetect.readpacket(serialPort); + + //if (ret[1] == 0x0) + { + //Console.WriteLine("received OK"); + } + + return ret; + } + + /// <summary> + /// + /// </summary> + /// <param name="serialPort"></param> + /// <returns></returns> + static byte[] readpacket(SerialPort serialPort) + { + byte[] temp = new byte[4000]; + byte[] mes = new byte[2] { 0x0, 0xC0 }; // fail + int a = 7; + int count = 0; + + serialPort.ReadTimeout = 1000; + + while (count < a) + { + //Console.WriteLine("count {0} a {1} mes leng {2}",count,a,mes.Length); + try + { + temp[count] = (byte)serialPort.ReadByte(); + } + catch { break; } + + + //Console.Write("{1}", temp[0], (char)temp[0]); + + if (temp[0] != 0x1b) + { + count = 0; + continue; + } + + if (count == 3) + { + a = (temp[2] << 8) + temp[3]; + mes = new byte[a]; + a += 5; + } + + if (count >= 5) + { + mes[count - 5] = temp[count]; + } + + count++; + } + + //Console.WriteLine("read ck"); + try + { + temp[count] = (byte)serialPort.ReadByte(); + } + catch { } + + count++; + + Array.Resize<byte>(ref temp, count); + + //Console.WriteLine(this.BytesToRead); + + return mes; + } + } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/ArduinoSTK.cs b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoSTK.cs similarity index 96% rename from Tools/ArdupilotMegaPlanner/ArduinoSTK.cs rename to Tools/ArdupilotMegaPlanner/Arduino/ArduinoSTK.cs index 372cf568c8eaad0ad86fd4fd0dc56e1cb694ba00..3a3a825e66156523c07c62f6ddacd5fd692799e3 100644 --- a/Tools/ArdupilotMegaPlanner/ArduinoSTK.cs +++ b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoSTK.cs @@ -1,335 +1,336 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using System.IO.Ports; -using System.Threading; -using log4net; - -// Written by Michael Oborne - -namespace ArdupilotMega -{ - class ArduinoSTK : SerialPort, ArduinoComms - { - private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public event ProgressEventHandler Progress; - - public new void Open() - { - // default dtr status is false - - //from http://svn.savannah.nongnu.org/viewvc/RELEASE_5_11_0/arduino.c?root=avrdude&view=markup - base.Open(); - - base.DtrEnable = false; - base.RtsEnable = false; - - System.Threading.Thread.Sleep(50); - - base.DtrEnable = true; - base.RtsEnable = true; - - System.Threading.Thread.Sleep(50); - } - - /// <summary> - /// Used to start initial connecting after serialport.open - /// </summary> - /// <returns>true = passed, false = failed</returns> - public bool connectAP() - { - if (!this.IsOpen) - { - return false; - } - int a = 0; - while (a < 50) - { - this.DiscardInBuffer(); - this.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); - a++; - Thread.Sleep(50); - - log.InfoFormat("btr {0}", this.BytesToRead); - if (this.BytesToRead >= 2) - { - byte b1 = (byte)this.ReadByte(); - byte b2 = (byte)this.ReadByte(); - if (b1 == 0x14 && b2 == 0x10) - { - return true; - } - } - } - return false; - } - - /// <summary> - /// Used to keep alive the connection - /// </summary> - /// <returns>true = passed, false = lost connection</returns> - public bool keepalive() - { - return connectAP(); - } - /// <summary> - /// Syncs after a private command has been sent - /// </summary> - /// <returns>true = passed, false = failed</returns> - public bool sync() - { - if (!this.IsOpen) - { - return false; - } - this.ReadTimeout = 1000; - int f = 0; - while (this.BytesToRead < 1) - { - f++; - System.Threading.Thread.Sleep(1); - if (f > 1000) - return false; - } - int a = 0; - while (a < 10) - { - if (this.BytesToRead >= 2) - { - byte b1 = (byte)this.ReadByte(); - byte b2 = (byte)this.ReadByte(); - log.DebugFormat("bytes {0:X} {1:X}", b1, b2); - - if (b1 == 0x14 && b2 == 0x10) - { - return true; - } - } - log.DebugFormat("btr {0}", this.BytesToRead); - Thread.Sleep(10); - a++; - } - return false; - } - /// <summary> - /// Downloads the eeprom with the given length - set Address first - /// </summary> - /// <param name="length">eeprom length</param> - /// <returns>downloaded data</returns> - public byte[] download(short length) - { - if (!this.IsOpen) - { - throw new Exception(); - } - byte[] data = new byte[length]; - - byte[] command = new byte[] { (byte)'t', (byte)(length >> 8), (byte)(length & 0xff), (byte)'E', (byte)' ' }; - this.Write(command, 0, command.Length); - - if (this.ReadByte() == 0x14) - { // 0x14 - - int step = 0; - while (step < length) - { - byte chr = (byte)this.ReadByte(); - data[step] = chr; - step++; - } - - if (this.ReadByte() != 0x10) // 0x10 - throw new Exception("Lost Sync 0x10"); - } - else - { - throw new Exception("Lost Sync 0x14"); - } - return data; - } - - public byte[] downloadflash(short length) - { - if (!this.IsOpen) - { - throw new Exception("Port Not Open"); - } - byte[] data = new byte[length]; - - this.ReadTimeout = 1000; - - byte[] command = new byte[] { (byte)'t', (byte)(length >> 8), (byte)(length & 0xff), (byte)'F', (byte)' ' }; - this.Write(command, 0, command.Length); - - if (this.ReadByte() == 0x14) - { // 0x14 - - int read = length; - while (read > 0) - { - //Console.WriteLine("offset {0} read {1}", length - read, read); - read -= this.Read(data, length - read, read); - //System.Threading.Thread.Sleep(1); - } - - if (this.ReadByte() != 0x10) // 0x10 - throw new Exception("Lost Sync 0x10"); - } - else - { - throw new Exception("Lost Sync 0x14"); - } - return data; - } - - public bool uploadflash(byte[] data, int startfrom, int length, int startaddress) - { - if (!this.IsOpen) - { - return false; - } - int loops = (length / 0x100); - int totalleft = length; - int sending = 0; - - for (int a = 0; a <= loops; a++) - { - if (totalleft > 0x100) - { - sending = 0x100; - } - else - { - sending = totalleft; - } - - //startaddress = 256; - if (sending == 0) - return true; - - setaddress(startaddress); - startaddress += sending; - - byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'F' }; - this.Write(command, 0, command.Length); - log.Info((startfrom + (length - totalleft)) + " - " + sending); - this.Write(data, startfrom + (length - totalleft), sending); - command = new byte[] { (byte)' ' }; - this.Write(command, 0, command.Length); - - totalleft -= sending; - - - if (Progress != null) - Progress((int)(((float)startaddress / (float)length) * 100),""); - - if (!sync()) - { - log.Info("No Sync"); - return false; - } - } - return true; - } - - /// <summary> - /// Sets the eeprom start read or write address - /// </summary> - /// <param name="address">address, must be eaven number</param> - /// <returns>true = passed, false = failed</returns> - public bool setaddress(int address) - { - if (!this.IsOpen) - { - return false; - } - - if (address % 2 == 1) - { - throw new Exception("Address must be an even number"); - } - - log.Info("Sending address " + ((ushort)(address / 2))); - - address /= 2; - address = (ushort)address; - - byte[] command = new byte[] { (byte)'U', (byte)(address & 0xff), (byte)(address >> 8), (byte)' ' }; - this.Write(command, 0, command.Length); - - return sync(); - } - - /// <summary> - /// Upload data at preset address - /// </summary> - /// <param name="data">array to read from</param> - /// <param name="startfrom">start array index</param> - /// <param name="length">length to send</param> - /// <param name="startaddress">sets eeprom start programing address</param> - /// <returns>true = passed, false = failed</returns> - public bool upload(byte[] data, short startfrom, short length, short startaddress) - { - if (!this.IsOpen) - { - return false; - } - int loops = (length / 0x100); - int totalleft = length; - int sending = 0; - - for (int a = 0; a <= loops; a++) - { - if (totalleft > 0x100) - { - sending = 0x100; - } - else - { - sending = totalleft; - } - - if (sending == 0) - return true; - - setaddress(startaddress); - startaddress += (short)sending; - - byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'E' }; - this.Write(command, 0, command.Length); - log.Info((startfrom + (length - totalleft)) + " - " + sending); - this.Write(data, startfrom + (length - totalleft), sending); - command = new byte[] { (byte)' ' }; - this.Write(command, 0, command.Length); - - totalleft -= sending; - - if (!sync()) - { - log.Info("No Sync"); - return false; - } - } - return true; - } - - public new bool Close() - { - try - { - - byte[] command = new byte[] { (byte)'Q', (byte)' ' }; - this.Write(command, 0, command.Length); - } - catch { } - - if (base.IsOpen) - base.Close(); - - this.DtrEnable = false; - this.RtsEnable = false; - return true; - } - } +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Threading; +using log4net; +using ArdupilotMega.Comms; + + +// Written by Michael Oborne + +namespace ArdupilotMega.Arduino +{ + class ArduinoSTK : SerialPort, ArduinoComms + { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event ProgressEventHandler Progress; + + public new void Open() + { + // default dtr status is false + + //from http://svn.savannah.nongnu.org/viewvc/RELEASE_5_11_0/arduino.c?root=avrdude&view=markup + base.Open(); + + base.DtrEnable = false; + base.RtsEnable = false; + + System.Threading.Thread.Sleep(50); + + base.DtrEnable = true; + base.RtsEnable = true; + + System.Threading.Thread.Sleep(50); + } + + /// <summary> + /// Used to start initial connecting after serialport.open + /// </summary> + /// <returns>true = passed, false = failed</returns> + public bool connectAP() + { + if (!this.IsOpen) + { + return false; + } + int a = 0; + while (a < 50) + { + this.DiscardInBuffer(); + this.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); + a++; + Thread.Sleep(50); + + log.InfoFormat("btr {0}", this.BytesToRead); + if (this.BytesToRead >= 2) + { + byte b1 = (byte)this.ReadByte(); + byte b2 = (byte)this.ReadByte(); + if (b1 == 0x14 && b2 == 0x10) + { + return true; + } + } + } + return false; + } + + /// <summary> + /// Used to keep alive the connection + /// </summary> + /// <returns>true = passed, false = lost connection</returns> + public bool keepalive() + { + return connectAP(); + } + /// <summary> + /// Syncs after a private command has been sent + /// </summary> + /// <returns>true = passed, false = failed</returns> + public bool sync() + { + if (!this.IsOpen) + { + return false; + } + this.ReadTimeout = 1000; + int f = 0; + while (this.BytesToRead < 1) + { + f++; + System.Threading.Thread.Sleep(1); + if (f > 1000) + return false; + } + int a = 0; + while (a < 10) + { + if (this.BytesToRead >= 2) + { + byte b1 = (byte)this.ReadByte(); + byte b2 = (byte)this.ReadByte(); + log.DebugFormat("bytes {0:X} {1:X}", b1, b2); + + if (b1 == 0x14 && b2 == 0x10) + { + return true; + } + } + log.DebugFormat("btr {0}", this.BytesToRead); + Thread.Sleep(10); + a++; + } + return false; + } + /// <summary> + /// Downloads the eeprom with the given length - set Address first + /// </summary> + /// <param name="length">eeprom length</param> + /// <returns>downloaded data</returns> + public byte[] download(short length) + { + if (!this.IsOpen) + { + throw new Exception(); + } + byte[] data = new byte[length]; + + byte[] command = new byte[] { (byte)'t', (byte)(length >> 8), (byte)(length & 0xff), (byte)'E', (byte)' ' }; + this.Write(command, 0, command.Length); + + if (this.ReadByte() == 0x14) + { // 0x14 + + int step = 0; + while (step < length) + { + byte chr = (byte)this.ReadByte(); + data[step] = chr; + step++; + } + + if (this.ReadByte() != 0x10) // 0x10 + throw new Exception("Lost Sync 0x10"); + } + else + { + throw new Exception("Lost Sync 0x14"); + } + return data; + } + + public byte[] downloadflash(short length) + { + if (!this.IsOpen) + { + throw new Exception("Port Not Open"); + } + byte[] data = new byte[length]; + + this.ReadTimeout = 1000; + + byte[] command = new byte[] { (byte)'t', (byte)(length >> 8), (byte)(length & 0xff), (byte)'F', (byte)' ' }; + this.Write(command, 0, command.Length); + + if (this.ReadByte() == 0x14) + { // 0x14 + + int read = length; + while (read > 0) + { + //Console.WriteLine("offset {0} read {1}", length - read, read); + read -= this.Read(data, length - read, read); + //System.Threading.Thread.Sleep(1); + } + + if (this.ReadByte() != 0x10) // 0x10 + throw new Exception("Lost Sync 0x10"); + } + else + { + throw new Exception("Lost Sync 0x14"); + } + return data; + } + + public bool uploadflash(byte[] data, int startfrom, int length, int startaddress) + { + if (!this.IsOpen) + { + return false; + } + int loops = (length / 0x100); + int totalleft = length; + int sending = 0; + + for (int a = 0; a <= loops; a++) + { + if (totalleft > 0x100) + { + sending = 0x100; + } + else + { + sending = totalleft; + } + + //startaddress = 256; + if (sending == 0) + return true; + + setaddress(startaddress); + startaddress += sending; + + byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'F' }; + this.Write(command, 0, command.Length); + log.Info((startfrom + (length - totalleft)) + " - " + sending); + this.Write(data, startfrom + (length - totalleft), sending); + command = new byte[] { (byte)' ' }; + this.Write(command, 0, command.Length); + + totalleft -= sending; + + + if (Progress != null) + Progress((int)(((float)startaddress / (float)length) * 100),""); + + if (!sync()) + { + log.Info("No Sync"); + return false; + } + } + return true; + } + + /// <summary> + /// Sets the eeprom start read or write address + /// </summary> + /// <param name="address">address, must be eaven number</param> + /// <returns>true = passed, false = failed</returns> + public bool setaddress(int address) + { + if (!this.IsOpen) + { + return false; + } + + if (address % 2 == 1) + { + throw new Exception("Address must be an even number"); + } + + log.Info("Sending address " + ((ushort)(address / 2))); + + address /= 2; + address = (ushort)address; + + byte[] command = new byte[] { (byte)'U', (byte)(address & 0xff), (byte)(address >> 8), (byte)' ' }; + this.Write(command, 0, command.Length); + + return sync(); + } + + /// <summary> + /// Upload data at preset address + /// </summary> + /// <param name="data">array to read from</param> + /// <param name="startfrom">start array index</param> + /// <param name="length">length to send</param> + /// <param name="startaddress">sets eeprom start programing address</param> + /// <returns>true = passed, false = failed</returns> + public bool upload(byte[] data, short startfrom, short length, short startaddress) + { + if (!this.IsOpen) + { + return false; + } + int loops = (length / 0x100); + int totalleft = length; + int sending = 0; + + for (int a = 0; a <= loops; a++) + { + if (totalleft > 0x100) + { + sending = 0x100; + } + else + { + sending = totalleft; + } + + if (sending == 0) + return true; + + setaddress(startaddress); + startaddress += (short)sending; + + byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'E' }; + this.Write(command, 0, command.Length); + log.Info((startfrom + (length - totalleft)) + " - " + sending); + this.Write(data, startfrom + (length - totalleft), sending); + command = new byte[] { (byte)' ' }; + this.Write(command, 0, command.Length); + + totalleft -= sending; + + if (!sync()) + { + log.Info("No Sync"); + return false; + } + } + return true; + } + + public new bool Close() + { + try + { + + byte[] command = new byte[] { (byte)'Q', (byte)' ' }; + this.Write(command, 0, command.Length); + } + catch { } + + if (base.IsOpen) + base.Close(); + + this.DtrEnable = false; + this.RtsEnable = false; + return true; + } + } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/ArduinoSTKv2.cs b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoSTKv2.cs similarity index 96% rename from Tools/ArdupilotMegaPlanner/ArduinoSTKv2.cs rename to Tools/ArdupilotMegaPlanner/Arduino/ArduinoSTKv2.cs index 746a6f0e103f81e128e0431fe662d46404a0afc9..81351906f44bb2d151747cf79b9bf46593a5847e 100644 --- a/Tools/ArdupilotMegaPlanner/ArduinoSTKv2.cs +++ b/Tools/ArdupilotMegaPlanner/Arduino/ArduinoSTKv2.cs @@ -1,388 +1,388 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using System.IO.Ports; -using System.Threading; -using log4net; - -// Written by Michael Oborne - -namespace ArdupilotMega -{ - class ArduinoSTKv2 : SerialPort,ArduinoComms - { - private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public event ProgressEventHandler Progress; - - public new void Open() - { - // default dtr status is false - - //from http://svn.savannah.nongnu.org/viewvc/RELEASE_5_11_0/arduino.c?root=avrdude&view=markup - base.Open(); - - base.DtrEnable = false; - base.RtsEnable = false; - - System.Threading.Thread.Sleep(50); - - base.DtrEnable = true; - base.RtsEnable = true; - - System.Threading.Thread.Sleep(50); - } - - public byte[] genstkv2packet(byte[] message) - { - byte[] data = new byte[300]; - byte ck = 0; - - data[0] = 0x1b; - ck ^= data[0]; - data[1] = 0x1; - ck ^= data[1]; - data[2] = (byte)((message.Length >> 8) & 0xff); - ck ^= data[2]; - data[3] = (byte)(message.Length & 0xff); - ck ^= data[3]; - data[4] = 0xe; - ck ^= data[4]; - - int a = 5; - foreach (byte let in message) - { - data[a] = let; - ck ^= let; - a++; - } - data[a] = ck; - a++; - - this.Write(data,0,a); - //Console.WriteLine("about to read packet"); - - byte[] ret = readpacket(); - - //if (ret[1] == 0x0) - { - //Console.WriteLine("received OK"); - } - - return ret; - } - - byte[] readpacket() - { - byte[] temp = new byte[4000]; - byte[] mes = new byte[2] { 0x0, 0xC0 }; // fail - int a = 7; - int count = 0; - - this.ReadTimeout = 1000; - - while (count < a) - { - //Console.WriteLine("count {0} a {1} mes leng {2}",count,a,mes.Length); - try - { - temp[count] = (byte)this.ReadByte(); - } - catch { break; } - - - //Console.Write("{1}", temp[0], (char)temp[0]); - - if (temp[0] != 0x1b) - { - count = 0; - continue; - } - - if (count == 3) - { - a = (temp[2] << 8) + temp[3]; - mes = new byte[a]; - a += 5; - } - - if (count >= 5) - { - mes[count - 5] = temp[count]; - } - - count++; - } - - //Console.WriteLine("read ck"); - try - { - temp[count] = (byte)this.ReadByte(); - } - catch { } - - count++; - - Array.Resize<byte>(ref temp, count); - - //Console.WriteLine(this.BytesToRead); - - return mes; - } - - - /// <summary> - /// Used to start initial connecting after serialport.open - /// </summary> - /// <returns>true = passed, false = failed</returns> - public bool connectAP() - { - if (!this.IsOpen) - { - return false; - } - - Thread.Sleep(100); - - int a = 0; - while (a < 5) - { - byte[] temp = new byte[] { 0x6, 0,0,0,0}; - temp = this.genstkv2packet(temp); - a++; - Thread.Sleep(50); - - try - { - if (temp[0] == 6 && temp[1] == 0 && temp.Length == 2) - { - return true; - } - } - catch { } - } - return false; - } - - /// <summary> - /// Used to keep alive the connection - /// </summary> - /// <returns>true = passed, false = lost connection</returns> - public bool keepalive() - { - return connectAP(); - } - /// <summary> - /// Syncs after a private command has been sent - /// </summary> - /// <returns>true = passed, false = failed</returns> - public bool sync() - { - if (!this.IsOpen) - { - return false; - } - return true; - } - /// <summary> - /// Downloads the eeprom with the given length - set Address first - /// </summary> - /// <param name="length">eeprom length</param> - /// <returns>downloaded data</returns> - public byte[] download(short length) - { - if (!this.IsOpen) - { - throw new Exception(); - } - byte[] data = new byte[length]; - - byte[] temp = new byte[] { 0x16, (byte)((length >> 8) & 0xff), (byte)((length >> 0) & 0xff) }; - temp = this.genstkv2packet(temp); - - Array.Copy(temp, 2, data, 0, length); - - return data; - } - - public byte[] downloadflash(short length) - { - if (!this.IsOpen) - { - throw new Exception("Port Closed"); - } - byte[] data = new byte[length]; - - byte[] temp = new byte[] { 0x14, (byte)((length >> 8) & 0xff), (byte)((length >> 0) & 0xff) }; - temp = this.genstkv2packet(temp); - - Array.Copy(temp, 2, data, 0, length); - - return data; - } - - public bool uploadflash(byte[] data, int startfrom, int length, int startaddress) - { - if (!this.IsOpen) - { - return false; - } - int loops = (length / 0x100); - int totalleft = length; - int sending = 0; - - for (int a = 0; a <= loops; a++) - { - if (totalleft > 0x100) - { - sending = 0x100; - } - else - { - sending = totalleft; - } - - //startaddress = 256; - if (sending == 0) - return true; - - setaddress(startaddress); - startaddress += sending; - - // 0x13 - - byte[] command = new byte[] { (byte)0x13, (byte)(sending >> 8), (byte)(sending & 0xff) }; - - log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending); - - Array.Resize<byte>(ref command, sending + 10); // sending + head - - Array.Copy(data, startfrom + (length - totalleft), command, 10, sending); - - command = this.genstkv2packet(command); - - totalleft -= sending; - - - if (Progress != null) - Progress((int)(((float)startaddress / (float)length) * 100),""); - - if (command[1] != 0) - { - log.InfoFormat("No Sync"); - return false; - } - } - return true; - } - - /// <summary> - /// Sets the eeprom start read or write address - /// </summary> - /// <param name="address">address, must be eaven number</param> - /// <returns>true = passed, false = failed</returns> - public bool setaddress(int address) - { - if (!this.IsOpen) - { - return false; - } - - if (address % 2 == 1) - { - throw new Exception("Address must be an even number"); - } - - log.InfoFormat("Sending address " + ((address / 2))); - - int tempstart = address / 2; // words - byte[] temp = new byte[] { 0x6, (byte)((tempstart >> 24) & 0xff), (byte)((tempstart >> 16) & 0xff), (byte)((tempstart >> 8) & 0xff), (byte)((tempstart >> 0) & 0xff) }; - temp = this.genstkv2packet(temp); - - if (temp[1] == 0) - { - return true; - } - return false; - } - /// <summary> - /// Upload data at preset address - /// </summary> - /// <param name="data">array to read from</param> - /// <param name="startfrom">start array index</param> - /// <param name="length">length to send</param> - /// <param name="startaddress">sets eeprom start programing address</param> - /// <returns>true = passed, false = failed</returns> - public bool upload(byte[] data,short startfrom,short length, short startaddress) - { - if (!this.IsOpen) - { - return false; - } - int loops = (length / 0x100); - int totalleft = length; - int sending = 0; - - for (int a = 0; a <= loops; a++) - { - if (totalleft > 0x100) - { - sending = 0x100; - } - else - { - sending = totalleft; - } - - //startaddress = 256; - if (sending == 0) - return true; - - setaddress(startaddress); - startaddress += (short)sending; - - // 0x13 - - byte[] command = new byte[] { (byte)0x15, (byte)(sending >> 8), (byte)(sending & 0xff) }; - - log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending); - - Array.Resize<byte>(ref command, sending + 10); // sending + head - - Array.Copy(data, startfrom + (length - totalleft), command, 10, sending); - - command = this.genstkv2packet(command); - - totalleft -= sending; - - - if (Progress != null) - Progress((int)(((float)startaddress / (float)length) * 100),""); - - if (command[1] != 0) - { - log.InfoFormat("No Sync"); - return false; - } - } - return true; - } - - public new bool Close() { - - try - { - byte[] command = new byte[] { (byte)0x11 }; - genstkv2packet(command); - } - catch { } - - if (base.IsOpen) - base.Close(); - - base.DtrEnable = false; - base.RtsEnable = false; - return true; - } - } -} +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.IO.Ports; +using System.Threading; +using log4net; + +// Written by Michael Oborne + +namespace ArdupilotMega.Arduino +{ + class ArduinoSTKv2 : SerialPort,ArduinoComms + { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public event ProgressEventHandler Progress; + + public new void Open() + { + // default dtr status is false + + //from http://svn.savannah.nongnu.org/viewvc/RELEASE_5_11_0/arduino.c?root=avrdude&view=markup + base.Open(); + + base.DtrEnable = false; + base.RtsEnable = false; + + System.Threading.Thread.Sleep(50); + + base.DtrEnable = true; + base.RtsEnable = true; + + System.Threading.Thread.Sleep(50); + } + + public byte[] genstkv2packet(byte[] message) + { + byte[] data = new byte[300]; + byte ck = 0; + + data[0] = 0x1b; + ck ^= data[0]; + data[1] = 0x1; + ck ^= data[1]; + data[2] = (byte)((message.Length >> 8) & 0xff); + ck ^= data[2]; + data[3] = (byte)(message.Length & 0xff); + ck ^= data[3]; + data[4] = 0xe; + ck ^= data[4]; + + int a = 5; + foreach (byte let in message) + { + data[a] = let; + ck ^= let; + a++; + } + data[a] = ck; + a++; + + this.Write(data,0,a); + //Console.WriteLine("about to read packet"); + + byte[] ret = readpacket(); + + //if (ret[1] == 0x0) + { + //Console.WriteLine("received OK"); + } + + return ret; + } + + byte[] readpacket() + { + byte[] temp = new byte[4000]; + byte[] mes = new byte[2] { 0x0, 0xC0 }; // fail + int a = 7; + int count = 0; + + this.ReadTimeout = 1000; + + while (count < a) + { + //Console.WriteLine("count {0} a {1} mes leng {2}",count,a,mes.Length); + try + { + temp[count] = (byte)this.ReadByte(); + } + catch { break; } + + + //Console.Write("{1}", temp[0], (char)temp[0]); + + if (temp[0] != 0x1b) + { + count = 0; + continue; + } + + if (count == 3) + { + a = (temp[2] << 8) + temp[3]; + mes = new byte[a]; + a += 5; + } + + if (count >= 5) + { + mes[count - 5] = temp[count]; + } + + count++; + } + + //Console.WriteLine("read ck"); + try + { + temp[count] = (byte)this.ReadByte(); + } + catch { } + + count++; + + Array.Resize<byte>(ref temp, count); + + //Console.WriteLine(this.BytesToRead); + + return mes; + } + + + /// <summary> + /// Used to start initial connecting after serialport.open + /// </summary> + /// <returns>true = passed, false = failed</returns> + public bool connectAP() + { + if (!this.IsOpen) + { + return false; + } + + Thread.Sleep(100); + + int a = 0; + while (a < 5) + { + byte[] temp = new byte[] { 0x6, 0,0,0,0}; + temp = this.genstkv2packet(temp); + a++; + Thread.Sleep(50); + + try + { + if (temp[0] == 6 && temp[1] == 0 && temp.Length == 2) + { + return true; + } + } + catch { } + } + return false; + } + + /// <summary> + /// Used to keep alive the connection + /// </summary> + /// <returns>true = passed, false = lost connection</returns> + public bool keepalive() + { + return connectAP(); + } + /// <summary> + /// Syncs after a private command has been sent + /// </summary> + /// <returns>true = passed, false = failed</returns> + public bool sync() + { + if (!this.IsOpen) + { + return false; + } + return true; + } + /// <summary> + /// Downloads the eeprom with the given length - set Address first + /// </summary> + /// <param name="length">eeprom length</param> + /// <returns>downloaded data</returns> + public byte[] download(short length) + { + if (!this.IsOpen) + { + throw new Exception(); + } + byte[] data = new byte[length]; + + byte[] temp = new byte[] { 0x16, (byte)((length >> 8) & 0xff), (byte)((length >> 0) & 0xff) }; + temp = this.genstkv2packet(temp); + + Array.Copy(temp, 2, data, 0, length); + + return data; + } + + public byte[] downloadflash(short length) + { + if (!this.IsOpen) + { + throw new Exception("Port Closed"); + } + byte[] data = new byte[length]; + + byte[] temp = new byte[] { 0x14, (byte)((length >> 8) & 0xff), (byte)((length >> 0) & 0xff) }; + temp = this.genstkv2packet(temp); + + Array.Copy(temp, 2, data, 0, length); + + return data; + } + + public bool uploadflash(byte[] data, int startfrom, int length, int startaddress) + { + if (!this.IsOpen) + { + return false; + } + int loops = (length / 0x100); + int totalleft = length; + int sending = 0; + + for (int a = 0; a <= loops; a++) + { + if (totalleft > 0x100) + { + sending = 0x100; + } + else + { + sending = totalleft; + } + + //startaddress = 256; + if (sending == 0) + return true; + + setaddress(startaddress); + startaddress += sending; + + // 0x13 + + byte[] command = new byte[] { (byte)0x13, (byte)(sending >> 8), (byte)(sending & 0xff) }; + + log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending); + + Array.Resize<byte>(ref command, sending + 10); // sending + head + + Array.Copy(data, startfrom + (length - totalleft), command, 10, sending); + + command = this.genstkv2packet(command); + + totalleft -= sending; + + + if (Progress != null) + Progress((int)(((float)startaddress / (float)length) * 100),""); + + if (command[1] != 0) + { + log.InfoFormat("No Sync"); + return false; + } + } + return true; + } + + /// <summary> + /// Sets the eeprom start read or write address + /// </summary> + /// <param name="address">address, must be eaven number</param> + /// <returns>true = passed, false = failed</returns> + public bool setaddress(int address) + { + if (!this.IsOpen) + { + return false; + } + + if (address % 2 == 1) + { + throw new Exception("Address must be an even number"); + } + + log.InfoFormat("Sending address " + ((address / 2))); + + int tempstart = address / 2; // words + byte[] temp = new byte[] { 0x6, (byte)((tempstart >> 24) & 0xff), (byte)((tempstart >> 16) & 0xff), (byte)((tempstart >> 8) & 0xff), (byte)((tempstart >> 0) & 0xff) }; + temp = this.genstkv2packet(temp); + + if (temp[1] == 0) + { + return true; + } + return false; + } + /// <summary> + /// Upload data at preset address + /// </summary> + /// <param name="data">array to read from</param> + /// <param name="startfrom">start array index</param> + /// <param name="length">length to send</param> + /// <param name="startaddress">sets eeprom start programing address</param> + /// <returns>true = passed, false = failed</returns> + public bool upload(byte[] data,short startfrom,short length, short startaddress) + { + if (!this.IsOpen) + { + return false; + } + int loops = (length / 0x100); + int totalleft = length; + int sending = 0; + + for (int a = 0; a <= loops; a++) + { + if (totalleft > 0x100) + { + sending = 0x100; + } + else + { + sending = totalleft; + } + + //startaddress = 256; + if (sending == 0) + return true; + + setaddress(startaddress); + startaddress += (short)sending; + + // 0x13 + + byte[] command = new byte[] { (byte)0x15, (byte)(sending >> 8), (byte)(sending & 0xff) }; + + log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending); + + Array.Resize<byte>(ref command, sending + 10); // sending + head + + Array.Copy(data, startfrom + (length - totalleft), command, 10, sending); + + command = this.genstkv2packet(command); + + totalleft -= sending; + + + if (Progress != null) + Progress((int)(((float)startaddress / (float)length) * 100),""); + + if (command[1] != 0) + { + log.InfoFormat("No Sync"); + return false; + } + } + return true; + } + + public new bool Close() { + + try + { + byte[] command = new byte[] { (byte)0x11 }; + genstkv2packet(command); + } + catch { } + + if (base.IsOpen) + base.Close(); + + base.DtrEnable = false; + base.RtsEnable = false; + return true; + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index 7a63c6dae00b95ecc4ba8449228b2a554c66a367..32227d2fb8beb95dfb3d1c791879dce2685dbda6 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -355,7 +355,7 @@ <Compile Include="Controls\AGauge.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Include="ArduinoDetect.cs" /> + <Compile Include="Arduino\ArduinoDetect.cs" /> <Compile Include="AviWriter.cs" /> <Compile Include="Camera.cs"> <SubType>Form</SubType> @@ -364,12 +364,12 @@ <DependentUpon>Camera.cs</DependentUpon> </Compile> <Compile Include="Capture.cs" /> - <Compile Include="CommsSerialInterface.cs" /> - <Compile Include="CommsSerialPort.cs"> + <Compile Include="Comms\CommsSerialInterface.cs" /> + <Compile Include="Comms\CommsSerialPort.cs"> <SubType>Component</SubType> </Compile> - <Compile Include="CommsTCPSerial.cs" /> - <Compile Include="CommsUdpSerial.cs" /> + <Compile Include="Comms\CommsTCPSerial.cs" /> + <Compile Include="Comms\CommsUdpSerial.cs" /> <Compile Include="Controls\ImageLabel.cs"> <SubType>UserControl</SubType> </Compile> @@ -379,12 +379,6 @@ <Compile Include="Controls\myGMAP.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Include="Controls\XorPlus.cs"> - <SubType>Form</SubType> - </Compile> - <Compile Include="Controls\XorPlus.Designer.cs"> - <DependentUpon>XorPlus.cs</DependentUpon> - </Compile> <Compile Include="Radio\IHex.cs" /> <Compile Include="Mavlink\MavlinkCRC.cs" /> <Compile Include="Mavlink\MavlinkUtil.cs" /> @@ -439,14 +433,14 @@ <Compile Include="Common.cs"> <SubType>Component</SubType> </Compile> - <Compile Include="ArduinoComms.cs" /> + <Compile Include="Arduino\ArduinoComms.cs" /> <Compile Include="Controls\MyLabel.cs"> <SubType>Component</SubType> </Compile> <Compile Include="Controls\MyUserControl.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Include="ArduinoSTKv2.cs"> + <Compile Include="Arduino\ArduinoSTKv2.cs"> <SubType>Component</SubType> </Compile> <Compile Include="paramcompare.cs"> @@ -473,7 +467,7 @@ <Compile Include="GCSViews\Terminal.Designer.cs"> <DependentUpon>Terminal.cs</DependentUpon> </Compile> - <Compile Include="HUD.cs"> + <Compile Include="Controls\HUD.cs"> <SubType>UserControl</SubType> </Compile> <Compile Include="MainV2.cs"> @@ -515,7 +509,7 @@ <DependentUpon>ElevationProfile.cs</DependentUpon> </Compile> <Compile Include="MAVLink.cs" /> - <Compile Include="ArduinoSTK.cs"> + <Compile Include="Arduino\ArduinoSTK.cs"> <SubType>Component</SubType> </Compile> <Compile Include="Log.cs"> @@ -757,9 +751,6 @@ <EmbeddedResource Include="Controls\ImageLabel.resx"> <DependentUpon>ImageLabel.cs</DependentUpon> </EmbeddedResource> - <EmbeddedResource Include="Controls\XorPlus.resx"> - <DependentUpon>XorPlus.cs</DependentUpon> - </EmbeddedResource> <EmbeddedResource Include="GCSViews\Configuration.es-ES.resx"> <DependentUpon>Configuration.cs</DependentUpon> </EmbeddedResource> @@ -1021,6 +1012,7 @@ </EmbeddedResource> <EmbeddedResource Include="GCSViews\Simulation.resx"> <DependentUpon>Simulation.cs</DependentUpon> + <SubType>Designer</SubType> </EmbeddedResource> <EmbeddedResource Include="GCSViews\Simulation.zh-Hans.resx"> <DependentUpon>Simulation.cs</DependentUpon> @@ -1096,10 +1088,6 @@ <None Include="m3u\networklink.kml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> - <None Include="MAC\Info.plist" /> - <None Include="MAC\run.sh" /> - <None Include="Msi\installer.bat" /> - <None Include="Msi\installer.wxs" /> <None Include="mykey.snk" /> <None Include="Properties\app.manifest" /> <None Include="Properties\DataSources\CurrentState.datasource" /> diff --git a/Tools/ArdupilotMegaPlanner/Camera.Designer.cs b/Tools/ArdupilotMegaPlanner/Camera.Designer.cs index a748b9749f0a47668426c308d2ff8bc4ca9ce8b5..b2ff93843e487e2472c14ac30a22819454ff1427 100644 --- a/Tools/ArdupilotMegaPlanner/Camera.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Camera.Designer.cs @@ -61,7 +61,7 @@ this.TXT_distacflphotos = new System.Windows.Forms.TextBox(); this.TXT_distflphotos = new System.Windows.Forms.TextBox(); this.CMB_camera = new System.Windows.Forms.ComboBox(); - this.BUT_save = new ArdupilotMega.MyButton(); + this.BUT_save = new ArdupilotMega.Controls.MyButton(); ((System.ComponentModel.ISupportInitialize)(this.num_agl)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.num_focallength)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.num_overlap)).BeginInit(); @@ -379,6 +379,6 @@ private System.Windows.Forms.TextBox TXT_distacflphotos; private System.Windows.Forms.TextBox TXT_distflphotos; private System.Windows.Forms.ComboBox CMB_camera; - private MyButton BUT_save; + private ArdupilotMega.Controls.MyButton BUT_save; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Camera.resx b/Tools/ArdupilotMegaPlanner/Camera.resx index b5668d74bf212dd5c022072a99da02d83e7d2979..8e934149dfa7ff79517b06522558d77b2a2364ff 100644 --- a/Tools/ArdupilotMegaPlanner/Camera.resx +++ b/Tools/ArdupilotMegaPlanner/Camera.resx @@ -915,7 +915,7 @@ <value>BUT_save</value> </data> <data name=">>BUT_save.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_save.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/Common.cs b/Tools/ArdupilotMegaPlanner/Common.cs index c6453757d3a135e72063e82231276f97aaee14e0..30b539568839bc621d7edd7e255ef64635fa3c3b 100644 --- a/Tools/ArdupilotMegaPlanner/Common.cs +++ b/Tools/ArdupilotMegaPlanner/Common.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.ComponentModel; using System.Data; using System.Drawing; @@ -23,6 +24,7 @@ using log4net; using ZedGraph; // Graphs using ArdupilotMega; using System.Reflection; +using ArdupilotMega.Utilities; using System.IO; @@ -710,6 +712,22 @@ namespace ArdupilotMega return null; } + public static List<KeyValuePair<int,string>> getModesList() + { + if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) + { + var flightModes = EnumTranslator.Translate<apmmodes>(); + return flightModes.ToList(); + } + else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) + { + var flightModes = EnumTranslator.Translate<ac2modes>(); + return flightModes.ToList(); + } + + return null; + } + public static Form LoadingBox(string title, string promptText) { Form form = new Form(); @@ -746,7 +764,7 @@ namespace ArdupilotMega Form form = new Form(); System.Windows.Forms.Label label = new System.Windows.Forms.Label(); CheckBox chk = new CheckBox(); - MyButton buttonOk = new MyButton(); + ArdupilotMega.Controls.MyButton buttonOk = new ArdupilotMega.Controls.MyButton(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainV2)); form.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -806,8 +824,8 @@ namespace ArdupilotMega Form form = new Form(); System.Windows.Forms.Label label = new System.Windows.Forms.Label(); TextBox textBox = new TextBox(); - MyButton buttonOk = new MyButton(); - MyButton buttonCancel = new MyButton(); + ArdupilotMega.Controls.MyButton buttonOk = new ArdupilotMega.Controls.MyButton(); + ArdupilotMega.Controls.MyButton buttonCancel = new ArdupilotMega.Controls.MyButton(); form.TopMost = true; diff --git a/Tools/ArdupilotMegaPlanner/CommsSerialInterface.cs b/Tools/ArdupilotMegaPlanner/Comms/CommsSerialInterface.cs similarity index 95% rename from Tools/ArdupilotMegaPlanner/CommsSerialInterface.cs rename to Tools/ArdupilotMegaPlanner/Comms/CommsSerialInterface.cs index cd85b924457228867f92a3f90fa697d83d9384cf..aee48f0402821aa301496975c617f6299b85c5b2 100644 --- a/Tools/ArdupilotMegaPlanner/CommsSerialInterface.cs +++ b/Tools/ArdupilotMegaPlanner/Comms/CommsSerialInterface.cs @@ -1,59 +1,59 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO.Ports; -using System.IO; -using System.Reflection; - -namespace ArdupilotMega -{ - public interface ICommsSerial - { - // from serialport class - // Methods - void Close(); - void DiscardInBuffer(); - //void DiscardOutBuffer(); - void Open(); - int Read(byte[] buffer, int offset, int count); - //int Read(char[] buffer, int offset, int count); - int ReadByte(); - int ReadChar(); - string ReadExisting(); - string ReadLine(); - //string ReadTo(string value); - void Write(string text); - void Write(byte[] buffer, int offset, int count); - //void Write(char[] buffer, int offset, int count); - void WriteLine(string text); - - void toggleDTR(); - - // Properties - //Stream BaseStream { get; } - int BaudRate { get; set; } - //bool BreakState { get; set; } - int BytesToRead { get; } - int BytesToWrite { get; } - //bool CDHolding { get; } - //bool CtsHolding { get; } - int DataBits { get; set; } - //bool DiscardNull { get; set; } - //bool DsrHolding { get; } - bool DtrEnable { get; set; } - //Encoding Encoding { get; set; } - //Handshake Handshake { get; set; } - bool IsOpen { get; } - //string NewLine { get; set; } - Parity Parity { get; set; } - //byte ParityReplace { get; set; } - string PortName { get; set; } - int ReadBufferSize { get; set; } - int ReadTimeout { get; set; } - int ReceivedBytesThreshold { get; set; } - bool RtsEnable { get; set; } - StopBits StopBits { get; set; } - int WriteBufferSize { get; set; } - int WriteTimeout { get; set; } - } -} +using System; +using System.Collections.Generic; +using System.Text; +using System.IO.Ports; +using System.IO; +using System.Reflection; + +namespace ArdupilotMega.Comms +{ + public interface ICommsSerial + { + // from serialport class + // Methods + void Close(); + void DiscardInBuffer(); + //void DiscardOutBuffer(); + void Open(); + int Read(byte[] buffer, int offset, int count); + //int Read(char[] buffer, int offset, int count); + int ReadByte(); + int ReadChar(); + string ReadExisting(); + string ReadLine(); + //string ReadTo(string value); + void Write(string text); + void Write(byte[] buffer, int offset, int count); + //void Write(char[] buffer, int offset, int count); + void WriteLine(string text); + + void toggleDTR(); + + // Properties + //Stream BaseStream { get; } + int BaudRate { get; set; } + //bool BreakState { get; set; } + int BytesToRead { get; } + int BytesToWrite { get; } + //bool CDHolding { get; } + //bool CtsHolding { get; } + int DataBits { get; set; } + //bool DiscardNull { get; set; } + //bool DsrHolding { get; } + bool DtrEnable { get; set; } + //Encoding Encoding { get; set; } + //Handshake Handshake { get; set; } + bool IsOpen { get; } + //string NewLine { get; set; } + Parity Parity { get; set; } + //byte ParityReplace { get; set; } + string PortName { get; set; } + int ReadBufferSize { get; set; } + int ReadTimeout { get; set; } + int ReceivedBytesThreshold { get; set; } + bool RtsEnable { get; set; } + StopBits StopBits { get; set; } + int WriteBufferSize { get; set; } + int WriteTimeout { get; set; } + } +} diff --git a/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs b/Tools/ArdupilotMegaPlanner/Comms/CommsSerialPort.cs similarity index 96% rename from Tools/ArdupilotMegaPlanner/CommsSerialPort.cs rename to Tools/ArdupilotMegaPlanner/Comms/CommsSerialPort.cs index 2fe153f2898fefaed848b2008eaa3035423c6c6a..ac07fc4a328dcd9b973198c61fbd526a312531fe 100644 --- a/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs +++ b/Tools/ArdupilotMegaPlanner/Comms/CommsSerialPort.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO.Ports; -using System.IO; -using System.Linq; - -namespace ArdupilotMega -{ - class SerialPort : System.IO.Ports.SerialPort,ICommsSerial - { - public new void Open() - { - if (base.IsOpen) - return; - - base.Open(); - } - - public void toggleDTR() - { - bool open = this.IsOpen; - - if (!open) - this.Open(); - - base.DtrEnable = false; - base.RtsEnable = false; - - System.Threading.Thread.Sleep(50); - - base.DtrEnable = true; - base.RtsEnable = true; - - System.Threading.Thread.Sleep(50); - - if (!open) - this.Close(); - } - - public new static string[] GetPortNames() - { - List<string> allPorts = new List<string>(); - - if (Directory.Exists("/dev/")) - { - if (Directory.Exists("/dev/serial/by-id/")) - allPorts.AddRange(Directory.GetFiles("/dev/serial/by-id/", "*")); - allPorts.AddRange(Directory.GetFiles("/dev/", "ttyACM*")); - allPorts.AddRange(Directory.GetFiles("/dev/", "ttyUSB*")); - } - - string[] ports = System.IO.Ports.SerialPort.GetPortNames() - .Select(p => p.TrimEnd()) - .Select(FixBlueToothPortNameBug) - .ToArray(); - - allPorts.AddRange(ports); - - return allPorts.ToArray(); - } - - - // .NET bug: sometimes bluetooth ports are enumerated with bogus characters - // eg 'COM10' becomes 'COM10c' - one workaround is to remove the non numeric - // char. Annoyingly, sometimes a numeric char is added, which means this - // does not work in all cases. - // See http://connect.microsoft.com/VisualStudio/feedback/details/236183/system-io-ports-serialport-getportnames-error-with-bluetooth - private static string FixBlueToothPortNameBug(string portName) - { - if (!portName.StartsWith("COM")) - return portName; - var newPortName = "COM"; // Start over with "COM" - foreach (var portChar in portName.Substring(3).ToCharArray()) // Remove "COM", put the rest in a character array - { - if (char.IsDigit(portChar)) - newPortName += portChar.ToString(); // Good character, append to portName - // else - //log.WarnFormat("Bad (Non Numeric) character in port name '{0}' - removing", portName); - } - - return newPortName; - } - } -} +using System; +using System.Collections.Generic; +using System.Text; +using System.IO.Ports; +using System.IO; +using System.Linq; + +namespace ArdupilotMega.Comms +{ + class SerialPort : System.IO.Ports.SerialPort,ICommsSerial + { + public new void Open() + { + if (base.IsOpen) + return; + + base.Open(); + } + + public void toggleDTR() + { + bool open = this.IsOpen; + + if (!open) + this.Open(); + + base.DtrEnable = false; + base.RtsEnable = false; + + System.Threading.Thread.Sleep(50); + + base.DtrEnable = true; + base.RtsEnable = true; + + System.Threading.Thread.Sleep(50); + + if (!open) + this.Close(); + } + + public new static string[] GetPortNames() + { + List<string> allPorts = new List<string>(); + + if (Directory.Exists("/dev/")) + { + if (Directory.Exists("/dev/serial/by-id/")) + allPorts.AddRange(Directory.GetFiles("/dev/serial/by-id/", "*")); + allPorts.AddRange(Directory.GetFiles("/dev/", "ttyACM*")); + allPorts.AddRange(Directory.GetFiles("/dev/", "ttyUSB*")); + } + + string[] ports = System.IO.Ports.SerialPort.GetPortNames() + .Select(p => p.TrimEnd()) + .Select(FixBlueToothPortNameBug) + .ToArray(); + + allPorts.AddRange(ports); + + return allPorts.ToArray(); + } + + + // .NET bug: sometimes bluetooth ports are enumerated with bogus characters + // eg 'COM10' becomes 'COM10c' - one workaround is to remove the non numeric + // char. Annoyingly, sometimes a numeric char is added, which means this + // does not work in all cases. + // See http://connect.microsoft.com/VisualStudio/feedback/details/236183/system-io-ports-serialport-getportnames-error-with-bluetooth + private static string FixBlueToothPortNameBug(string portName) + { + if (!portName.StartsWith("COM")) + return portName; + var newPortName = "COM"; // Start over with "COM" + foreach (var portChar in portName.Substring(3).ToCharArray()) // Remove "COM", put the rest in a character array + { + if (char.IsDigit(portChar)) + newPortName += portChar.ToString(); // Good character, append to portName + // else + //log.WarnFormat("Bad (Non Numeric) character in port name '{0}' - removing", portName); + } + + return newPortName; + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/CommsTCPSerial.cs b/Tools/ArdupilotMegaPlanner/Comms/CommsTCPSerial.cs similarity index 94% rename from Tools/ArdupilotMegaPlanner/CommsTCPSerial.cs rename to Tools/ArdupilotMegaPlanner/Comms/CommsTCPSerial.cs index 76492e1e8b151af77132bc48d8bc97792f58b9f7..435e3f46ed36f97ebee3eaf26ff104b861a6463e 100644 --- a/Tools/ArdupilotMegaPlanner/CommsTCPSerial.cs +++ b/Tools/ArdupilotMegaPlanner/Comms/CommsTCPSerial.cs @@ -9,9 +9,9 @@ using System.Net; // dns, ip address using System.Net.Sockets; // tcplistner using log4net; -namespace System.IO.Ports +namespace ArdupilotMega.Comms { - public class TcpSerial : ArdupilotMega.ICommsSerial + public class TcpSerial : ArdupilotMega.Comms.ICommsSerial { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); TcpClient client = new TcpClient(); @@ -93,11 +93,11 @@ namespace System.IO.Ports if (ArdupilotMega.MainV2.config["TCP_host"] != null) host = ArdupilotMega.MainV2.config["TCP_host"].ToString(); - if (Windows.Forms.DialogResult.Cancel == ArdupilotMega.Common.InputBox("remote host", "Enter host name/ip (ensure remote end is already started)", ref host)) + if (System.Windows.Forms.DialogResult.Cancel == ArdupilotMega.Common.InputBox("remote host", "Enter host name/ip (ensure remote end is already started)", ref host)) { throw new Exception("Canceled by request"); } - if (Windows.Forms.DialogResult.Cancel == ArdupilotMega.Common.InputBox("remote Port", "Enter remote port", ref dest)) + if (System.Windows.Forms.DialogResult.Cancel == ArdupilotMega.Common.InputBox("remote Port", "Enter remote port", ref dest)) { throw new Exception("Canceled by request"); } diff --git a/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs b/Tools/ArdupilotMegaPlanner/Comms/CommsUdpSerial.cs similarity index 95% rename from Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs rename to Tools/ArdupilotMegaPlanner/Comms/CommsUdpSerial.cs index f5b5feb3e2b5392d2959aa6e47b497e1ab62e805..d569cad89fec10eab94f11b41ac08b64f754188b 100644 --- a/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs +++ b/Tools/ArdupilotMegaPlanner/Comms/CommsUdpSerial.cs @@ -1,301 +1,304 @@ -using System.Reflection; -using System.Text; -using System.Net; // dns, ip address -using System.Net.Sockets; // tcplistner -using log4net; -using ArdupilotMega.Controls; - -namespace System.IO.Ports -{ - public class UdpSerial : ArdupilotMega.ICommsSerial - { - private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - UdpClient client = new UdpClient(); - IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); - byte[] rbuffer = new byte[0]; - int rbufferread = 0; - - public int WriteBufferSize { get; set; } - public int WriteTimeout { get; set; } - public int ReceivedBytesThreshold { get; set; } - public bool RtsEnable { get; set; } - - ~UdpSerial() - { - this.Close(); - client = null; - } - - public UdpSerial() - { - //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); - //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); - - Port = "14550"; - } - - public void toggleDTR() - { - } - - public string Port { get; set; } - - public int ReadTimeout - { - get;// { return client.ReceiveTimeout; } - set;// { client.ReceiveTimeout = value; } - } - - public int ReadBufferSize {get;set;} - - public int BaudRate { get; set; } - public StopBits StopBits { get; set; } - public Parity Parity { get; set; } - public int DataBits { get; set; } - - public string PortName { get; set; } - - public int BytesToRead - { - get { return client.Available + rbuffer.Length - rbufferread; } - } - - public int BytesToWrite { get {return 0;} } - - public bool IsOpen { get { if (client.Client == null) return false; return client.Client.Connected; } } - - public bool DtrEnable - { - get; - set; - } - - public void Open() - { - if (client.Client.Connected) - { - log.Info("udpserial socket already open"); - return; - } - - ProgressReporterDialogue frmProgressReporter = new ProgressReporterDialogue - { - StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen, - Text = "Connecting Mavlink UDP" - }; - - frmProgressReporter.DoWork += frmProgressReporter_DoWork; - - frmProgressReporter.UpdateProgressAndStatus(-1, "Connecting Mavlink UDP"); - - ArdupilotMega.ThemeManager.ApplyThemeTo(frmProgressReporter); - - frmProgressReporter.RunBackgroundOperationAsync(); - - - } - - void frmProgressReporter_DoWork(object sender, ArdupilotMega.Controls.ProgressWorkerEventArgs e) - { - string dest = Port; - - if (ArdupilotMega.MainV2.config["UDP_port"] != null) - dest = ArdupilotMega.MainV2.config["UDP_port"].ToString(); - - ArdupilotMega.Common.InputBox("Listern Port", "Enter Local port (ensure remote end is already sending)", ref dest); - Port = dest; - - ArdupilotMega.MainV2.config["UDP_port"] = Port; - - client = new UdpClient(int.Parse(Port)); - - while (true) - { - ((ProgressReporterDialogue)sender).UpdateProgressAndStatus(-1, "Waiting for UDP"); - System.Threading.Thread.Sleep(500); - - if (((ProgressReporterDialogue)sender).doWorkArgs.CancelRequested) - { - ((ProgressReporterDialogue)sender).doWorkArgs.CancelAcknowledged = true; - try - { - client.Close(); - } - catch { } - return; - } - - if (BytesToRead > 0) - break; - } - - if (BytesToRead == 0) - return; - - try - { - client.Receive(ref RemoteIpEndPoint); - log.InfoFormat("NetSerial connecting to {0} : {1}", RemoteIpEndPoint.Address, RemoteIpEndPoint.Port); - client.Connect(RemoteIpEndPoint); - } - catch (Exception ex) - { - if (client != null && client.Client.Connected) - { - client.Close(); - } - log.Info(ex.ToString()); - System.Windows.Forms.CustomMessageBox.Show("Please check your Firewall settings\nPlease try running this command\n1. Run the following command in an elevated command prompt to disable Windows Firewall temporarily:\n \nNetsh advfirewall set allprofiles state off\n \nNote: This is just for test; please turn it back on with the command 'Netsh advfirewall set allprofiles state on'.\n"); - throw new Exception("The socket/serialproxy is closed " + e); - } - } - - void VerifyConnected() - { - if (client == null || !IsOpen) - { - throw new Exception("The socket/serialproxy is closed"); - } - } - - public int Read(byte[] readto,int offset,int length) - { - VerifyConnected(); - try - { - if (length < 1) { return 0; } - - if (rbufferread == rbuffer.Length) - { - MemoryStream r = new MemoryStream(); - while (client.Available > 0) - { - Byte[] b = client.Receive(ref RemoteIpEndPoint); - r.Write(b, 0, b.Length); - } - rbuffer = r.ToArray(); - rbufferread = 0; - } - - Array.Copy(rbuffer, rbufferread, readto, offset, length); - - rbufferread += length; - - return length; - } - catch { throw new Exception("Socket Closed"); } - } - - public int ReadByte() - { - VerifyConnected(); - int count = 0; - while (this.BytesToRead == 0) - { - System.Threading.Thread.Sleep(1); - if (count > ReadTimeout) - throw new Exception("NetSerial Timeout on read"); - count++; - } - byte[] buffer = new byte[1]; - Read(buffer, 0, 1); - return buffer[0]; - } - - public int ReadChar() - { - return ReadByte(); - } - - public string ReadExisting() - { - VerifyConnected(); - byte[] data = new byte[client.Available]; - if (data.Length > 0) - Read(data, 0, data.Length); - - string line = Encoding.ASCII.GetString(data, 0, data.Length); - - return line; - } - - public void WriteLine(string line) - { - VerifyConnected(); - line = line + "\n"; - Write(line); - } - - public void Write(string line) - { - VerifyConnected(); - byte[] data = new System.Text.ASCIIEncoding().GetBytes(line); - Write(data, 0, data.Length); - } - - public void Write(byte[] write, int offset, int length) - { - VerifyConnected(); - try - { - client.Send(write, length); - } - catch { }//throw new Exception("Comport / Socket Closed"); } - } - - public void DiscardInBuffer() - { - VerifyConnected(); - int size = client.Available; - byte[] crap = new byte[size]; - log.InfoFormat("UdpSerial DiscardInBuffer {0}",size); - Read(crap, 0, size); - } - - public string ReadLine() { - byte[] temp = new byte[4000]; - int count = 0; - int timeout = 0; - - while (timeout <= 100) - { - if (!this.IsOpen) { break; } - if (this.BytesToRead > 0) - { - byte letter = (byte)this.ReadByte(); - - temp[count] = letter; - - if (letter == '\n') // normal line - { - break; - } - - - count++; - if (count == temp.Length) - break; - timeout = 0; - } else { - timeout++; - System.Threading.Thread.Sleep(5); - } - } - - Array.Resize<byte>(ref temp, count + 1); - - return Encoding.ASCII.GetString(temp, 0, temp.Length); - } - - public void Close() - { - if (client.Client != null && client.Client.Connected) - { - client.Client.Close(); - client.Close(); - } - - client = new UdpClient(); - } - } -} +using System.Reflection; +using System.Text; +using System.Net; // dns, ip address +using System.Net.Sockets; // tcplistner +using log4net; +using ArdupilotMega.Controls; +using System.IO.Ports; +using System.IO; +using System; + +namespace ArdupilotMega.Comms +{ + public class UdpSerial : ArdupilotMega.Comms.ICommsSerial + { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + UdpClient client = new UdpClient(); + IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); + byte[] rbuffer = new byte[0]; + int rbufferread = 0; + + public int WriteBufferSize { get; set; } + public int WriteTimeout { get; set; } + public int ReceivedBytesThreshold { get; set; } + public bool RtsEnable { get; set; } + + ~UdpSerial() + { + this.Close(); + client = null; + } + + public UdpSerial() + { + //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); + //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); + + Port = "14550"; + } + + public void toggleDTR() + { + } + + public string Port { get; set; } + + public int ReadTimeout + { + get;// { return client.ReceiveTimeout; } + set;// { client.ReceiveTimeout = value; } + } + + public int ReadBufferSize {get;set;} + + public int BaudRate { get; set; } + public StopBits StopBits { get; set; } + public Parity Parity { get; set; } + public int DataBits { get; set; } + + public string PortName { get; set; } + + public int BytesToRead + { + get { return client.Available + rbuffer.Length - rbufferread; } + } + + public int BytesToWrite { get {return 0;} } + + public bool IsOpen { get { if (client.Client == null) return false; return client.Client.Connected; } } + + public bool DtrEnable + { + get; + set; + } + + public void Open() + { + if (client.Client.Connected) + { + log.Info("udpserial socket already open"); + return; + } + + ProgressReporterDialogue frmProgressReporter = new ProgressReporterDialogue + { + StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen, + Text = "Connecting Mavlink UDP" + }; + + frmProgressReporter.DoWork += frmProgressReporter_DoWork; + + frmProgressReporter.UpdateProgressAndStatus(-1, "Connecting Mavlink UDP"); + + ArdupilotMega.ThemeManager.ApplyThemeTo(frmProgressReporter); + + frmProgressReporter.RunBackgroundOperationAsync(); + + + } + + void frmProgressReporter_DoWork(object sender, ArdupilotMega.Controls.ProgressWorkerEventArgs e) + { + string dest = Port; + + if (ArdupilotMega.MainV2.config["UDP_port"] != null) + dest = ArdupilotMega.MainV2.config["UDP_port"].ToString(); + + ArdupilotMega.Common.InputBox("Listern Port", "Enter Local port (ensure remote end is already sending)", ref dest); + Port = dest; + + ArdupilotMega.MainV2.config["UDP_port"] = Port; + + client = new UdpClient(int.Parse(Port)); + + while (true) + { + ((ProgressReporterDialogue)sender).UpdateProgressAndStatus(-1, "Waiting for UDP"); + System.Threading.Thread.Sleep(500); + + if (((ProgressReporterDialogue)sender).doWorkArgs.CancelRequested) + { + ((ProgressReporterDialogue)sender).doWorkArgs.CancelAcknowledged = true; + try + { + client.Close(); + } + catch { } + return; + } + + if (BytesToRead > 0) + break; + } + + if (BytesToRead == 0) + return; + + try + { + client.Receive(ref RemoteIpEndPoint); + log.InfoFormat("NetSerial connecting to {0} : {1}", RemoteIpEndPoint.Address, RemoteIpEndPoint.Port); + client.Connect(RemoteIpEndPoint); + } + catch (Exception ex) + { + if (client != null && client.Client.Connected) + { + client.Close(); + } + log.Info(ex.ToString()); + System.Windows.Forms.CustomMessageBox.Show("Please check your Firewall settings\nPlease try running this command\n1. Run the following command in an elevated command prompt to disable Windows Firewall temporarily:\n \nNetsh advfirewall set allprofiles state off\n \nNote: This is just for test; please turn it back on with the command 'Netsh advfirewall set allprofiles state on'.\n"); + throw new Exception("The socket/serialproxy is closed " + e); + } + } + + void VerifyConnected() + { + if (client == null || !IsOpen) + { + throw new Exception("The socket/serialproxy is closed"); + } + } + + public int Read(byte[] readto,int offset,int length) + { + VerifyConnected(); + try + { + if (length < 1) { return 0; } + + if (rbufferread == rbuffer.Length) + { + MemoryStream r = new MemoryStream(); + while (client.Available > 0) + { + Byte[] b = client.Receive(ref RemoteIpEndPoint); + r.Write(b, 0, b.Length); + } + rbuffer = r.ToArray(); + rbufferread = 0; + } + + Array.Copy(rbuffer, rbufferread, readto, offset, length); + + rbufferread += length; + + return length; + } + catch { throw new Exception("Socket Closed"); } + } + + public int ReadByte() + { + VerifyConnected(); + int count = 0; + while (this.BytesToRead == 0) + { + System.Threading.Thread.Sleep(1); + if (count > ReadTimeout) + throw new Exception("NetSerial Timeout on read"); + count++; + } + byte[] buffer = new byte[1]; + Read(buffer, 0, 1); + return buffer[0]; + } + + public int ReadChar() + { + return ReadByte(); + } + + public string ReadExisting() + { + VerifyConnected(); + byte[] data = new byte[client.Available]; + if (data.Length > 0) + Read(data, 0, data.Length); + + string line = Encoding.ASCII.GetString(data, 0, data.Length); + + return line; + } + + public void WriteLine(string line) + { + VerifyConnected(); + line = line + "\n"; + Write(line); + } + + public void Write(string line) + { + VerifyConnected(); + byte[] data = new System.Text.ASCIIEncoding().GetBytes(line); + Write(data, 0, data.Length); + } + + public void Write(byte[] write, int offset, int length) + { + VerifyConnected(); + try + { + client.Send(write, length); + } + catch { }//throw new Exception("Comport / Socket Closed"); } + } + + public void DiscardInBuffer() + { + VerifyConnected(); + int size = client.Available; + byte[] crap = new byte[size]; + log.InfoFormat("UdpSerial DiscardInBuffer {0}",size); + Read(crap, 0, size); + } + + public string ReadLine() { + byte[] temp = new byte[4000]; + int count = 0; + int timeout = 0; + + while (timeout <= 100) + { + if (!this.IsOpen) { break; } + if (this.BytesToRead > 0) + { + byte letter = (byte)this.ReadByte(); + + temp[count] = letter; + + if (letter == '\n') // normal line + { + break; + } + + + count++; + if (count == temp.Length) + break; + timeout = 0; + } else { + timeout++; + System.Threading.Thread.Sleep(5); + } + } + + Array.Resize<byte>(ref temp, count + 1); + + return Encoding.ASCII.GetString(temp, 0, temp.Length); + } + + public void Close() + { + if (client.Client != null && client.Client.Connected) + { + client.Client.Close(); + client.Close(); + } + + client = new UdpClient(); + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs b/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs index 6e33d77c35c8ab15b3660b3c57785808e82f40ab..26ab3db6c24fa8f55341096fc205fa7354995b15 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/ConfigPanel.cs @@ -118,7 +118,7 @@ namespace ArdupilotMega.Controls this.Controls.Add(lbl); - MyButton but = new MyButton(); + ArdupilotMega.Controls.MyButton but = new ArdupilotMega.Controls.MyButton(); but.Text = "Save"; but.Location = new Point(optionx + 100, y); diff --git a/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs b/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs index e26038bdcf65b62420249dd25d5e4fbe8b545485..2326987b33ee649317a988714bcb527a2161a014 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs @@ -169,7 +169,7 @@ namespace System.Windows.Forms switch (buttons) { case MessageBoxButtons.OK: - var but = new MyButton + var but = new ArdupilotMega.Controls.MyButton { Size = new Size(75, 23), Text = "OK", @@ -187,7 +187,7 @@ namespace System.Windows.Forms if (msgBoxFrm.Width < (75 * 2 + FORM_X_MARGIN * 3)) msgBoxFrm.Width = (75 * 2 + FORM_X_MARGIN * 3); - var butyes = new MyButton + var butyes = new ArdupilotMega.Controls.MyButton { Size = new Size(75, 23), Text = "Yes", @@ -199,7 +199,7 @@ namespace System.Windows.Forms msgBoxFrm.Controls.Add(butyes); msgBoxFrm.AcceptButton = butyes; - var butno = new MyButton + var butno = new ArdupilotMega.Controls.MyButton { Size = new Size(75, 23), Text = "No", diff --git a/Tools/ArdupilotMegaPlanner/HUD.cs b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs similarity index 97% rename from Tools/ArdupilotMegaPlanner/HUD.cs rename to Tools/ArdupilotMegaPlanner/Controls/HUD.cs index e87062fb4657561d65fb584f4ea526a9090b1c72..1ca4337e68696e180d43a61bbee8e802bb463d69 100644 --- a/Tools/ArdupilotMegaPlanner/HUD.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs @@ -1,1606 +1,1606 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; -using System.IO; -using System.Drawing.Imaging; - -using System.Threading; - -using System.Drawing.Drawing2D; -using log4net; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using OpenTK.Graphics; - - -// Control written by Michael Oborne 2011 -// dual opengl and GDI+ - -namespace hud -{ - public class HUD : GLControl - { - private static readonly ILog log = LogManager.GetLogger( - System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - object paintlock = new object(); - object streamlock = new object(); - MemoryStream _streamjpg = new MemoryStream(); - [System.ComponentModel.Browsable(false)] - public MemoryStream streamjpg { get { lock (streamlock) { return _streamjpg; } } set { lock (streamlock) { _streamjpg = value; } } } - /// <summary> - /// this is to reduce cpu usage - /// </summary> - public bool streamjpgenable = false; - - Bitmap[] charbitmaps = new Bitmap[6000]; - int[] charbitmaptexid = new int[6000]; - int[] charwidth = new int[6000]; - - public int huddrawtime = 0; - - public bool opengl { get { return base.UseOpenGL; } set { base.UseOpenGL = value; } } - - bool started = false; - - public bool SixteenXNine = false; - - public HUD() - { - if (this.DesignMode) - { - opengl = false; - //return; - } - - //InitializeComponent(); - - graphicsObject = this; - graphicsObjectGDIP = Graphics.FromImage(objBitmap); - } - /* - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HUD)); - this.SuspendLayout(); - // - // HUD - // - this.BackColor = System.Drawing.Color.Black; - this.Name = "HUD"; - resources.ApplyResources(this, "$this"); - this.ResumeLayout(false); - - }*/ - - float _roll = 0; - float _navroll = 0; - float _pitch = 0; - float _navpitch = 0; - float _heading = 0; - float _targetheading = 0; - float _alt = 0; - float _targetalt = 0; - float _groundspeed = 0; - float _airspeed = 0; - float _targetspeed = 0; - float _batterylevel = 0; - float _batteryremaining = 0; - float _gpsfix = 0; - float _gpshdop = 0; - float _disttowp = 0; - float _groundcourse = 0; - float _xtrack_error = 0; - float _turnrate = 0; - float _verticalspeed = 0; - float _linkqualitygcs = 0; - DateTime _datetime; - string _mode = "Manual"; - int _wpno = 0; - - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float roll { get { return _roll; } set { if (_roll != value) { _roll = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float navroll { get { return _navroll; } set { if (_navroll != value) { _navroll = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float pitch { get { return _pitch; } set { if (_pitch != value) { _pitch = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float navpitch { get { return _navpitch; } set { if (_navpitch != value) { _navpitch = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float heading { get { return _heading; } set { if (_heading != value) { _heading = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float targetheading { get { return _targetheading; } set { if (_targetheading != value) { _targetheading = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float alt { get { return _alt; } set { if (_alt != value) { _alt = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float targetalt { get { return _targetalt; } set { if (_targetalt != value) { _targetalt = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float groundspeed { get { return _groundspeed; } set { if (_groundspeed != value) { _groundspeed = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float airspeed { get { return _airspeed; } set { if (_airspeed != value) { _airspeed = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float targetspeed { get { return _targetspeed; } set { if (_targetspeed != value) { _targetspeed = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float batterylevel { get { return _batterylevel; } set { if (_batterylevel != value) { _batterylevel = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float batteryremaining { get { return _batteryremaining; } set { if (_batteryremaining != value) { _batteryremaining = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float gpsfix { get { return _gpsfix; } set { if (_gpsfix != value) { _gpsfix = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float gpshdop { get { return _gpshdop; } set { if (_gpshdop != value) { _gpshdop = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float disttowp { get { return _disttowp; } set { if (_disttowp != value) { _disttowp = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public string mode { get { return _mode; } set { if (_mode != value) { _mode = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public int wpno { get { return _wpno; } set { if (_wpno != value) { _wpno = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float groundcourse { get { return _groundcourse; } set { if (_groundcourse != value) { _groundcourse = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float xtrack_error { get { return _xtrack_error; } set { if (_xtrack_error != value) { _xtrack_error = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float turnrate { get { return _turnrate; } set { if (_turnrate != value) { _turnrate = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float verticalspeed { get { return _verticalspeed; } set { if (_verticalspeed != value) { _verticalspeed = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public float linkqualitygcs { get { return _linkqualitygcs; } set { if (_linkqualitygcs != value) { _linkqualitygcs = value; this.Invalidate(); } } } - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public DateTime datetime { get { return _datetime; } set { if (_datetime != value) { _datetime = value; this.Invalidate(); } } } - - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public int status { get; set; } - - int statuslast = 0; - DateTime armedtimer = DateTime.MinValue; - - public bool bgon = true; - public bool hudon = true; - - [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] - public Color hudcolor { get { return whitePen.Color; } set { whitePen = new Pen(value, 2); } } - - Pen whitePen = new Pen(Color.White, 2); - - public Image bgimage { set { _bgimage = value; this.Invalidate(); } } - Image _bgimage; - - // move these global as they rarely change - reduce GC - Font font = new Font("Arial", 10); - Bitmap objBitmap = new Bitmap(1024, 1024); - int count = 0; - DateTime countdate = DateTime.Now; - HUD graphicsObject; - Graphics graphicsObjectGDIP; - - DateTime starttime = DateTime.MinValue; - - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HUD)); - - public override void Refresh() - { - //base.Refresh(); - OnPaint(new PaintEventArgs(this.CreateGraphics(),this.ClientRectangle)); - } - - protected override void OnLoad(EventArgs e) - { - if (opengl) - { - try - { - - GraphicsMode test = this.GraphicsMode; - log.Info(test.ToString()); - log.Info("Vendor: " + GL.GetString(StringName.Vendor)); - log.Info("Version: " + GL.GetString(StringName.Version)); - log.Info("Device: " + GL.GetString(StringName.Renderer)); - //Console.WriteLine("Extensions: " + GL.GetString(StringName.Extensions)); - - int[] viewPort = new int[4]; - - GL.GetInteger(GetPName.Viewport, viewPort); - - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - GL.Ortho(0, Width, Height, 0, -1, 1); - GL.MatrixMode(MatrixMode.Modelview); - GL.LoadIdentity(); - - GL.PushAttrib(AttribMask.DepthBufferBit); - GL.Disable(EnableCap.DepthTest); - //GL.Enable(EnableCap.Texture2D); - GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); - GL.Enable(EnableCap.Blend); - - } - catch (Exception ex) { log.Info("HUD opengl onload " + ex.ToString()); } - - try - { - GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); - - GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest); - GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Nicest); - GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); - - GL.Hint(HintTarget.TextureCompressionHint, HintMode.Nicest); - } - catch { } - - try - { - - GL.Enable(EnableCap.LineSmooth); - GL.Enable(EnableCap.PointSmooth); - GL.Enable(EnableCap.PolygonSmooth); - - } - catch { } - } - - started = true; - } - - bool inOnPaint = false; - string otherthread = ""; - - protected override void OnPaint(PaintEventArgs e) - { - //GL.Enable(EnableCap.AlphaTest) - - if (!started) - return; - - if (this.DesignMode) - { - e.Graphics.Clear(this.BackColor); - e.Graphics.Flush(); - } - - if ((DateTime.Now - starttime).TotalMilliseconds < 30 && (_bgimage == null)) - { - //Console.WriteLine("ms "+(DateTime.Now - starttime).TotalMilliseconds); - //e.Graphics.DrawImageUnscaled(objBitmap, 0, 0); - return; - } - - if (inOnPaint) - { - log.Info("Was in onpaint Hud th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread); - return; - } - - otherthread = System.Threading.Thread.CurrentThread.Name; - - inOnPaint = true; - - starttime = DateTime.Now; - - try - { - - if (opengl) - { - MakeCurrent(); - - GL.Clear(ClearBufferMask.ColorBufferBit); - - } - - doPaint(e); - - if (opengl) - { - this.SwapBuffers(); - } - - } - catch (Exception ex) { log.Info(ex.ToString()); } - - inOnPaint = false; - - count++; - - huddrawtime += (int)(DateTime.Now - starttime).TotalMilliseconds; - - if (DateTime.Now.Second != countdate.Second) - { - countdate = DateTime.Now; - // Console.WriteLine("HUD " + count + " hz drawtime " + (huddrawtime / count) + " gl " + opengl); - if ((huddrawtime / count) > 1000) - opengl = false; - - count = 0; - huddrawtime = 0; - } - } - - void Clear(Color color) - { - if (opengl) - { - GL.ClearColor(color); - } else - { - graphicsObjectGDIP.Clear(color); - } - } - - const float rad2deg = (float)(180 / Math.PI); - const float deg2rad = (float)(1.0 / rad2deg); - - public void DrawArc(Pen penn,RectangleF rect, float start,float degrees) - { - if (opengl) - { - GL.LineWidth(penn.Width); - GL.Color4(penn.Color); - - GL.Begin(BeginMode.LineStrip); - start -= 90; - float x = 0, y = 0; - for (int i = (int)start; i <= start + degrees; i++) - { - x = (float)Math.Sin(i * deg2rad) * rect.Width / 2; - y = (float)Math.Cos(i * deg2rad) * rect.Height / 2; - x = x + rect.X + rect.Width / 2; - y = y + rect.Y + rect.Height / 2; - GL.Vertex2(x, y); - } - GL.End(); - } - else - { - graphicsObjectGDIP.DrawArc(penn, rect, start, degrees); - } - } - - public void DrawEllipse(Pen penn, Rectangle rect) - { - if (opengl) - { - GL.LineWidth(penn.Width); - GL.Color4(penn.Color); - - GL.Begin(BeginMode.LineLoop); - float x, y; - for (float i = 0; i < 360; i += 1) - { - x = (float)Math.Sin(i * deg2rad) * rect.Width / 2; - y = (float)Math.Cos(i * deg2rad) * rect.Height / 2; - x = x + rect.X + rect.Width / 2; - y = y + rect.Y + rect.Height / 2; - GL.Vertex2(x, y); - } - GL.End(); - } - else - { - graphicsObjectGDIP.DrawEllipse(penn, rect); - } - } - - int texture; - Bitmap bitmap = new Bitmap(512,512); - - public void DrawImage(Image img, int x, int y, int width, int height) - { - if (opengl) - { - if (img == null) - return; - //bitmap = new Bitmap(512,512); - - using (Graphics graphics = Graphics.FromImage(bitmap)) - { - graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed; - graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; - graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; - //draw the image into the target bitmap - graphics.DrawImage(img, 0, 0, bitmap.Width, bitmap.Height); - } - - - GL.DeleteTexture(texture); - - GL.GenTextures(1, out texture); - GL.BindTexture(TextureTarget.Texture2D, texture); - - BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), - ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - - //Console.WriteLine("w {0} h {1}",data.Width, data.Height); - - GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0); - - bitmap.UnlockBits(data); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); - - GL.Enable(EnableCap.Texture2D); - - GL.BindTexture(TextureTarget.Texture2D, texture); - - GL.Begin(BeginMode.Quads); - - GL.TexCoord2(0.0f, 1.0f); GL.Vertex2(0, this.Height); - GL.TexCoord2(1.0f, 1.0f); GL.Vertex2(this.Width, this.Height); - GL.TexCoord2(1.0f, 0.0f); GL.Vertex2(this.Width, 0); - GL.TexCoord2(0.0f, 0.0f); GL.Vertex2(0, 0); - - GL.End(); - - GL.Disable(EnableCap.Texture2D); - } - else - { - graphicsObjectGDIP.DrawImage(img,x,y,width,height); - } - } - - public void DrawPath(Pen penn, GraphicsPath gp) - { - try - { - DrawPolygon(penn, gp.PathPoints); - } - catch { } - } - - public void FillPath(Brush brushh, GraphicsPath gp) - { - try - { - FillPolygon(brushh, gp.PathPoints); - } - catch { } - } - - public void SetClip(Rectangle rect) - { - - } - - public void ResetClip() - { - - } - - public void ResetTransform() - { - if (opengl) - { - GL.LoadIdentity(); - } - else - { - graphicsObjectGDIP.ResetTransform(); - } - } - - public void RotateTransform(float angle) - { - if (opengl) - { - GL.Rotate(angle, 0, 0, 1); - } - else - { - graphicsObjectGDIP.RotateTransform(angle); - } - } - - public void TranslateTransform(float x, float y) - { - if (opengl) - { - GL.Translate(x, y, 0f); - } - else - { - graphicsObjectGDIP.TranslateTransform(x, y); - } - } - - public void FillPolygon(Brush brushh, Point[] list) - { - if (opengl) - { - GL.Begin(BeginMode.TriangleFan); - GL.Color4(((SolidBrush)brushh).Color); - foreach (Point pnt in list) - { - GL.Vertex2(pnt.X, pnt.Y); - } - GL.Vertex2(list[list.Length - 1].X, list[list.Length - 1].Y); - GL.End(); - } - else - { - graphicsObjectGDIP.FillPolygon(brushh, list); - } - } - - public void FillPolygon(Brush brushh, PointF[] list) - { - if (opengl) - { - GL.Begin(BeginMode.Quads); - GL.Color4(((SolidBrush)brushh).Color); - foreach (PointF pnt in list) - { - GL.Vertex2(pnt.X, pnt.Y); - } - GL.Vertex2(list[0].X, list[0].Y); - GL.End(); - } - else - { - graphicsObjectGDIP.FillPolygon(brushh, list); - } - } - - public void DrawPolygon(Pen penn, Point[] list) - { - if (opengl) - { - GL.LineWidth(penn.Width); - GL.Color4(penn.Color); - - GL.Begin(BeginMode.LineLoop); - foreach (Point pnt in list) - { - GL.Vertex2(pnt.X, pnt.Y); - } - GL.End(); - } - else - { - graphicsObjectGDIP.DrawPolygon(penn, list); - } - } - - public void DrawPolygon(Pen penn, PointF[] list) - { - if (opengl) - { - GL.LineWidth(penn.Width); - GL.Color4(penn.Color); - - GL.Begin(BeginMode.LineLoop); - foreach (PointF pnt in list) - { - GL.Vertex2(pnt.X, pnt.Y); - } - - GL.End(); - } - else - { - graphicsObjectGDIP.DrawPolygon(penn, list); - } - } - - - public void FillRectangle(Brush brushh, RectangleF rectf) - { - if (opengl) - { - float x1 = rectf.X; - float y1 = rectf.Y; - - float width = rectf.Width; - float height = rectf.Height; - - GL.Begin(BeginMode.Quads); - - if (((Type)brushh.GetType()) == typeof(LinearGradientBrush)) - { - LinearGradientBrush temp = (LinearGradientBrush)brushh; - GL.Color4(temp.LinearColors[0]); - } - else - { - GL.Color4(((SolidBrush)brushh).Color.R / 255f, ((SolidBrush)brushh).Color.G / 255f, ((SolidBrush)brushh).Color.B / 255f, ((SolidBrush)brushh).Color.A / 255f); - } - - GL.Vertex2(x1, y1); - GL.Vertex2(x1 + width, y1); - - if (((Type)brushh.GetType()) == typeof(LinearGradientBrush)) - { - LinearGradientBrush temp = (LinearGradientBrush)brushh; - GL.Color4(temp.LinearColors[1]); - } - else - { - GL.Color4(((SolidBrush)brushh).Color.R / 255f, ((SolidBrush)brushh).Color.G / 255f, ((SolidBrush)brushh).Color.B / 255f, ((SolidBrush)brushh).Color.A / 255f); - } - - GL.Vertex2(x1 + width, y1 + height); - GL.Vertex2(x1, y1 + height); - GL.End(); - } - else - { - graphicsObjectGDIP.FillRectangle(brushh, rectf); - } - } - - public void DrawRectangle(Pen penn, RectangleF rect) - { - DrawRectangle(penn, rect.X, rect.Y, rect.Width, rect.Height); - } - - public void DrawRectangle(Pen penn, double x1, double y1, double width, double height) - { - - if (opengl) - { - GL.LineWidth(penn.Width); - GL.Color4(penn.Color); - - GL.Begin(BeginMode.LineLoop); - GL.Vertex2(x1, y1); - GL.Vertex2(x1 + width, y1); - GL.Vertex2(x1 + width, y1 + height); - GL.Vertex2(x1, y1 + height); - GL.End(); - } - else - { - graphicsObjectGDIP.DrawRectangle(penn, (float)x1, (float)y1, (float)width, (float)height); - } - } - - public void DrawLine(Pen penn, double x1, double y1, double x2, double y2) - { - - if (opengl) - { - GL.Color4(penn.Color); - GL.LineWidth(penn.Width); - - GL.Begin(BeginMode.Lines); - GL.Vertex2(x1, y1); - GL.Vertex2(x2, y2); - GL.End(); - } - else - { - graphicsObjectGDIP.DrawLine(penn, (float)x1, (float)y1, (float)x2, (float)y2); - } - } - - void doPaint(PaintEventArgs e) - { - bool isNaN = false; - try - { - if (graphicsObjectGDIP == null || !opengl && (objBitmap.Width != this.Width || objBitmap.Height != this.Height)) - { - objBitmap = new Bitmap(this.Width, this.Height); - graphicsObjectGDIP = Graphics.FromImage(objBitmap); - - graphicsObjectGDIP.SmoothingMode = SmoothingMode.AntiAlias; - graphicsObjectGDIP.InterpolationMode = InterpolationMode.NearestNeighbor; - graphicsObjectGDIP.CompositingMode = CompositingMode.SourceOver; - graphicsObjectGDIP.CompositingQuality = CompositingQuality.HighSpeed; - graphicsObjectGDIP.PixelOffsetMode = PixelOffsetMode.HighSpeed; - graphicsObjectGDIP.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; - } - - - graphicsObject.Clear(Color.Gray); - - if (_bgimage != null) - { - bgon = false; - graphicsObject.DrawImage(_bgimage, 0, 0, this.Width, this.Height); - - if (hudon == false) - { - return; - } - } - else - { - bgon = true; - } - - - if (float.IsNaN(_roll) || float.IsNaN(_pitch) || float.IsNaN(_heading)) - { - isNaN = true; - - _roll = 0; - _pitch = 0; - _heading = 0; - } - - graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2); - - - - graphicsObject.RotateTransform(-_roll); - - - int fontsize = this.Height / 30; // = 10 - int fontoffset = fontsize - 10; - - float every5deg = -this.Height / 60; - - float pitchoffset = -_pitch * every5deg; - - int halfwidth = this.Width / 2; - int halfheight = this.Height / 2; - - SolidBrush whiteBrush = new SolidBrush(whitePen.Color); - - Pen blackPen = new Pen(Color.Black, 2); - Pen greenPen = new Pen(Color.Green, 2); - Pen redPen = new Pen(Color.Red, 2); - - // draw sky - if (bgon == true) - { - RectangleF bg = new RectangleF(-halfwidth * 2, -halfheight * 2, this.Width * 2, halfheight * 2 + pitchoffset); - - if (bg.Height != 0) - { - LinearGradientBrush linearBrush = new LinearGradientBrush(bg, Color.Blue, - Color.LightBlue, LinearGradientMode.Vertical); - - graphicsObject.FillRectangle(linearBrush, bg); - } - // draw ground - - bg = new RectangleF(-halfwidth * 2, pitchoffset, this.Width * 2, halfheight * 2 - pitchoffset); - - if (bg.Height != 0) - { - LinearGradientBrush linearBrush = new LinearGradientBrush(bg, Color.FromArgb(0x9b, 0xb8, 0x24), - Color.FromArgb(0x41, 0x4f, 0x07), LinearGradientMode.Vertical); - - graphicsObject.FillRectangle(linearBrush, bg); - } - - //draw centerline - graphicsObject.DrawLine(whitePen, -halfwidth * 2, pitchoffset + 0, halfwidth * 2, pitchoffset + 0); - } - - graphicsObject.ResetTransform(); - - graphicsObject.SetClip(new Rectangle(0, this.Height / 14, this.Width, this.Height - this.Height / 14)); - - graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2); - graphicsObject.RotateTransform(-_roll); - - // draw armed - - if (status != statuslast) - { - armedtimer = DateTime.Now; - } - - if (status == 3) // not armed - { - //if ((armedtimer.AddSeconds(8) > DateTime.Now)) - { - drawstring(graphicsObject, "DISARMED", font, fontsize + 10, Brushes.Red, -85, halfheight / -3); - statuslast = status; - } - } - else if (status == 4) // armed - { - if ((armedtimer.AddSeconds(8) > DateTime.Now)) - { - drawstring(graphicsObject, "ARMED", font, fontsize + 20, Brushes.Red, -70, halfheight / -3); - statuslast = status; - } - } - - //draw pitch - - int lengthshort = this.Width / 12; - int lengthlong = this.Width / 8; - - for (int a = -90; a <= 90; a += 5) - { - // limit to 40 degrees - if (a >= _pitch - 34 && a <= _pitch + 25) - { - if (a % 10 == 0) - { - if (a == 0) - { - graphicsObject.DrawLine(greenPen, this.Width / 2 - lengthlong - halfwidth, pitchoffset + a * every5deg, this.Width / 2 + lengthlong - halfwidth, pitchoffset + a * every5deg); - } - else - { - graphicsObject.DrawLine(whitePen, this.Width / 2 - lengthlong - halfwidth, pitchoffset + a * every5deg, this.Width / 2 + lengthlong - halfwidth, pitchoffset + a * every5deg); - } - drawstring(graphicsObject, a.ToString(), font, fontsize + 2, whiteBrush, this.Width / 2 - lengthlong - 30 - halfwidth - (int)(fontoffset * 1.7), pitchoffset + a * every5deg - 8 - fontoffset); - } - else - { - graphicsObject.DrawLine(whitePen, this.Width / 2 - lengthshort - halfwidth, pitchoffset + a * every5deg, this.Width / 2 + lengthshort - halfwidth, pitchoffset + a * every5deg); - //drawstring(e,a.ToString(), new Font("Arial", 10), whiteBrush, this.Width / 2 - lengthshort - 20 - halfwidth, this.Height / 2 + pitchoffset + a * every5deg - 8); - } - } - } - - graphicsObject.ResetTransform(); - - // draw roll ind needle - - graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2 + this.Height / 14); - - graphicsObject.RotateTransform(-_roll); - - Point[] pointlist = new Point[3]; - - lengthlong = this.Height / 66; - - int extra = this.Height / 15 * 7; - - pointlist[0] = new Point(0, -lengthlong * 2 - extra); - pointlist[1] = new Point(-lengthlong, -lengthlong - extra); - pointlist[2] = new Point(lengthlong, -lengthlong - extra); - - if (Math.Abs(_roll) > 45) - { - redPen.Width = 10; - } - - graphicsObject.DrawPolygon(redPen, pointlist); - - redPen.Width = 2; - - for (int a = -45; a <= 45; a += 15) - { - graphicsObject.ResetTransform(); - graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2 + this.Height / 14); - graphicsObject.RotateTransform(a); - drawstring(graphicsObject, Math.Abs(a).ToString("##"), font, fontsize, whiteBrush, 0 - 6 - fontoffset, -lengthlong * 2 - extra); - graphicsObject.DrawLine(whitePen, 0, -halfheight, 0, -halfheight - 10); - } - - graphicsObject.ResetTransform(); - - //draw centre / current att - - Rectangle centercircle = new Rectangle(halfwidth - 10, halfheight - 10, 20, 20); - - graphicsObject.DrawEllipse(redPen, centercircle); - graphicsObject.DrawLine(redPen, centercircle.Left - 10, halfheight, centercircle.Left, halfheight); - graphicsObject.DrawLine(redPen, centercircle.Right, halfheight, centercircle.Right + 10, halfheight); - graphicsObject.DrawLine(redPen, centercircle.Left + centercircle.Width / 2, centercircle.Top, centercircle.Left + centercircle.Width / 2, centercircle.Top - 10); - - // draw roll ind - - Rectangle arcrect = new Rectangle(this.Width / 2 - this.Height / 2, this.Height / 14, this.Height, this.Height); - - graphicsObject.DrawArc(whitePen, arcrect, 180 + 45, 90); - - //draw heading ind - - graphicsObject.ResetClip(); - - Rectangle headbg = new Rectangle(0, 0, this.Width - 0, this.Height / 14); - - graphicsObject.DrawRectangle(blackPen, headbg); - - SolidBrush solidBrush = new SolidBrush(Color.FromArgb(0x55, 0xff, 0xff, 0xff)); - - graphicsObject.FillRectangle(solidBrush, headbg); - - // center - graphicsObject.DrawLine(redPen, headbg.Width / 2, headbg.Bottom, headbg.Width / 2, headbg.Top); - - //bottom line - graphicsObject.DrawLine(whitePen, headbg.Left + 5, headbg.Bottom - 5, headbg.Width - 5, headbg.Bottom - 5); - - float space = (headbg.Width - 10) / 60.0f; - int start = (int)Math.Round((_heading - 30),1); - - // draw for outside the 60 deg - if (_targetheading < start) - { - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * 0, headbg.Bottom, headbg.Left + 5 + space * (0), headbg.Top); - } - if (_targetheading > _heading + 30) - { - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * 60, headbg.Bottom, headbg.Left + 5 + space * (60), headbg.Top); - } - - for (int a = start; a <= _heading + 30; a += 1) - { - // target heading - if (((int)(a + 360) % 360) == (int)_targetheading) - { - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * (a - start), headbg.Bottom, headbg.Left + 5 + space * (a - start), headbg.Top); - } - - if (((int)(a + 360) % 360) == (int)_groundcourse) - { - blackPen.Width = 6; - graphicsObject.DrawLine(blackPen, headbg.Left + 5 + space * (a - start), headbg.Bottom, headbg.Left + 5 + space * (a - start), headbg.Top); - blackPen.Width = 2; - } - - if ((int)a % 5 == 0) - { - //Console.WriteLine(a + " " + Math.Round(a, 1, MidpointRounding.AwayFromZero)); - //Console.WriteLine(space +" " + a +" "+ (headbg.Left + 5 + space * (a - start))); - graphicsObject.DrawLine(whitePen, headbg.Left + 5 + space * (a - start), headbg.Bottom - 5, headbg.Left + 5 + space * (a - start), headbg.Bottom - 10); - int disp = (int)a; - if (disp < 0) - disp += 360; - disp = disp % 360; - if (disp == 0) - { - drawstring(graphicsObject, "N".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); - } - else if (disp == 90) - { - drawstring(graphicsObject, "E".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); - } - else if (disp == 180) - { - drawstring(graphicsObject, "S".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); - } - else if (disp == 270) - { - drawstring(graphicsObject, "W".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); - } - else - { - drawstring(graphicsObject, (disp % 360).ToString().PadLeft(3), font, fontsize, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); - } - } - } - - // Console.WriteLine("HUD 0 " + (DateTime.Now - starttime).TotalMilliseconds + " " + DateTime.Now.Millisecond); - - // xtrack error - // center - - float xtspace = this.Width / 10.0f / 3.0f; - int pad = 10; - - float myxtrack_error = _xtrack_error; - - myxtrack_error = Math.Min(myxtrack_error, 40); - myxtrack_error = Math.Max(myxtrack_error, -40); - - // xtrack - distance scale - space - float loc = myxtrack_error / 20.0f * xtspace; - - // current xtrack - if (Math.Abs(myxtrack_error) == 40) - { - greenPen.Color = Color.FromArgb(128, greenPen.Color); - } - - graphicsObject.DrawLine(greenPen, this.Width / 10 + loc, headbg.Bottom + 5, this.Width / 10 + loc, headbg.Bottom + this.Height / 10); - - greenPen.Color = Color.FromArgb(255, greenPen.Color); - - graphicsObject.DrawLine(whitePen, this.Width / 10, headbg.Bottom + 5, this.Width / 10, headbg.Bottom + this.Height / 10); - - graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace, headbg.Bottom + 5 + pad, this.Width / 10 - xtspace, headbg.Bottom + this.Height / 10 - pad); - - graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace * 2, headbg.Bottom + 5 + pad, this.Width / 10 - xtspace * 2, headbg.Bottom + this.Height / 10 - pad); - - graphicsObject.DrawLine(whitePen, this.Width / 10 + xtspace, headbg.Bottom + 5 + pad, this.Width / 10 + xtspace, headbg.Bottom + this.Height / 10 - pad); - - graphicsObject.DrawLine(whitePen, this.Width / 10 + xtspace * 2, headbg.Bottom + 5 + pad, this.Width / 10 + xtspace * 2, headbg.Bottom + this.Height / 10 - pad); - - // rate of turn - - whitePen.Width = 4; - graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace * 2 - xtspace / 2, headbg.Bottom + this.Height / 10 + 10, this.Width / 10 - xtspace * 2 - xtspace / 2 + xtspace, headbg.Bottom + this.Height / 10 + 10); - - graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace * 0 - xtspace / 2, headbg.Bottom + this.Height / 10 + 10, this.Width / 10 - xtspace * 0 - xtspace / 2 + xtspace, headbg.Bottom + this.Height / 10 + 10); - - graphicsObject.DrawLine(whitePen, this.Width / 10 + xtspace * 2 - xtspace / 2, headbg.Bottom + this.Height / 10 + 10, this.Width / 10 + xtspace * 2 - xtspace / 2 + xtspace, headbg.Bottom + this.Height / 10 + 10); - - float myturnrate = _turnrate; - float trwidth = (this.Width / 10 + xtspace * 2 - xtspace / 2) - (this.Width / 10 - xtspace * 2 - xtspace / 2); - - float range = 12; - - myturnrate = Math.Min(myturnrate, range / 2); - myturnrate = Math.Max(myturnrate, (range / 2) * -1.0f); - - loc = myturnrate / range * trwidth; - - greenPen.Width = 4; - - if (Math.Abs(myturnrate) == (range / 2)) - { - greenPen.Color = Color.FromArgb(128, greenPen.Color); - } - - graphicsObject.DrawLine(greenPen, this.Width / 10 + loc - xtspace / 2, headbg.Bottom + this.Height / 10 + 10 + 3, this.Width / 10 + loc + xtspace / 2, headbg.Bottom + this.Height / 10 + 10 + 3); - graphicsObject.DrawLine(greenPen, this.Width / 10 + loc, headbg.Bottom + this.Height / 10 + 10 + 3, this.Width / 10 + loc, headbg.Bottom + this.Height / 10 + 10 + 10); - - greenPen.Color = Color.FromArgb(255, greenPen.Color); - - whitePen.Width = 2; - - - - // left scroller - - Rectangle scrollbg = new Rectangle(0, halfheight - halfheight / 2, this.Width / 10, this.Height / 2); - - graphicsObject.DrawRectangle(whitePen, scrollbg); - - graphicsObject.FillRectangle(solidBrush, scrollbg); - - Point[] arrow = new Point[5]; - - arrow[0] = new Point(0, -10); - arrow[1] = new Point(scrollbg.Width - 10, -10); - arrow[2] = new Point(scrollbg.Width - 5, 0); - arrow[3] = new Point(scrollbg.Width - 10, 10); - arrow[4] = new Point(0, 10); - - graphicsObject.TranslateTransform(0, this.Height / 2); - - int viewrange = 26; - - float speed = _airspeed; - if (speed == 0) - speed = _groundspeed; - - space = (scrollbg.Height) / (float)viewrange; - start = ((int)speed - viewrange / 2); - - if (start > _targetspeed) - { - greenPen.Color = Color.FromArgb(128, greenPen.Color); - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top, scrollbg.Left + scrollbg.Width, scrollbg.Top); - greenPen.Color = Color.FromArgb(255, greenPen.Color); - } - if ((speed + viewrange / 2) < _targetspeed) - { - greenPen.Color = Color.FromArgb(128, greenPen.Color); - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * viewrange, scrollbg.Left + scrollbg.Width, scrollbg.Top - space * viewrange); - greenPen.Color = Color.FromArgb(255, greenPen.Color); - } - - for (int a = (int)start; a <= (speed + viewrange / 2); a += 1) - { - if (a == (int)_targetspeed && _targetspeed != 0) - { - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * (a - start), scrollbg.Left + scrollbg.Width, scrollbg.Top - space * (a - start)); - } - if (a % 5 == 0) - { - //Console.WriteLine(a + " " + scrollbg.Right + " " + (scrollbg.Top - space * (a - start)) + " " + (scrollbg.Right - 20) + " " + (scrollbg.Top - space * (a - start))); - graphicsObject.DrawLine(whitePen, scrollbg.Right, scrollbg.Top - space * (a - start), scrollbg.Right - 10, scrollbg.Top - space * (a - start)); - drawstring(graphicsObject, a.ToString().PadLeft(5), font, fontsize, whiteBrush, scrollbg.Right - 50 - 4 * fontoffset, scrollbg.Top - space * (a - start) - 6 - fontoffset); - } - } - - graphicsObject.DrawPolygon(blackPen, arrow); - graphicsObject.FillPolygon(Brushes.Black, arrow); - drawstring(graphicsObject, ((int)speed).ToString("0"), font, 10, Brushes.AliceBlue, 0, -9); - - graphicsObject.ResetTransform(); - - // extra text data - - drawstring(graphicsObject, "AS " + _airspeed.ToString("0.0"), font, fontsize, whiteBrush, 1, scrollbg.Bottom + 5); - drawstring(graphicsObject, "GS " + _groundspeed.ToString("0.0"), font, fontsize, whiteBrush, 1, scrollbg.Bottom + fontsize + 2 + 10); - - //drawstring(e,, new Font("Arial", fontsize + 2), whiteBrush, 1, scrollbg.Bottom + fontsize + 2 + 10); - - // right scroller - - scrollbg = new Rectangle(this.Width - this.Width / 10, halfheight - halfheight / 2, this.Width / 10, this.Height / 2); - - graphicsObject.DrawRectangle(whitePen, scrollbg); - - graphicsObject.FillRectangle(solidBrush, scrollbg); - - arrow = new Point[5]; - - arrow[0] = new Point(0, -10); - arrow[1] = new Point(scrollbg.Width - 10, -10); - arrow[2] = new Point(scrollbg.Width - 5, 0); - arrow[3] = new Point(scrollbg.Width - 10, 10); - arrow[4] = new Point(0, 10); - - - - graphicsObject.TranslateTransform(0, this.Height / 2); - - - - - viewrange = 26; - - space = (scrollbg.Height) / (float)viewrange; - start = ((int)_alt - viewrange / 2); - - if (start > _targetalt) - { - greenPen.Color = Color.FromArgb(128, greenPen.Color); - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top, scrollbg.Left + scrollbg.Width, scrollbg.Top); - greenPen.Color = Color.FromArgb(255, greenPen.Color); - } - if ((_alt + viewrange / 2) < _targetalt) - { - greenPen.Color = Color.FromArgb(128, greenPen.Color); - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * viewrange, scrollbg.Left + scrollbg.Width, scrollbg.Top - space * viewrange); - greenPen.Color = Color.FromArgb(255, greenPen.Color); - } - - for (int a = (int)start; a <= (_alt + viewrange / 2); a += 1) - { - if (a == Math.Round(_targetalt) && _targetalt != 0) - { - greenPen.Width = 6; - graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * (a - start), scrollbg.Left + scrollbg.Width, scrollbg.Top - space * (a - start)); - } - if (a % 5 == 0) - { - //Console.WriteLine(a + " " + scrollbg.Left + " " + (scrollbg.Top - space * (a - start)) + " " + (scrollbg.Left + 20) + " " + (scrollbg.Top - space * (a - start))); - graphicsObject.DrawLine(whitePen, scrollbg.Left, scrollbg.Top - space * (a - start), scrollbg.Left + 10, scrollbg.Top - space * (a - start)); - drawstring(graphicsObject, a.ToString().PadLeft(5), font, fontsize, whiteBrush, scrollbg.Left + 7 + (int)(0 * fontoffset), scrollbg.Top - space * (a - start) - 6 - fontoffset); - } - } - - greenPen.Width = 4; - - // vsi - - graphicsObject.ResetTransform(); - - PointF[] poly = new PointF[4]; - - poly[0] = new PointF(scrollbg.Left, scrollbg.Top); - poly[1] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Top + scrollbg.Width / 4); - poly[2] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Bottom - scrollbg.Width / 4); - poly[3] = new PointF(scrollbg.Left, scrollbg.Bottom); - - //verticalspeed - - viewrange = 12; - - _verticalspeed = Math.Min(viewrange / 2, _verticalspeed); - _verticalspeed = Math.Max(viewrange / -2, _verticalspeed); - - float scaledvalue = _verticalspeed / -viewrange * (scrollbg.Bottom - scrollbg.Top); - - float linespace = (float)1 / -viewrange * (scrollbg.Bottom - scrollbg.Top); - - PointF[] polyn = new PointF[4]; - - polyn[0] = new PointF(scrollbg.Left, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2); - polyn[1] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2); - polyn[2] = polyn[1]; - float peak = 0; - if (scaledvalue > 0) - { - peak = -scrollbg.Width / 4; - if (scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue + peak < scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2) - peak = -scaledvalue; - } - else if (scaledvalue < 0) - { - peak = +scrollbg.Width / 4; - if (scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue + peak > scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2) - peak = -scaledvalue; - } - - polyn[2] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue + peak); - polyn[3] = new PointF(scrollbg.Left, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue); - - //graphicsObject.DrawPolygon(redPen, poly); - graphicsObject.FillPolygon(Brushes.Blue, polyn); - - // draw outsidebox - graphicsObject.DrawPolygon(whitePen, poly); - - for (int a = 1; a < viewrange; a++) - { - graphicsObject.DrawLine(whitePen, scrollbg.Left - scrollbg.Width / 4, scrollbg.Top - linespace * a, scrollbg.Left - scrollbg.Width / 8, scrollbg.Top - linespace * a); - } - - // draw arrow and text - - graphicsObject.ResetTransform(); - graphicsObject.TranslateTransform(this.Width, this.Height / 2); - graphicsObject.RotateTransform(180); - - graphicsObject.DrawPolygon(blackPen, arrow); - graphicsObject.FillPolygon(Brushes.Black, arrow); - graphicsObject.ResetTransform(); - graphicsObject.TranslateTransform(0, this.Height / 2); - - drawstring(graphicsObject, ((int)_alt).ToString("0"), font, 10, Brushes.AliceBlue, scrollbg.Left + 10, -9); - graphicsObject.ResetTransform(); - - // mode and wp dist and wp - - drawstring(graphicsObject, _mode, font, fontsize, whiteBrush, scrollbg.Left - 30, scrollbg.Bottom + 5); - drawstring(graphicsObject, (int)_disttowp + ">" + _wpno, font, fontsize, whiteBrush, scrollbg.Left - 30, scrollbg.Bottom + fontsize + 2 + 10); - - graphicsObject.DrawLine(greenPen, scrollbg.Left - 5, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20, scrollbg.Left - 5, scrollbg.Top - (int)(fontsize) - 2 - 20); - graphicsObject.DrawLine(greenPen, scrollbg.Left - 10, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 15, scrollbg.Left - 10, scrollbg.Top - (int)(fontsize) - 2 - 20); - graphicsObject.DrawLine(greenPen, scrollbg.Left - 15, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 10, scrollbg.Left - 15, scrollbg.Top - (int)(fontsize ) - 2 - 20); - - drawstring(graphicsObject, _linkqualitygcs.ToString("0") + "%", font, fontsize, whiteBrush, scrollbg.Left, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20); - if (_linkqualitygcs == 0) - { - graphicsObject.DrawLine(redPen, scrollbg.Left, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20, scrollbg.Left + 50, scrollbg.Top - (int)(fontsize * 2.2) - 2); - - graphicsObject.DrawLine(redPen, scrollbg.Left, scrollbg.Top - (int)(fontsize * 2.2) - 2, scrollbg.Left + 50, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20); - } - drawstring(graphicsObject, _datetime.ToString("HH:mm:ss"), font, fontsize, whiteBrush, scrollbg.Left - 20, scrollbg.Top - fontsize - 2 - 20); - - - // battery - - graphicsObject.ResetTransform(); - - drawstring(graphicsObject, "Bat", font, fontsize + 2, whiteBrush, fontsize, this.Height - 30 - fontoffset); - drawstring(graphicsObject, _batterylevel.ToString("0.00v"), font, fontsize + 2, whiteBrush, fontsize * 4, this.Height - 30 - fontoffset); - drawstring(graphicsObject, _batteryremaining.ToString("0%"), font, fontsize + 2, whiteBrush, fontsize * 9, this.Height - 30 - fontoffset); - - // gps - - string gps = ""; - - if (_gpsfix == 0) - { - gps = ("GPS: No GPS"); - } - else if (_gpsfix == 1) - { - gps = ("GPS: No Fix"); - } - else if (_gpsfix == 2) - { - gps = ("GPS: 3D Fix"); - } - else if (_gpsfix == 3) - { - gps = ("GPS: 3D Fix"); - } - - drawstring(graphicsObject, gps, font, fontsize + 2, whiteBrush, this.Width - 10 * fontsize, this.Height - 30 - fontoffset); - - - if (isNaN) - drawstring(graphicsObject, "NaN Error " + DateTime.Now, font, this.Height / 30 + 10, Brushes.Red, 50, 50); - - - if (!opengl) - { - e.Graphics.DrawImageUnscaled(objBitmap, 0, 0); - } - - if (DesignMode) - { - return; - } - - // Console.WriteLine("HUD 1 " + (DateTime.Now - starttime).TotalMilliseconds + " " + DateTime.Now.Millisecond); - - ImageCodecInfo ici = GetImageCodec("image/jpeg"); - EncoderParameters eps = new EncoderParameters(1); - eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 50L); // or whatever other quality value you want - - lock (streamlock) - { - if (streamjpgenable || streamjpg == null) // init image and only update when needed - { - if (opengl) - { - objBitmap = GrabScreenshot(); - } - streamjpg = new MemoryStream(); - objBitmap.Save(streamjpg, ici, eps); - //objBitmap.Save(streamjpg,ImageFormat.Bmp); - } - } - } - catch (Exception ex) - { - log.Info("hud error "+ex.ToString()); - } - } - - protected override void OnPaintBackground(PaintEventArgs e) - { - //base.OnPaintBackground(e); - } - - ImageCodecInfo GetImageCodec(string mimetype) - { - foreach (ImageCodecInfo ici in ImageCodecInfo.GetImageEncoders()) - { - if (ici.MimeType == mimetype) return ici; - } - return null; - } - - // Returns a System.Drawing.Bitmap with the contents of the current framebuffer - public new Bitmap GrabScreenshot() - { - if (GraphicsContext.CurrentContext == null) - throw new GraphicsContextMissingException(); - - Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height); - System.Drawing.Imaging.BitmapData data = - bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height,OpenTK.Graphics.OpenGL.PixelFormat.Bgr, PixelType.UnsignedByte, data.Scan0); - bmp.UnlockBits(data); - - bmp.RotateFlip(RotateFlipType.RotateNoneFlipY); - return bmp; - } - - - float wrap360(float noin) - { - if (noin < 0) - return noin + 360; - return noin; - } - - /// <summary> - /// pen for drawstring - /// </summary> - Pen P = new Pen(Color.FromArgb(0x26, 0x27, 0x28), 2f); - /// <summary> - /// pth for drawstring - /// </summary> - GraphicsPath pth = new GraphicsPath(); - - void drawstring(HUD e, string text, Font font, float fontsize, Brush brush, float x, float y) - { - if (!opengl) - { - drawstring(graphicsObjectGDIP, text, font, fontsize, brush, x, y); - return; - } - - if (text == null || text == "") - return; - /* - OpenTK.Graphics.Begin(); - GL.PushMatrix(); - GL.Translate(x, y, 0); - printer.Print(text, font, c); - GL.PopMatrix(); printer.End(); - */ - - char[] chars = text.ToCharArray(); - - float maxy = 1; - - foreach (char cha in chars) - { - int charno = (int)cha; - - int charid = charno + (128 * (int)fontsize); // 128 * 40 * 5;128 - - if (charbitmaps[charid] == null) - { - charbitmaps[charid] = new Bitmap(128, 128, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - - charbitmaps[charid].MakeTransparent(Color.Transparent); - - //charbitmaptexid - - float maxx = this.Width / 150; // for space - - - // create bitmap - using (Graphics gfx = Graphics.FromImage(charbitmaps[charid])) - { - pth.Reset(); - - if (text != null) - pth.AddString(cha + "", font.FontFamily, 0, fontsize + 5, new Point((int)0, (int)0), StringFormat.GenericTypographic); - - gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - - gfx.DrawPath(P, pth); - - //Draw the face - - gfx.FillPath(brush, pth); - - - if (pth.PointCount > 0) - { - foreach (PointF pnt in pth.PathPoints) - { - if (pnt.X > maxx) - maxx = pnt.X; - - if (pnt.Y > maxy) - maxy = pnt.Y; - } - } - } - - charwidth[charid] = (int)(maxx + 2); - - //charbitmaps[charid] = charbitmaps[charid].Clone(new RectangleF(0, 0, maxx + 2, maxy + 2), charbitmaps[charid].PixelFormat); - - //charbitmaps[charno * (int)fontsize].Save(charno + " " + (int)fontsize + ".png"); - - // create texture - int textureId; - GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvModeCombine.Replace);//Important, or wrong color on some computers - - Bitmap bitmap = charbitmaps[charid]; - GL.GenTextures(1, out textureId); - GL.BindTexture(TextureTarget.Texture2D, textureId); - - BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - - GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); - - // GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Nearest); - //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Nearest); - GL.Finish(); - bitmap.UnlockBits(data); - - charbitmaptexid[charid] = textureId; - } - - //GL.Enable(EnableCap.Blend); - GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); - - GL.Enable(EnableCap.Texture2D); - GL.BindTexture(TextureTarget.Texture2D, charbitmaptexid[charid]); - - float scale = 1.0f; - - GL.Begin(BeginMode.Quads); - GL.TexCoord2(0, 0); GL.Vertex2(x, y); - GL.TexCoord2(1, 0); GL.Vertex2(x + charbitmaps[charid].Width * scale, y); - GL.TexCoord2(1, 1); GL.Vertex2(x + charbitmaps[charid].Width * scale, y + charbitmaps[charid].Height * scale); - GL.TexCoord2(0, 1); GL.Vertex2(x + 0, y + charbitmaps[charid].Height * scale); - GL.End(); - - //GL.Disable(EnableCap.Blend); - GL.Disable(EnableCap.Texture2D); - - x += charwidth[charid] * scale; - } - } - - void drawstring(Graphics e, string text, Font font, float fontsize, Brush brush, float x, float y) - { - if (text == null || text == "") - return; - - pth.Reset(); - - if (text != null) - pth.AddString(text, font.FontFamily, 0, fontsize + 5, new Point((int)x, (int)y), StringFormat.GenericTypographic); - - //Draw the edge - // this uses lots of cpu time - - //e.SmoothingMode = SmoothingMode.HighSpeed; - - if (e == null || P == null || pth == null || pth.PointCount == 0) - return; - - //if (!ArdupilotMega.MainV2.MONO) - e.DrawPath(P, pth); - - //Draw the face - - e.FillPath(brush, pth); - - //pth.Dispose(); - } - - protected override void OnHandleCreated(EventArgs e) - { - try - { - if (opengl) - { - base.OnHandleCreated(e); - } - } - catch (Exception ex) { log.Info(ex.ToString()); opengl = false; } // macs fail here - } - - protected override void OnHandleDestroyed(EventArgs e) - { - try - { - if (opengl) - { - base.OnHandleDestroyed(e); - } - } - catch (Exception ex) { log.Info(ex.ToString()); opengl = false; } - } - - protected override void OnResize(EventArgs e) - { - if (DesignMode || !started) - return; - - - if (SixteenXNine) - { - this.Height = (int)(this.Width / 1.777f); - } - else - { - // 4x3 - this.Height = (int)(this.Width / 1.333f); - } - - base.OnResize(e); - - graphicsObjectGDIP = Graphics.FromImage(objBitmap); - - charbitmaps = new Bitmap[charbitmaps.Length]; - - try - { - if (opengl) - { - foreach (int texid in charbitmaptexid) - { - if (texid != 0) - GL.DeleteTexture(texid); - } - } - } - catch { } - - GC.Collect(); - - try - { - if (opengl) - { - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - GL.Ortho(0, Width, Height, 0, -1, 1); - GL.MatrixMode(MatrixMode.Modelview); - GL.LoadIdentity(); - - GL.Viewport(0, 0, Width, Height); - } - } - catch { } - - } - } +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Drawing.Imaging; + +using System.Threading; + +using System.Drawing.Drawing2D; +using log4net; +using OpenTK; +using OpenTK.Graphics.OpenGL; +using OpenTK.Graphics; + + +// Control written by Michael Oborne 2011 +// dual opengl and GDI+ + +namespace ArdupilotMega.Controls +{ + public class HUD : GLControl + { + private static readonly ILog log = LogManager.GetLogger( + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + object paintlock = new object(); + object streamlock = new object(); + MemoryStream _streamjpg = new MemoryStream(); + [System.ComponentModel.Browsable(false)] + public MemoryStream streamjpg { get { lock (streamlock) { return _streamjpg; } } set { lock (streamlock) { _streamjpg = value; } } } + /// <summary> + /// this is to reduce cpu usage + /// </summary> + public bool streamjpgenable = false; + + Bitmap[] charbitmaps = new Bitmap[6000]; + int[] charbitmaptexid = new int[6000]; + int[] charwidth = new int[6000]; + + public int huddrawtime = 0; + + public bool opengl { get { return base.UseOpenGL; } set { base.UseOpenGL = value; } } + + bool started = false; + + public bool SixteenXNine = false; + + public HUD() + { + if (this.DesignMode) + { + opengl = false; + //return; + } + + //InitializeComponent(); + + graphicsObject = this; + graphicsObjectGDIP = Graphics.FromImage(objBitmap); + } + /* + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HUD)); + this.SuspendLayout(); + // + // HUD + // + this.BackColor = System.Drawing.Color.Black; + this.Name = "HUD"; + resources.ApplyResources(this, "$this"); + this.ResumeLayout(false); + + }*/ + + float _roll = 0; + float _navroll = 0; + float _pitch = 0; + float _navpitch = 0; + float _heading = 0; + float _targetheading = 0; + float _alt = 0; + float _targetalt = 0; + float _groundspeed = 0; + float _airspeed = 0; + float _targetspeed = 0; + float _batterylevel = 0; + float _batteryremaining = 0; + float _gpsfix = 0; + float _gpshdop = 0; + float _disttowp = 0; + float _groundcourse = 0; + float _xtrack_error = 0; + float _turnrate = 0; + float _verticalspeed = 0; + float _linkqualitygcs = 0; + DateTime _datetime; + string _mode = "Manual"; + int _wpno = 0; + + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float roll { get { return _roll; } set { if (_roll != value) { _roll = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float navroll { get { return _navroll; } set { if (_navroll != value) { _navroll = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float pitch { get { return _pitch; } set { if (_pitch != value) { _pitch = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float navpitch { get { return _navpitch; } set { if (_navpitch != value) { _navpitch = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float heading { get { return _heading; } set { if (_heading != value) { _heading = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float targetheading { get { return _targetheading; } set { if (_targetheading != value) { _targetheading = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float alt { get { return _alt; } set { if (_alt != value) { _alt = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float targetalt { get { return _targetalt; } set { if (_targetalt != value) { _targetalt = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float groundspeed { get { return _groundspeed; } set { if (_groundspeed != value) { _groundspeed = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float airspeed { get { return _airspeed; } set { if (_airspeed != value) { _airspeed = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float targetspeed { get { return _targetspeed; } set { if (_targetspeed != value) { _targetspeed = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float batterylevel { get { return _batterylevel; } set { if (_batterylevel != value) { _batterylevel = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float batteryremaining { get { return _batteryremaining; } set { if (_batteryremaining != value) { _batteryremaining = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float gpsfix { get { return _gpsfix; } set { if (_gpsfix != value) { _gpsfix = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float gpshdop { get { return _gpshdop; } set { if (_gpshdop != value) { _gpshdop = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float disttowp { get { return _disttowp; } set { if (_disttowp != value) { _disttowp = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public string mode { get { return _mode; } set { if (_mode != value) { _mode = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public int wpno { get { return _wpno; } set { if (_wpno != value) { _wpno = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float groundcourse { get { return _groundcourse; } set { if (_groundcourse != value) { _groundcourse = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float xtrack_error { get { return _xtrack_error; } set { if (_xtrack_error != value) { _xtrack_error = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float turnrate { get { return _turnrate; } set { if (_turnrate != value) { _turnrate = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float verticalspeed { get { return _verticalspeed; } set { if (_verticalspeed != value) { _verticalspeed = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float linkqualitygcs { get { return _linkqualitygcs; } set { if (_linkqualitygcs != value) { _linkqualitygcs = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public DateTime datetime { get { return _datetime; } set { if (_datetime != value) { _datetime = value; this.Invalidate(); } } } + + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public int status { get; set; } + + int statuslast = 0; + DateTime armedtimer = DateTime.MinValue; + + public bool bgon = true; + public bool hudon = true; + + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public Color hudcolor { get { return whitePen.Color; } set { whitePen = new Pen(value, 2); } } + + Pen whitePen = new Pen(Color.White, 2); + + public Image bgimage { set { _bgimage = value; this.Invalidate(); } } + Image _bgimage; + + // move these global as they rarely change - reduce GC + Font font = new Font("Arial", 10); + Bitmap objBitmap = new Bitmap(1024, 1024); + int count = 0; + DateTime countdate = DateTime.Now; + HUD graphicsObject; + Graphics graphicsObjectGDIP; + + DateTime starttime = DateTime.MinValue; + + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HUD)); + + public override void Refresh() + { + //base.Refresh(); + OnPaint(new PaintEventArgs(this.CreateGraphics(),this.ClientRectangle)); + } + + protected override void OnLoad(EventArgs e) + { + if (opengl) + { + try + { + + GraphicsMode test = this.GraphicsMode; + log.Info(test.ToString()); + log.Info("Vendor: " + GL.GetString(StringName.Vendor)); + log.Info("Version: " + GL.GetString(StringName.Version)); + log.Info("Device: " + GL.GetString(StringName.Renderer)); + //Console.WriteLine("Extensions: " + GL.GetString(StringName.Extensions)); + + int[] viewPort = new int[4]; + + GL.GetInteger(GetPName.Viewport, viewPort); + + GL.MatrixMode(MatrixMode.Projection); + GL.LoadIdentity(); + GL.Ortho(0, Width, Height, 0, -1, 1); + GL.MatrixMode(MatrixMode.Modelview); + GL.LoadIdentity(); + + GL.PushAttrib(AttribMask.DepthBufferBit); + GL.Disable(EnableCap.DepthTest); + //GL.Enable(EnableCap.Texture2D); + GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); + GL.Enable(EnableCap.Blend); + + } + catch (Exception ex) { log.Info("HUD opengl onload " + ex.ToString()); } + + try + { + GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); + + GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest); + GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Nicest); + GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); + + GL.Hint(HintTarget.TextureCompressionHint, HintMode.Nicest); + } + catch { } + + try + { + + GL.Enable(EnableCap.LineSmooth); + GL.Enable(EnableCap.PointSmooth); + GL.Enable(EnableCap.PolygonSmooth); + + } + catch { } + } + + started = true; + } + + bool inOnPaint = false; + string otherthread = ""; + + protected override void OnPaint(PaintEventArgs e) + { + //GL.Enable(EnableCap.AlphaTest) + + if (!started) + return; + + if (this.DesignMode) + { + e.Graphics.Clear(this.BackColor); + e.Graphics.Flush(); + } + + if ((DateTime.Now - starttime).TotalMilliseconds < 30 && (_bgimage == null)) + { + //Console.WriteLine("ms "+(DateTime.Now - starttime).TotalMilliseconds); + //e.Graphics.DrawImageUnscaled(objBitmap, 0, 0); + return; + } + + if (inOnPaint) + { + log.Info("Was in onpaint Hud th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread); + return; + } + + otherthread = System.Threading.Thread.CurrentThread.Name; + + inOnPaint = true; + + starttime = DateTime.Now; + + try + { + + if (opengl) + { + MakeCurrent(); + + GL.Clear(ClearBufferMask.ColorBufferBit); + + } + + doPaint(e); + + if (opengl) + { + this.SwapBuffers(); + } + + } + catch (Exception ex) { log.Info(ex.ToString()); } + + inOnPaint = false; + + count++; + + huddrawtime += (int)(DateTime.Now - starttime).TotalMilliseconds; + + if (DateTime.Now.Second != countdate.Second) + { + countdate = DateTime.Now; + // Console.WriteLine("HUD " + count + " hz drawtime " + (huddrawtime / count) + " gl " + opengl); + if ((huddrawtime / count) > 1000) + opengl = false; + + count = 0; + huddrawtime = 0; + } + } + + void Clear(Color color) + { + if (opengl) + { + GL.ClearColor(color); + } else + { + graphicsObjectGDIP.Clear(color); + } + } + + const float rad2deg = (float)(180 / Math.PI); + const float deg2rad = (float)(1.0 / rad2deg); + + public void DrawArc(Pen penn,RectangleF rect, float start,float degrees) + { + if (opengl) + { + GL.LineWidth(penn.Width); + GL.Color4(penn.Color); + + GL.Begin(BeginMode.LineStrip); + start -= 90; + float x = 0, y = 0; + for (int i = (int)start; i <= start + degrees; i++) + { + x = (float)Math.Sin(i * deg2rad) * rect.Width / 2; + y = (float)Math.Cos(i * deg2rad) * rect.Height / 2; + x = x + rect.X + rect.Width / 2; + y = y + rect.Y + rect.Height / 2; + GL.Vertex2(x, y); + } + GL.End(); + } + else + { + graphicsObjectGDIP.DrawArc(penn, rect, start, degrees); + } + } + + public void DrawEllipse(Pen penn, Rectangle rect) + { + if (opengl) + { + GL.LineWidth(penn.Width); + GL.Color4(penn.Color); + + GL.Begin(BeginMode.LineLoop); + float x, y; + for (float i = 0; i < 360; i += 1) + { + x = (float)Math.Sin(i * deg2rad) * rect.Width / 2; + y = (float)Math.Cos(i * deg2rad) * rect.Height / 2; + x = x + rect.X + rect.Width / 2; + y = y + rect.Y + rect.Height / 2; + GL.Vertex2(x, y); + } + GL.End(); + } + else + { + graphicsObjectGDIP.DrawEllipse(penn, rect); + } + } + + int texture; + Bitmap bitmap = new Bitmap(512,512); + + public void DrawImage(Image img, int x, int y, int width, int height) + { + if (opengl) + { + if (img == null) + return; + //bitmap = new Bitmap(512,512); + + using (Graphics graphics = Graphics.FromImage(bitmap)) + { + graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed; + graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; + graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; + //draw the image into the target bitmap + graphics.DrawImage(img, 0, 0, bitmap.Width, bitmap.Height); + } + + + GL.DeleteTexture(texture); + + GL.GenTextures(1, out texture); + GL.BindTexture(TextureTarget.Texture2D, texture); + + BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), + ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + + //Console.WriteLine("w {0} h {1}",data.Width, data.Height); + + GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0); + + bitmap.UnlockBits(data); + + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); + + GL.Enable(EnableCap.Texture2D); + + GL.BindTexture(TextureTarget.Texture2D, texture); + + GL.Begin(BeginMode.Quads); + + GL.TexCoord2(0.0f, 1.0f); GL.Vertex2(0, this.Height); + GL.TexCoord2(1.0f, 1.0f); GL.Vertex2(this.Width, this.Height); + GL.TexCoord2(1.0f, 0.0f); GL.Vertex2(this.Width, 0); + GL.TexCoord2(0.0f, 0.0f); GL.Vertex2(0, 0); + + GL.End(); + + GL.Disable(EnableCap.Texture2D); + } + else + { + graphicsObjectGDIP.DrawImage(img,x,y,width,height); + } + } + + public void DrawPath(Pen penn, GraphicsPath gp) + { + try + { + DrawPolygon(penn, gp.PathPoints); + } + catch { } + } + + public void FillPath(Brush brushh, GraphicsPath gp) + { + try + { + FillPolygon(brushh, gp.PathPoints); + } + catch { } + } + + public void SetClip(Rectangle rect) + { + + } + + public void ResetClip() + { + + } + + public void ResetTransform() + { + if (opengl) + { + GL.LoadIdentity(); + } + else + { + graphicsObjectGDIP.ResetTransform(); + } + } + + public void RotateTransform(float angle) + { + if (opengl) + { + GL.Rotate(angle, 0, 0, 1); + } + else + { + graphicsObjectGDIP.RotateTransform(angle); + } + } + + public void TranslateTransform(float x, float y) + { + if (opengl) + { + GL.Translate(x, y, 0f); + } + else + { + graphicsObjectGDIP.TranslateTransform(x, y); + } + } + + public void FillPolygon(Brush brushh, Point[] list) + { + if (opengl) + { + GL.Begin(BeginMode.TriangleFan); + GL.Color4(((SolidBrush)brushh).Color); + foreach (Point pnt in list) + { + GL.Vertex2(pnt.X, pnt.Y); + } + GL.Vertex2(list[list.Length - 1].X, list[list.Length - 1].Y); + GL.End(); + } + else + { + graphicsObjectGDIP.FillPolygon(brushh, list); + } + } + + public void FillPolygon(Brush brushh, PointF[] list) + { + if (opengl) + { + GL.Begin(BeginMode.Quads); + GL.Color4(((SolidBrush)brushh).Color); + foreach (PointF pnt in list) + { + GL.Vertex2(pnt.X, pnt.Y); + } + GL.Vertex2(list[0].X, list[0].Y); + GL.End(); + } + else + { + graphicsObjectGDIP.FillPolygon(brushh, list); + } + } + + public void DrawPolygon(Pen penn, Point[] list) + { + if (opengl) + { + GL.LineWidth(penn.Width); + GL.Color4(penn.Color); + + GL.Begin(BeginMode.LineLoop); + foreach (Point pnt in list) + { + GL.Vertex2(pnt.X, pnt.Y); + } + GL.End(); + } + else + { + graphicsObjectGDIP.DrawPolygon(penn, list); + } + } + + public void DrawPolygon(Pen penn, PointF[] list) + { + if (opengl) + { + GL.LineWidth(penn.Width); + GL.Color4(penn.Color); + + GL.Begin(BeginMode.LineLoop); + foreach (PointF pnt in list) + { + GL.Vertex2(pnt.X, pnt.Y); + } + + GL.End(); + } + else + { + graphicsObjectGDIP.DrawPolygon(penn, list); + } + } + + + public void FillRectangle(Brush brushh, RectangleF rectf) + { + if (opengl) + { + float x1 = rectf.X; + float y1 = rectf.Y; + + float width = rectf.Width; + float height = rectf.Height; + + GL.Begin(BeginMode.Quads); + + if (((Type)brushh.GetType()) == typeof(LinearGradientBrush)) + { + LinearGradientBrush temp = (LinearGradientBrush)brushh; + GL.Color4(temp.LinearColors[0]); + } + else + { + GL.Color4(((SolidBrush)brushh).Color.R / 255f, ((SolidBrush)brushh).Color.G / 255f, ((SolidBrush)brushh).Color.B / 255f, ((SolidBrush)brushh).Color.A / 255f); + } + + GL.Vertex2(x1, y1); + GL.Vertex2(x1 + width, y1); + + if (((Type)brushh.GetType()) == typeof(LinearGradientBrush)) + { + LinearGradientBrush temp = (LinearGradientBrush)brushh; + GL.Color4(temp.LinearColors[1]); + } + else + { + GL.Color4(((SolidBrush)brushh).Color.R / 255f, ((SolidBrush)brushh).Color.G / 255f, ((SolidBrush)brushh).Color.B / 255f, ((SolidBrush)brushh).Color.A / 255f); + } + + GL.Vertex2(x1 + width, y1 + height); + GL.Vertex2(x1, y1 + height); + GL.End(); + } + else + { + graphicsObjectGDIP.FillRectangle(brushh, rectf); + } + } + + public void DrawRectangle(Pen penn, RectangleF rect) + { + DrawRectangle(penn, rect.X, rect.Y, rect.Width, rect.Height); + } + + public void DrawRectangle(Pen penn, double x1, double y1, double width, double height) + { + + if (opengl) + { + GL.LineWidth(penn.Width); + GL.Color4(penn.Color); + + GL.Begin(BeginMode.LineLoop); + GL.Vertex2(x1, y1); + GL.Vertex2(x1 + width, y1); + GL.Vertex2(x1 + width, y1 + height); + GL.Vertex2(x1, y1 + height); + GL.End(); + } + else + { + graphicsObjectGDIP.DrawRectangle(penn, (float)x1, (float)y1, (float)width, (float)height); + } + } + + public void DrawLine(Pen penn, double x1, double y1, double x2, double y2) + { + + if (opengl) + { + GL.Color4(penn.Color); + GL.LineWidth(penn.Width); + + GL.Begin(BeginMode.Lines); + GL.Vertex2(x1, y1); + GL.Vertex2(x2, y2); + GL.End(); + } + else + { + graphicsObjectGDIP.DrawLine(penn, (float)x1, (float)y1, (float)x2, (float)y2); + } + } + + void doPaint(PaintEventArgs e) + { + bool isNaN = false; + try + { + if (graphicsObjectGDIP == null || !opengl && (objBitmap.Width != this.Width || objBitmap.Height != this.Height)) + { + objBitmap = new Bitmap(this.Width, this.Height); + graphicsObjectGDIP = Graphics.FromImage(objBitmap); + + graphicsObjectGDIP.SmoothingMode = SmoothingMode.AntiAlias; + graphicsObjectGDIP.InterpolationMode = InterpolationMode.NearestNeighbor; + graphicsObjectGDIP.CompositingMode = CompositingMode.SourceOver; + graphicsObjectGDIP.CompositingQuality = CompositingQuality.HighSpeed; + graphicsObjectGDIP.PixelOffsetMode = PixelOffsetMode.HighSpeed; + graphicsObjectGDIP.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; + } + + + graphicsObject.Clear(Color.Gray); + + if (_bgimage != null) + { + bgon = false; + graphicsObject.DrawImage(_bgimage, 0, 0, this.Width, this.Height); + + if (hudon == false) + { + return; + } + } + else + { + bgon = true; + } + + + if (float.IsNaN(_roll) || float.IsNaN(_pitch) || float.IsNaN(_heading)) + { + isNaN = true; + + _roll = 0; + _pitch = 0; + _heading = 0; + } + + graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2); + + + + graphicsObject.RotateTransform(-_roll); + + + int fontsize = this.Height / 30; // = 10 + int fontoffset = fontsize - 10; + + float every5deg = -this.Height / 60; + + float pitchoffset = -_pitch * every5deg; + + int halfwidth = this.Width / 2; + int halfheight = this.Height / 2; + + SolidBrush whiteBrush = new SolidBrush(whitePen.Color); + + Pen blackPen = new Pen(Color.Black, 2); + Pen greenPen = new Pen(Color.Green, 2); + Pen redPen = new Pen(Color.Red, 2); + + // draw sky + if (bgon == true) + { + RectangleF bg = new RectangleF(-halfwidth * 2, -halfheight * 2, this.Width * 2, halfheight * 2 + pitchoffset); + + if (bg.Height != 0) + { + LinearGradientBrush linearBrush = new LinearGradientBrush(bg, Color.Blue, + Color.LightBlue, LinearGradientMode.Vertical); + + graphicsObject.FillRectangle(linearBrush, bg); + } + // draw ground + + bg = new RectangleF(-halfwidth * 2, pitchoffset, this.Width * 2, halfheight * 2 - pitchoffset); + + if (bg.Height != 0) + { + LinearGradientBrush linearBrush = new LinearGradientBrush(bg, Color.FromArgb(0x9b, 0xb8, 0x24), + Color.FromArgb(0x41, 0x4f, 0x07), LinearGradientMode.Vertical); + + graphicsObject.FillRectangle(linearBrush, bg); + } + + //draw centerline + graphicsObject.DrawLine(whitePen, -halfwidth * 2, pitchoffset + 0, halfwidth * 2, pitchoffset + 0); + } + + graphicsObject.ResetTransform(); + + graphicsObject.SetClip(new Rectangle(0, this.Height / 14, this.Width, this.Height - this.Height / 14)); + + graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2); + graphicsObject.RotateTransform(-_roll); + + // draw armed + + if (status != statuslast) + { + armedtimer = DateTime.Now; + } + + if (status == 3) // not armed + { + //if ((armedtimer.AddSeconds(8) > DateTime.Now)) + { + drawstring(graphicsObject, "DISARMED", font, fontsize + 10, Brushes.Red, -85, halfheight / -3); + statuslast = status; + } + } + else if (status == 4) // armed + { + if ((armedtimer.AddSeconds(8) > DateTime.Now)) + { + drawstring(graphicsObject, "ARMED", font, fontsize + 20, Brushes.Red, -70, halfheight / -3); + statuslast = status; + } + } + + //draw pitch + + int lengthshort = this.Width / 12; + int lengthlong = this.Width / 8; + + for (int a = -90; a <= 90; a += 5) + { + // limit to 40 degrees + if (a >= _pitch - 34 && a <= _pitch + 25) + { + if (a % 10 == 0) + { + if (a == 0) + { + graphicsObject.DrawLine(greenPen, this.Width / 2 - lengthlong - halfwidth, pitchoffset + a * every5deg, this.Width / 2 + lengthlong - halfwidth, pitchoffset + a * every5deg); + } + else + { + graphicsObject.DrawLine(whitePen, this.Width / 2 - lengthlong - halfwidth, pitchoffset + a * every5deg, this.Width / 2 + lengthlong - halfwidth, pitchoffset + a * every5deg); + } + drawstring(graphicsObject, a.ToString(), font, fontsize + 2, whiteBrush, this.Width / 2 - lengthlong - 30 - halfwidth - (int)(fontoffset * 1.7), pitchoffset + a * every5deg - 8 - fontoffset); + } + else + { + graphicsObject.DrawLine(whitePen, this.Width / 2 - lengthshort - halfwidth, pitchoffset + a * every5deg, this.Width / 2 + lengthshort - halfwidth, pitchoffset + a * every5deg); + //drawstring(e,a.ToString(), new Font("Arial", 10), whiteBrush, this.Width / 2 - lengthshort - 20 - halfwidth, this.Height / 2 + pitchoffset + a * every5deg - 8); + } + } + } + + graphicsObject.ResetTransform(); + + // draw roll ind needle + + graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2 + this.Height / 14); + + graphicsObject.RotateTransform(-_roll); + + Point[] pointlist = new Point[3]; + + lengthlong = this.Height / 66; + + int extra = this.Height / 15 * 7; + + pointlist[0] = new Point(0, -lengthlong * 2 - extra); + pointlist[1] = new Point(-lengthlong, -lengthlong - extra); + pointlist[2] = new Point(lengthlong, -lengthlong - extra); + + if (Math.Abs(_roll) > 45) + { + redPen.Width = 10; + } + + graphicsObject.DrawPolygon(redPen, pointlist); + + redPen.Width = 2; + + for (int a = -45; a <= 45; a += 15) + { + graphicsObject.ResetTransform(); + graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2 + this.Height / 14); + graphicsObject.RotateTransform(a); + drawstring(graphicsObject, Math.Abs(a).ToString("##"), font, fontsize, whiteBrush, 0 - 6 - fontoffset, -lengthlong * 2 - extra); + graphicsObject.DrawLine(whitePen, 0, -halfheight, 0, -halfheight - 10); + } + + graphicsObject.ResetTransform(); + + //draw centre / current att + + Rectangle centercircle = new Rectangle(halfwidth - 10, halfheight - 10, 20, 20); + + graphicsObject.DrawEllipse(redPen, centercircle); + graphicsObject.DrawLine(redPen, centercircle.Left - 10, halfheight, centercircle.Left, halfheight); + graphicsObject.DrawLine(redPen, centercircle.Right, halfheight, centercircle.Right + 10, halfheight); + graphicsObject.DrawLine(redPen, centercircle.Left + centercircle.Width / 2, centercircle.Top, centercircle.Left + centercircle.Width / 2, centercircle.Top - 10); + + // draw roll ind + + Rectangle arcrect = new Rectangle(this.Width / 2 - this.Height / 2, this.Height / 14, this.Height, this.Height); + + graphicsObject.DrawArc(whitePen, arcrect, 180 + 45, 90); + + //draw heading ind + + graphicsObject.ResetClip(); + + Rectangle headbg = new Rectangle(0, 0, this.Width - 0, this.Height / 14); + + graphicsObject.DrawRectangle(blackPen, headbg); + + SolidBrush solidBrush = new SolidBrush(Color.FromArgb(0x55, 0xff, 0xff, 0xff)); + + graphicsObject.FillRectangle(solidBrush, headbg); + + // center + graphicsObject.DrawLine(redPen, headbg.Width / 2, headbg.Bottom, headbg.Width / 2, headbg.Top); + + //bottom line + graphicsObject.DrawLine(whitePen, headbg.Left + 5, headbg.Bottom - 5, headbg.Width - 5, headbg.Bottom - 5); + + float space = (headbg.Width - 10) / 60.0f; + int start = (int)Math.Round((_heading - 30),1); + + // draw for outside the 60 deg + if (_targetheading < start) + { + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * 0, headbg.Bottom, headbg.Left + 5 + space * (0), headbg.Top); + } + if (_targetheading > _heading + 30) + { + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * 60, headbg.Bottom, headbg.Left + 5 + space * (60), headbg.Top); + } + + for (int a = start; a <= _heading + 30; a += 1) + { + // target heading + if (((int)(a + 360) % 360) == (int)_targetheading) + { + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, headbg.Left + 5 + space * (a - start), headbg.Bottom, headbg.Left + 5 + space * (a - start), headbg.Top); + } + + if (((int)(a + 360) % 360) == (int)_groundcourse) + { + blackPen.Width = 6; + graphicsObject.DrawLine(blackPen, headbg.Left + 5 + space * (a - start), headbg.Bottom, headbg.Left + 5 + space * (a - start), headbg.Top); + blackPen.Width = 2; + } + + if ((int)a % 5 == 0) + { + //Console.WriteLine(a + " " + Math.Round(a, 1, MidpointRounding.AwayFromZero)); + //Console.WriteLine(space +" " + a +" "+ (headbg.Left + 5 + space * (a - start))); + graphicsObject.DrawLine(whitePen, headbg.Left + 5 + space * (a - start), headbg.Bottom - 5, headbg.Left + 5 + space * (a - start), headbg.Bottom - 10); + int disp = (int)a; + if (disp < 0) + disp += 360; + disp = disp % 360; + if (disp == 0) + { + drawstring(graphicsObject, "N".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); + } + else if (disp == 90) + { + drawstring(graphicsObject, "E".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); + } + else if (disp == 180) + { + drawstring(graphicsObject, "S".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); + } + else if (disp == 270) + { + drawstring(graphicsObject, "W".PadLeft(2), font, fontsize + 4, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); + } + else + { + drawstring(graphicsObject, (disp % 360).ToString().PadLeft(3), font, fontsize, whiteBrush, headbg.Left - 5 + space * (a - start) - fontoffset, headbg.Bottom - 24 - (int)(fontoffset * 1.7)); + } + } + } + + // Console.WriteLine("HUD 0 " + (DateTime.Now - starttime).TotalMilliseconds + " " + DateTime.Now.Millisecond); + + // xtrack error + // center + + float xtspace = this.Width / 10.0f / 3.0f; + int pad = 10; + + float myxtrack_error = _xtrack_error; + + myxtrack_error = Math.Min(myxtrack_error, 40); + myxtrack_error = Math.Max(myxtrack_error, -40); + + // xtrack - distance scale - space + float loc = myxtrack_error / 20.0f * xtspace; + + // current xtrack + if (Math.Abs(myxtrack_error) == 40) + { + greenPen.Color = Color.FromArgb(128, greenPen.Color); + } + + graphicsObject.DrawLine(greenPen, this.Width / 10 + loc, headbg.Bottom + 5, this.Width / 10 + loc, headbg.Bottom + this.Height / 10); + + greenPen.Color = Color.FromArgb(255, greenPen.Color); + + graphicsObject.DrawLine(whitePen, this.Width / 10, headbg.Bottom + 5, this.Width / 10, headbg.Bottom + this.Height / 10); + + graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace, headbg.Bottom + 5 + pad, this.Width / 10 - xtspace, headbg.Bottom + this.Height / 10 - pad); + + graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace * 2, headbg.Bottom + 5 + pad, this.Width / 10 - xtspace * 2, headbg.Bottom + this.Height / 10 - pad); + + graphicsObject.DrawLine(whitePen, this.Width / 10 + xtspace, headbg.Bottom + 5 + pad, this.Width / 10 + xtspace, headbg.Bottom + this.Height / 10 - pad); + + graphicsObject.DrawLine(whitePen, this.Width / 10 + xtspace * 2, headbg.Bottom + 5 + pad, this.Width / 10 + xtspace * 2, headbg.Bottom + this.Height / 10 - pad); + + // rate of turn + + whitePen.Width = 4; + graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace * 2 - xtspace / 2, headbg.Bottom + this.Height / 10 + 10, this.Width / 10 - xtspace * 2 - xtspace / 2 + xtspace, headbg.Bottom + this.Height / 10 + 10); + + graphicsObject.DrawLine(whitePen, this.Width / 10 - xtspace * 0 - xtspace / 2, headbg.Bottom + this.Height / 10 + 10, this.Width / 10 - xtspace * 0 - xtspace / 2 + xtspace, headbg.Bottom + this.Height / 10 + 10); + + graphicsObject.DrawLine(whitePen, this.Width / 10 + xtspace * 2 - xtspace / 2, headbg.Bottom + this.Height / 10 + 10, this.Width / 10 + xtspace * 2 - xtspace / 2 + xtspace, headbg.Bottom + this.Height / 10 + 10); + + float myturnrate = _turnrate; + float trwidth = (this.Width / 10 + xtspace * 2 - xtspace / 2) - (this.Width / 10 - xtspace * 2 - xtspace / 2); + + float range = 12; + + myturnrate = Math.Min(myturnrate, range / 2); + myturnrate = Math.Max(myturnrate, (range / 2) * -1.0f); + + loc = myturnrate / range * trwidth; + + greenPen.Width = 4; + + if (Math.Abs(myturnrate) == (range / 2)) + { + greenPen.Color = Color.FromArgb(128, greenPen.Color); + } + + graphicsObject.DrawLine(greenPen, this.Width / 10 + loc - xtspace / 2, headbg.Bottom + this.Height / 10 + 10 + 3, this.Width / 10 + loc + xtspace / 2, headbg.Bottom + this.Height / 10 + 10 + 3); + graphicsObject.DrawLine(greenPen, this.Width / 10 + loc, headbg.Bottom + this.Height / 10 + 10 + 3, this.Width / 10 + loc, headbg.Bottom + this.Height / 10 + 10 + 10); + + greenPen.Color = Color.FromArgb(255, greenPen.Color); + + whitePen.Width = 2; + + + + // left scroller + + Rectangle scrollbg = new Rectangle(0, halfheight - halfheight / 2, this.Width / 10, this.Height / 2); + + graphicsObject.DrawRectangle(whitePen, scrollbg); + + graphicsObject.FillRectangle(solidBrush, scrollbg); + + Point[] arrow = new Point[5]; + + arrow[0] = new Point(0, -10); + arrow[1] = new Point(scrollbg.Width - 10, -10); + arrow[2] = new Point(scrollbg.Width - 5, 0); + arrow[3] = new Point(scrollbg.Width - 10, 10); + arrow[4] = new Point(0, 10); + + graphicsObject.TranslateTransform(0, this.Height / 2); + + int viewrange = 26; + + float speed = _airspeed; + if (speed == 0) + speed = _groundspeed; + + space = (scrollbg.Height) / (float)viewrange; + start = ((int)speed - viewrange / 2); + + if (start > _targetspeed) + { + greenPen.Color = Color.FromArgb(128, greenPen.Color); + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top, scrollbg.Left + scrollbg.Width, scrollbg.Top); + greenPen.Color = Color.FromArgb(255, greenPen.Color); + } + if ((speed + viewrange / 2) < _targetspeed) + { + greenPen.Color = Color.FromArgb(128, greenPen.Color); + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * viewrange, scrollbg.Left + scrollbg.Width, scrollbg.Top - space * viewrange); + greenPen.Color = Color.FromArgb(255, greenPen.Color); + } + + for (int a = (int)start; a <= (speed + viewrange / 2); a += 1) + { + if (a == (int)_targetspeed && _targetspeed != 0) + { + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * (a - start), scrollbg.Left + scrollbg.Width, scrollbg.Top - space * (a - start)); + } + if (a % 5 == 0) + { + //Console.WriteLine(a + " " + scrollbg.Right + " " + (scrollbg.Top - space * (a - start)) + " " + (scrollbg.Right - 20) + " " + (scrollbg.Top - space * (a - start))); + graphicsObject.DrawLine(whitePen, scrollbg.Right, scrollbg.Top - space * (a - start), scrollbg.Right - 10, scrollbg.Top - space * (a - start)); + drawstring(graphicsObject, a.ToString().PadLeft(5), font, fontsize, whiteBrush, scrollbg.Right - 50 - 4 * fontoffset, scrollbg.Top - space * (a - start) - 6 - fontoffset); + } + } + + graphicsObject.DrawPolygon(blackPen, arrow); + graphicsObject.FillPolygon(Brushes.Black, arrow); + drawstring(graphicsObject, ((int)speed).ToString("0"), font, 10, Brushes.AliceBlue, 0, -9); + + graphicsObject.ResetTransform(); + + // extra text data + + drawstring(graphicsObject, "AS " + _airspeed.ToString("0.0"), font, fontsize, whiteBrush, 1, scrollbg.Bottom + 5); + drawstring(graphicsObject, "GS " + _groundspeed.ToString("0.0"), font, fontsize, whiteBrush, 1, scrollbg.Bottom + fontsize + 2 + 10); + + //drawstring(e,, new Font("Arial", fontsize + 2), whiteBrush, 1, scrollbg.Bottom + fontsize + 2 + 10); + + // right scroller + + scrollbg = new Rectangle(this.Width - this.Width / 10, halfheight - halfheight / 2, this.Width / 10, this.Height / 2); + + graphicsObject.DrawRectangle(whitePen, scrollbg); + + graphicsObject.FillRectangle(solidBrush, scrollbg); + + arrow = new Point[5]; + + arrow[0] = new Point(0, -10); + arrow[1] = new Point(scrollbg.Width - 10, -10); + arrow[2] = new Point(scrollbg.Width - 5, 0); + arrow[3] = new Point(scrollbg.Width - 10, 10); + arrow[4] = new Point(0, 10); + + + + graphicsObject.TranslateTransform(0, this.Height / 2); + + + + + viewrange = 26; + + space = (scrollbg.Height) / (float)viewrange; + start = ((int)_alt - viewrange / 2); + + if (start > _targetalt) + { + greenPen.Color = Color.FromArgb(128, greenPen.Color); + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top, scrollbg.Left + scrollbg.Width, scrollbg.Top); + greenPen.Color = Color.FromArgb(255, greenPen.Color); + } + if ((_alt + viewrange / 2) < _targetalt) + { + greenPen.Color = Color.FromArgb(128, greenPen.Color); + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * viewrange, scrollbg.Left + scrollbg.Width, scrollbg.Top - space * viewrange); + greenPen.Color = Color.FromArgb(255, greenPen.Color); + } + + for (int a = (int)start; a <= (_alt + viewrange / 2); a += 1) + { + if (a == Math.Round(_targetalt) && _targetalt != 0) + { + greenPen.Width = 6; + graphicsObject.DrawLine(greenPen, scrollbg.Left, scrollbg.Top - space * (a - start), scrollbg.Left + scrollbg.Width, scrollbg.Top - space * (a - start)); + } + if (a % 5 == 0) + { + //Console.WriteLine(a + " " + scrollbg.Left + " " + (scrollbg.Top - space * (a - start)) + " " + (scrollbg.Left + 20) + " " + (scrollbg.Top - space * (a - start))); + graphicsObject.DrawLine(whitePen, scrollbg.Left, scrollbg.Top - space * (a - start), scrollbg.Left + 10, scrollbg.Top - space * (a - start)); + drawstring(graphicsObject, a.ToString().PadLeft(5), font, fontsize, whiteBrush, scrollbg.Left + 7 + (int)(0 * fontoffset), scrollbg.Top - space * (a - start) - 6 - fontoffset); + } + } + + greenPen.Width = 4; + + // vsi + + graphicsObject.ResetTransform(); + + PointF[] poly = new PointF[4]; + + poly[0] = new PointF(scrollbg.Left, scrollbg.Top); + poly[1] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Top + scrollbg.Width / 4); + poly[2] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Bottom - scrollbg.Width / 4); + poly[3] = new PointF(scrollbg.Left, scrollbg.Bottom); + + //verticalspeed + + viewrange = 12; + + _verticalspeed = Math.Min(viewrange / 2, _verticalspeed); + _verticalspeed = Math.Max(viewrange / -2, _verticalspeed); + + float scaledvalue = _verticalspeed / -viewrange * (scrollbg.Bottom - scrollbg.Top); + + float linespace = (float)1 / -viewrange * (scrollbg.Bottom - scrollbg.Top); + + PointF[] polyn = new PointF[4]; + + polyn[0] = new PointF(scrollbg.Left, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2); + polyn[1] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2); + polyn[2] = polyn[1]; + float peak = 0; + if (scaledvalue > 0) + { + peak = -scrollbg.Width / 4; + if (scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue + peak < scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2) + peak = -scaledvalue; + } + else if (scaledvalue < 0) + { + peak = +scrollbg.Width / 4; + if (scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue + peak > scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2) + peak = -scaledvalue; + } + + polyn[2] = new PointF(scrollbg.Left - scrollbg.Width / 4, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue + peak); + polyn[3] = new PointF(scrollbg.Left, scrollbg.Top + (scrollbg.Bottom - scrollbg.Top) / 2 + scaledvalue); + + //graphicsObject.DrawPolygon(redPen, poly); + graphicsObject.FillPolygon(Brushes.Blue, polyn); + + // draw outsidebox + graphicsObject.DrawPolygon(whitePen, poly); + + for (int a = 1; a < viewrange; a++) + { + graphicsObject.DrawLine(whitePen, scrollbg.Left - scrollbg.Width / 4, scrollbg.Top - linespace * a, scrollbg.Left - scrollbg.Width / 8, scrollbg.Top - linespace * a); + } + + // draw arrow and text + + graphicsObject.ResetTransform(); + graphicsObject.TranslateTransform(this.Width, this.Height / 2); + graphicsObject.RotateTransform(180); + + graphicsObject.DrawPolygon(blackPen, arrow); + graphicsObject.FillPolygon(Brushes.Black, arrow); + graphicsObject.ResetTransform(); + graphicsObject.TranslateTransform(0, this.Height / 2); + + drawstring(graphicsObject, ((int)_alt).ToString("0"), font, 10, Brushes.AliceBlue, scrollbg.Left + 10, -9); + graphicsObject.ResetTransform(); + + // mode and wp dist and wp + + drawstring(graphicsObject, _mode, font, fontsize, whiteBrush, scrollbg.Left - 30, scrollbg.Bottom + 5); + drawstring(graphicsObject, (int)_disttowp + ">" + _wpno, font, fontsize, whiteBrush, scrollbg.Left - 30, scrollbg.Bottom + fontsize + 2 + 10); + + graphicsObject.DrawLine(greenPen, scrollbg.Left - 5, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20, scrollbg.Left - 5, scrollbg.Top - (int)(fontsize) - 2 - 20); + graphicsObject.DrawLine(greenPen, scrollbg.Left - 10, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 15, scrollbg.Left - 10, scrollbg.Top - (int)(fontsize) - 2 - 20); + graphicsObject.DrawLine(greenPen, scrollbg.Left - 15, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 10, scrollbg.Left - 15, scrollbg.Top - (int)(fontsize ) - 2 - 20); + + drawstring(graphicsObject, _linkqualitygcs.ToString("0") + "%", font, fontsize, whiteBrush, scrollbg.Left, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20); + if (_linkqualitygcs == 0) + { + graphicsObject.DrawLine(redPen, scrollbg.Left, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20, scrollbg.Left + 50, scrollbg.Top - (int)(fontsize * 2.2) - 2); + + graphicsObject.DrawLine(redPen, scrollbg.Left, scrollbg.Top - (int)(fontsize * 2.2) - 2, scrollbg.Left + 50, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20); + } + drawstring(graphicsObject, _datetime.ToString("HH:mm:ss"), font, fontsize, whiteBrush, scrollbg.Left - 20, scrollbg.Top - fontsize - 2 - 20); + + + // battery + + graphicsObject.ResetTransform(); + + drawstring(graphicsObject, "Bat", font, fontsize + 2, whiteBrush, fontsize, this.Height - 30 - fontoffset); + drawstring(graphicsObject, _batterylevel.ToString("0.00v"), font, fontsize + 2, whiteBrush, fontsize * 4, this.Height - 30 - fontoffset); + drawstring(graphicsObject, _batteryremaining.ToString("0%"), font, fontsize + 2, whiteBrush, fontsize * 9, this.Height - 30 - fontoffset); + + // gps + + string gps = ""; + + if (_gpsfix == 0) + { + gps = ("GPS: No GPS"); + } + else if (_gpsfix == 1) + { + gps = ("GPS: No Fix"); + } + else if (_gpsfix == 2) + { + gps = ("GPS: 3D Fix"); + } + else if (_gpsfix == 3) + { + gps = ("GPS: 3D Fix"); + } + + drawstring(graphicsObject, gps, font, fontsize + 2, whiteBrush, this.Width - 10 * fontsize, this.Height - 30 - fontoffset); + + + if (isNaN) + drawstring(graphicsObject, "NaN Error " + DateTime.Now, font, this.Height / 30 + 10, Brushes.Red, 50, 50); + + + if (!opengl) + { + e.Graphics.DrawImageUnscaled(objBitmap, 0, 0); + } + + if (DesignMode) + { + return; + } + + // Console.WriteLine("HUD 1 " + (DateTime.Now - starttime).TotalMilliseconds + " " + DateTime.Now.Millisecond); + + ImageCodecInfo ici = GetImageCodec("image/jpeg"); + EncoderParameters eps = new EncoderParameters(1); + eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 50L); // or whatever other quality value you want + + lock (streamlock) + { + if (streamjpgenable || streamjpg == null) // init image and only update when needed + { + if (opengl) + { + objBitmap = GrabScreenshot(); + } + streamjpg = new MemoryStream(); + objBitmap.Save(streamjpg, ici, eps); + //objBitmap.Save(streamjpg,ImageFormat.Bmp); + } + } + } + catch (Exception ex) + { + log.Info("hud error "+ex.ToString()); + } + } + + protected override void OnPaintBackground(PaintEventArgs e) + { + //base.OnPaintBackground(e); + } + + ImageCodecInfo GetImageCodec(string mimetype) + { + foreach (ImageCodecInfo ici in ImageCodecInfo.GetImageEncoders()) + { + if (ici.MimeType == mimetype) return ici; + } + return null; + } + + // Returns a System.Drawing.Bitmap with the contents of the current framebuffer + public new Bitmap GrabScreenshot() + { + if (GraphicsContext.CurrentContext == null) + throw new GraphicsContextMissingException(); + + Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height); + System.Drawing.Imaging.BitmapData data = + bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height,OpenTK.Graphics.OpenGL.PixelFormat.Bgr, PixelType.UnsignedByte, data.Scan0); + bmp.UnlockBits(data); + + bmp.RotateFlip(RotateFlipType.RotateNoneFlipY); + return bmp; + } + + + float wrap360(float noin) + { + if (noin < 0) + return noin + 360; + return noin; + } + + /// <summary> + /// pen for drawstring + /// </summary> + Pen P = new Pen(Color.FromArgb(0x26, 0x27, 0x28), 2f); + /// <summary> + /// pth for drawstring + /// </summary> + GraphicsPath pth = new GraphicsPath(); + + void drawstring(HUD e, string text, Font font, float fontsize, Brush brush, float x, float y) + { + if (!opengl) + { + drawstring(graphicsObjectGDIP, text, font, fontsize, brush, x, y); + return; + } + + if (text == null || text == "") + return; + /* + OpenTK.Graphics.Begin(); + GL.PushMatrix(); + GL.Translate(x, y, 0); + printer.Print(text, font, c); + GL.PopMatrix(); printer.End(); + */ + + char[] chars = text.ToCharArray(); + + float maxy = 1; + + foreach (char cha in chars) + { + int charno = (int)cha; + + int charid = charno + (128 * (int)fontsize); // 128 * 40 * 5;128 + + if (charbitmaps[charid] == null) + { + charbitmaps[charid] = new Bitmap(128, 128, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + + charbitmaps[charid].MakeTransparent(Color.Transparent); + + //charbitmaptexid + + float maxx = this.Width / 150; // for space + + + // create bitmap + using (Graphics gfx = Graphics.FromImage(charbitmaps[charid])) + { + pth.Reset(); + + if (text != null) + pth.AddString(cha + "", font.FontFamily, 0, fontsize + 5, new Point((int)0, (int)0), StringFormat.GenericTypographic); + + gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + + gfx.DrawPath(P, pth); + + //Draw the face + + gfx.FillPath(brush, pth); + + + if (pth.PointCount > 0) + { + foreach (PointF pnt in pth.PathPoints) + { + if (pnt.X > maxx) + maxx = pnt.X; + + if (pnt.Y > maxy) + maxy = pnt.Y; + } + } + } + + charwidth[charid] = (int)(maxx + 2); + + //charbitmaps[charid] = charbitmaps[charid].Clone(new RectangleF(0, 0, maxx + 2, maxy + 2), charbitmaps[charid].PixelFormat); + + //charbitmaps[charno * (int)fontsize].Save(charno + " " + (int)fontsize + ".png"); + + // create texture + int textureId; + GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvModeCombine.Replace);//Important, or wrong color on some computers + + Bitmap bitmap = charbitmaps[charid]; + GL.GenTextures(1, out textureId); + GL.BindTexture(TextureTarget.Texture2D, textureId); + + BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + + GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0); + + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); + + // GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Nearest); + //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Nearest); + GL.Finish(); + bitmap.UnlockBits(data); + + charbitmaptexid[charid] = textureId; + } + + //GL.Enable(EnableCap.Blend); + GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); + + GL.Enable(EnableCap.Texture2D); + GL.BindTexture(TextureTarget.Texture2D, charbitmaptexid[charid]); + + float scale = 1.0f; + + GL.Begin(BeginMode.Quads); + GL.TexCoord2(0, 0); GL.Vertex2(x, y); + GL.TexCoord2(1, 0); GL.Vertex2(x + charbitmaps[charid].Width * scale, y); + GL.TexCoord2(1, 1); GL.Vertex2(x + charbitmaps[charid].Width * scale, y + charbitmaps[charid].Height * scale); + GL.TexCoord2(0, 1); GL.Vertex2(x + 0, y + charbitmaps[charid].Height * scale); + GL.End(); + + //GL.Disable(EnableCap.Blend); + GL.Disable(EnableCap.Texture2D); + + x += charwidth[charid] * scale; + } + } + + void drawstring(Graphics e, string text, Font font, float fontsize, Brush brush, float x, float y) + { + if (text == null || text == "") + return; + + pth.Reset(); + + if (text != null) + pth.AddString(text, font.FontFamily, 0, fontsize + 5, new Point((int)x, (int)y), StringFormat.GenericTypographic); + + //Draw the edge + // this uses lots of cpu time + + //e.SmoothingMode = SmoothingMode.HighSpeed; + + if (e == null || P == null || pth == null || pth.PointCount == 0) + return; + + //if (!ArdupilotMega.MainV2.MONO) + e.DrawPath(P, pth); + + //Draw the face + + e.FillPath(brush, pth); + + //pth.Dispose(); + } + + protected override void OnHandleCreated(EventArgs e) + { + try + { + if (opengl) + { + base.OnHandleCreated(e); + } + } + catch (Exception ex) { log.Info(ex.ToString()); opengl = false; } // macs fail here + } + + protected override void OnHandleDestroyed(EventArgs e) + { + try + { + if (opengl) + { + base.OnHandleDestroyed(e); + } + } + catch (Exception ex) { log.Info(ex.ToString()); opengl = false; } + } + + protected override void OnResize(EventArgs e) + { + if (DesignMode || !started) + return; + + + if (SixteenXNine) + { + this.Height = (int)(this.Width / 1.777f); + } + else + { + // 4x3 + this.Height = (int)(this.Width / 1.333f); + } + + base.OnResize(e); + + graphicsObjectGDIP = Graphics.FromImage(objBitmap); + + charbitmaps = new Bitmap[charbitmaps.Length]; + + try + { + if (opengl) + { + foreach (int texid in charbitmaptexid) + { + if (texid != 0) + GL.DeleteTexture(texid); + } + } + } + catch { } + + GC.Collect(); + + try + { + if (opengl) + { + GL.MatrixMode(MatrixMode.Projection); + GL.LoadIdentity(); + GL.Ortho(0, Width, Height, 0, -1, 1); + GL.MatrixMode(MatrixMode.Modelview); + GL.LoadIdentity(); + + GL.Viewport(0, 0, Width, Height); + } + } + catch { } + + } + } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.Designer.cs index dfa1e43a2dd8d01a5c5d445b7d4cd2a49be40b74..fa42576c8c5f8a5146fd608ae204bc60e154d8f5 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.Designer.cs @@ -1,4 +1,4 @@ -namespace ArdupilotMega +namespace ArdupilotMega.Controls { partial class ImageLabel { diff --git a/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.cs b/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.cs index 2b16d6337d72d13bc10383adbbad3fcdc528afe8..1cd32b95c3fef2455cf35fe6186b1da00f0096ce 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/ImageLabel.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; -namespace ArdupilotMega +namespace ArdupilotMega.Controls { public partial class ImageLabel : UserControl //ContainerControl { diff --git a/Tools/ArdupilotMegaPlanner/Controls/LineSeparator.cs b/Tools/ArdupilotMegaPlanner/Controls/LineSeparator.cs index 9e9002a87557157c36075af36c3707c7924b9ca4..5c96aff3e4c3613f41bdf7e821040e3eb7438913 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/LineSeparator.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/LineSeparator.cs @@ -7,46 +7,45 @@ using System.Linq; using System.Text; using System.Windows.Forms; - -public partial class LineSeparator : UserControl +namespace ArdupilotMega.Controls { - - - - public LineSeparator() + public partial class LineSeparator : UserControl { - this.Height = 2; + public LineSeparator() + { + this.Height = 2; - this.Paint += new PaintEventHandler(LineSeparator_Paint); + this.Paint += new PaintEventHandler(LineSeparator_Paint); - this.MaximumSize = new Size(2000, 2); + this.MaximumSize = new Size(2000, 2); - this.MinimumSize = new Size(0, 2); + this.MinimumSize = new Size(0, 2); - //this.Width = 350; + //this.Width = 350; - } + } - private void LineSeparator_Paint(object sender, PaintEventArgs e) - { + private void LineSeparator_Paint(object sender, PaintEventArgs e) + { - Graphics g = e.Graphics; + Graphics g = e.Graphics; - g.DrawLine( + g.DrawLine( - Pens.DarkGray, new Point(0, 0), new Point(this.Width, 0)); + Pens.DarkGray, new Point(0, 0), new Point(this.Width, 0)); - g.DrawLine( + g.DrawLine( - Pens.White, new Point(0, 1), new Point(this.Width, 1)); + Pens.White, new Point(0, 1), new Point(this.Width, 1)); - } + } -} + } +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Controls/MyButton.cs b/Tools/ArdupilotMegaPlanner/Controls/MyButton.cs index 9faaeb84419e1c2a6f08f1bc8e81c0f533ab19d4..05167056455c79cadaa56315de9b12905af15cc8 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/MyButton.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/MyButton.cs @@ -10,7 +10,7 @@ using System.Windows.Forms; using System.Drawing.Drawing2D; -namespace ArdupilotMega +namespace ArdupilotMega.Controls { class MyButton : Button { diff --git a/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs b/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs index cc18c0b72358d8f5a099855472a94b2e90671ccc..b2a931d4bf344e53aed57fb61ef5ec3bcecf9989 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs @@ -7,10 +7,10 @@ using System.Linq; using System.Text; using System.Windows.Forms; -namespace ArdupilotMega +namespace ArdupilotMega.Controls { /// <summary> - /// profiling showed that the built in Label function was using alot ot call time. + /// profiling showed that the built in Label function was using alot of call time. /// </summary> public partial class MyLabel : Control //: Label { diff --git a/Tools/ArdupilotMegaPlanner/Controls/MyTrackBar.cs b/Tools/ArdupilotMegaPlanner/Controls/MyTrackBar.cs index 1e010c806b032da309596585658d71ddf95a545c..bf4536df0f31e99e27744d86f86b66595dd70812 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/MyTrackBar.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/MyTrackBar.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; -namespace ArdupilotMega +namespace ArdupilotMega.Controls { class MyTrackBar : TrackBar { diff --git a/Tools/ArdupilotMegaPlanner/Controls/MyUserControl.cs b/Tools/ArdupilotMegaPlanner/Controls/MyUserControl.cs index 0a7a76479355c6d666a28be965265c6b1816cb8f..58260f138be2b86002eeb8b145baebc6daef2efa 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/MyUserControl.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/MyUserControl.cs @@ -5,6 +5,9 @@ using System.Text; namespace System.Windows.Forms { + /// <summary> + /// This is a mono fix, windows handles this error, mono crashs + /// </summary> public class MyUserControl : System.Windows.Forms.UserControl { protected override void WndProc(ref Message m) diff --git a/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs b/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs index 683b995004cbd18497954209e8ae2b0e165fdba3..ff11f878deda7b3c4329ac4dbb89aec5e0f9ea06 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs @@ -5,8 +5,6 @@ using System.Windows.Forms; namespace ArdupilotMega.Controls { - - /// <summary> /// Form that is shown to the user during a background operation /// </summary> diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs deleted file mode 100644 index 2a14e1fe1f23560109de7669b4951eee32672c81..0000000000000000000000000000000000000000 --- a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs +++ /dev/null @@ -1,112 +0,0 @@ -namespace ArdupilotMega -{ - partial class XorPlus - { - /// <summary> - /// Required designer variable. - /// </summary> - private System.ComponentModel.IContainer components = null; - - /// <summary> - /// Clean up any resources being used. - /// </summary> - /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - private void InitializeComponent() - { - this.label16 = new System.Windows.Forms.Label(); - this.label15 = new System.Windows.Forms.Label(); - this.pictureBoxQuadX = new System.Windows.Forms.PictureBox(); - this.pictureBoxQuad = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit(); - this.SuspendLayout(); - // - // label16 - // - this.label16.AutoSize = true; - this.label16.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.label16.Location = new System.Drawing.Point(108, 211); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(192, 26); - this.label16.TabIndex = 11; - this.label16.Text = "NOTE: images are for presentation only\r\nwill work with hexa\'s etc"; - // - // label15 - // - this.label15.AutoSize = true; - this.label15.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.label15.Location = new System.Drawing.Point(151, 2); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(102, 13); - this.label15.TabIndex = 10; - this.label15.Text = "Frame Setup (+ or x)"; - // - // pictureBoxQuadX - // - this.pictureBoxQuadX.Cursor = System.Windows.Forms.Cursors.Hand; - this.pictureBoxQuadX.Image = global::ArdupilotMega.Properties.Resources.quadx; - this.pictureBoxQuadX.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.pictureBoxQuadX.Location = new System.Drawing.Point(210, 18); - this.pictureBoxQuadX.Name = "pictureBoxQuadX"; - this.pictureBoxQuadX.Size = new System.Drawing.Size(190, 190); - this.pictureBoxQuadX.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxQuadX.TabIndex = 9; - this.pictureBoxQuadX.TabStop = false; - this.pictureBoxQuadX.Click += new System.EventHandler(this.pictureBoxQuadX_Click); - // - // pictureBoxQuad - // - this.pictureBoxQuad.Cursor = System.Windows.Forms.Cursors.Hand; - this.pictureBoxQuad.Image = global::ArdupilotMega.Properties.Resources.quad; - this.pictureBoxQuad.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.pictureBoxQuad.Location = new System.Drawing.Point(3, 18); - this.pictureBoxQuad.Name = "pictureBoxQuad"; - this.pictureBoxQuad.Size = new System.Drawing.Size(190, 190); - this.pictureBoxQuad.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBoxQuad.TabIndex = 8; - this.pictureBoxQuad.TabStop = false; - this.pictureBoxQuad.Click += new System.EventHandler(this.pictureBoxQuad_Click); - // - // XorPlus - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(404, 242); - this.Controls.Add(this.label16); - this.Controls.Add(this.label15); - this.Controls.Add(this.pictureBoxQuadX); - this.Controls.Add(this.pictureBoxQuad); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "XorPlus"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Frame Type"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label16; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.PictureBox pictureBoxQuadX; - private System.Windows.Forms.PictureBox pictureBoxQuad; - } -} diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs deleted file mode 100644 index 98808fe43295b1b0227340bc98050f34562c5ba7..0000000000000000000000000000000000000000 --- a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace ArdupilotMega -{ - public partial class XorPlus : Form - { - public new event EventHandler Click; - - /// <summary> - /// either X or + - /// </summary> - public string frame = ""; - - public XorPlus() - { - InitializeComponent(); - } - - private void pictureBoxQuad_Click(object sender, EventArgs e) - { - frame = "+"; - if (Click != null) - { - Click(sender, new EventArgs()); - } - - this.Close(); - } - - private void pictureBoxQuadX_Click(object sender, EventArgs e) - { - frame = "X"; - if (Click != null) - { - Click(sender, new EventArgs()); - } - - this.Close(); - } - } -} diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx deleted file mode 100644 index 7080a7d118e8cd7ec668e9bb0d8e90767e0c7a3c..0000000000000000000000000000000000000000 --- a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx +++ /dev/null @@ -1,120 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" use="required" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> -</root> \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Controls/myGMAP.cs b/Tools/ArdupilotMegaPlanner/Controls/myGMAP.cs index 38e37a84be36ece4f7ab1f7f62ad892f863dcbf3..f24440fb59e4be8f816f5f2f3976efb01d4c6c43 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/myGMAP.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/myGMAP.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace ArdupilotMega +namespace ArdupilotMega.Controls { + /// <summary> + /// Mono handles calls from other thread difrently - this prevents those crashs + /// </summary> class myGMAP : GMap.NET.WindowsForms.GMapControl { public bool inOnPaint = false; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs index 50e01de71c5e89fe649bf489dc67d7702d2053b6..a9966cb926aa69fab7f1d16fbd4c6ac068cc9bdb 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs @@ -141,13 +141,13 @@ this.RLL2SRV_P = new System.Windows.Forms.NumericUpDown(); this.label52 = new System.Windows.Forms.Label(); this.TabAC = new System.Windows.Forms.TabPage(); - this.myLabel4 = new ArdupilotMega.MyLabel(); - this.myLabel3 = new ArdupilotMega.MyLabel(); + this.myLabel4 = new ArdupilotMega.Controls.MyLabel(); + this.myLabel3 = new ArdupilotMega.Controls.MyLabel(); this.TUNE_LOW = new System.Windows.Forms.NumericUpDown(); this.TUNE_HIGH = new System.Windows.Forms.NumericUpDown(); - this.myLabel2 = new ArdupilotMega.MyLabel(); + this.myLabel2 = new ArdupilotMega.Controls.MyLabel(); this.TUNE = new System.Windows.Forms.ComboBox(); - this.myLabel1 = new ArdupilotMega.MyLabel(); + this.myLabel1 = new ArdupilotMega.Controls.MyLabel(); this.CH7_OPT = new System.Windows.Forms.ComboBox(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.THR_RATE_D = new System.Windows.Forms.NumericUpDown(); @@ -276,17 +276,17 @@ this.CHK_hudshow = new System.Windows.Forms.CheckBox(); this.label92 = new System.Windows.Forms.Label(); this.CMB_videosources = new System.Windows.Forms.ComboBox(); - this.BUT_Joystick = new ArdupilotMega.MyButton(); - this.BUT_videostop = new ArdupilotMega.MyButton(); - this.BUT_videostart = new ArdupilotMega.MyButton(); + this.BUT_Joystick = new ArdupilotMega.Controls.MyButton(); + this.BUT_videostop = new ArdupilotMega.Controls.MyButton(); + this.BUT_videostart = new ArdupilotMega.Controls.MyButton(); this.TabSetup = new System.Windows.Forms.TabPage(); this.label109 = new System.Windows.Forms.Label(); - this.BUT_rerequestparams = new ArdupilotMega.MyButton(); - this.BUT_writePIDS = new ArdupilotMega.MyButton(); - this.BUT_save = new ArdupilotMega.MyButton(); - this.BUT_load = new ArdupilotMega.MyButton(); + this.BUT_rerequestparams = new ArdupilotMega.Controls.MyButton(); + this.BUT_writePIDS = new ArdupilotMega.Controls.MyButton(); + this.BUT_save = new ArdupilotMega.Controls.MyButton(); + this.BUT_load = new ArdupilotMega.Controls.MyButton(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.BUT_compare = new ArdupilotMega.MyButton(); + this.BUT_compare = new ArdupilotMega.Controls.MyButton(); this.groupBox17 = new System.Windows.Forms.GroupBox(); this.LOITER_LAT_D = new System.Windows.Forms.NumericUpDown(); this.label28 = new System.Windows.Forms.Label(); @@ -2333,10 +2333,10 @@ #endregion - private MyButton BUT_save; - private MyButton BUT_load; + private ArdupilotMega.Controls.MyButton BUT_save; + private ArdupilotMega.Controls.MyButton BUT_load; private System.Windows.Forms.DataGridView Params; - private MyButton BUT_writePIDS; + private ArdupilotMega.Controls.MyButton BUT_writePIDS; private System.Windows.Forms.TabControl ConfigTabs; private System.Windows.Forms.TabPage TabAP; private System.Windows.Forms.TabPage TabAC; @@ -2505,8 +2505,8 @@ private System.Windows.Forms.TabPage TabPlanner; private System.Windows.Forms.Label label92; private System.Windows.Forms.ComboBox CMB_videosources; - private MyButton BUT_videostop; - private MyButton BUT_videostart; + private ArdupilotMega.Controls.MyButton BUT_videostop; + private ArdupilotMega.Controls.MyButton BUT_videostart; private System.Windows.Forms.CheckBox CHK_hudshow; private System.Windows.Forms.CheckBox CHK_enablespeech; private System.Windows.Forms.ComboBox CMB_language; @@ -2516,9 +2516,9 @@ private System.Windows.Forms.CheckBox CHK_speechwaypoint; private System.Windows.Forms.CheckBox CHK_speechmode; private System.Windows.Forms.CheckBox CHK_speechcustom; - private MyButton BUT_rerequestparams; + private ArdupilotMega.Controls.MyButton BUT_rerequestparams; private System.Windows.Forms.CheckBox CHK_speechbattery; - private MyButton BUT_Joystick; + private ArdupilotMega.Controls.MyButton BUT_Joystick; private System.Windows.Forms.Label label96; private System.Windows.Forms.Label label95; private System.Windows.Forms.ComboBox CMB_speedunits; @@ -2553,7 +2553,7 @@ private System.Windows.Forms.DataGridViewTextBoxColumn Default; private System.Windows.Forms.DataGridViewTextBoxColumn mavScale; private System.Windows.Forms.DataGridViewTextBoxColumn RawValue; - private MyButton BUT_compare; + private ArdupilotMega.Controls.MyButton BUT_compare; private System.Windows.Forms.Label label12; private System.Windows.Forms.CheckBox CHK_GDIPlus; private System.Windows.Forms.GroupBox groupBox5; @@ -2566,9 +2566,9 @@ private System.Windows.Forms.Label label109; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label26; - private MyLabel myLabel1; + private ArdupilotMega.Controls.MyLabel myLabel1; private System.Windows.Forms.ComboBox CH7_OPT; - private MyLabel myLabel2; + private ArdupilotMega.Controls.MyLabel myLabel2; private System.Windows.Forms.ComboBox TUNE; private System.Windows.Forms.NumericUpDown RATE_YAW_D; private System.Windows.Forms.Label label10; @@ -2586,8 +2586,8 @@ private System.Windows.Forms.NumericUpDown TUNE_HIGH; private System.Windows.Forms.Label label33; private System.Windows.Forms.ComboBox CMB_ratesensors; - private MyLabel myLabel4; - private MyLabel myLabel3; + private ArdupilotMega.Controls.MyLabel myLabel4; + private ArdupilotMega.Controls.MyLabel myLabel3; private System.Windows.Forms.GroupBox groupBox17; private System.Windows.Forms.NumericUpDown LOITER_LAT_D; private System.Windows.Forms.Label label28; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs index fd5a942cdad3f0740f276a02db65d3f526070177..6d3ff562e174c6fd0a6f7277c167fefcdfc9dd37 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs @@ -13,6 +13,7 @@ using System.Globalization; using System.Threading; using DirectShowLib; using System.Runtime.InteropServices; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx index 7f73de58f983e67c8bbf8f6d25328a114f6bcba4..8aed12b21074b823c93f0497f64bd9cd0d9266d7 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx @@ -367,7 +367,7 @@ <value>myLabel2</value> </data> <data name=">>myLabel2.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel2.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -379,7 +379,7 @@ <value>myLabel4</value> </data> <data name=">>myLabel4.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel4.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -403,7 +403,7 @@ <value>myLabel3</value> </data> <data name=">>myLabel3.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel3.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -415,7 +415,7 @@ <value>myLabel1</value> </data> <data name=">>myLabel1.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel1.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -2341,7 +2341,7 @@ <value>BUT_Joystick</value> </data> <data name=">>BUT_Joystick.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_Joystick.Parent" xml:space="preserve"> <value>TabPlanner</value> @@ -2353,7 +2353,7 @@ <value>BUT_videostop</value> </data> <data name=">>BUT_videostop.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_videostop.Parent" xml:space="preserve"> <value>TabPlanner</value> @@ -2365,7 +2365,7 @@ <value>BUT_videostart</value> </data> <data name=">>BUT_videostart.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_videostart.Parent" xml:space="preserve"> <value>TabPlanner</value> @@ -5926,7 +5926,7 @@ <value>myLabel4</value> </data> <data name=">>myLabel4.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel4.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -5950,7 +5950,7 @@ <value>myLabel3</value> </data> <data name=">>myLabel3.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel3.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -6016,7 +6016,7 @@ <value>myLabel2</value> </data> <data name=">>myLabel2.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel2.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -6127,7 +6127,7 @@ <value>myLabel1</value> </data> <data name=">>myLabel1.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel1.Parent" xml:space="preserve"> <value>groupBox17</value> @@ -9018,7 +9018,7 @@ GDI+ = Enabled</value> <value>BUT_Joystick</value> </data> <data name=">>BUT_Joystick.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_Joystick.Parent" xml:space="preserve"> <value>TabPlanner</value> @@ -9045,7 +9045,7 @@ GDI+ = Enabled</value> <value>BUT_videostop</value> </data> <data name=">>BUT_videostop.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_videostop.Parent" xml:space="preserve"> <value>TabPlanner</value> @@ -9072,7 +9072,7 @@ GDI+ = Enabled</value> <value>BUT_videostart</value> </data> <data name=">>BUT_videostart.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_videostart.Parent" xml:space="preserve"> <value>TabPlanner</value> @@ -9120,7 +9120,7 @@ GDI+ = Enabled</value> <value>BUT_rerequestparams</value> </data> <data name=">>BUT_rerequestparams.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_rerequestparams.Parent" xml:space="preserve"> <value>$this</value> @@ -9153,7 +9153,7 @@ GDI+ = Enabled</value> <value>BUT_writePIDS</value> </data> <data name=">>BUT_writePIDS.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_writePIDS.Parent" xml:space="preserve"> <value>$this</value> @@ -9189,7 +9189,7 @@ GDI+ = Enabled</value> <value>BUT_save</value> </data> <data name=">>BUT_save.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_save.Parent" xml:space="preserve"> <value>$this</value> @@ -9225,7 +9225,7 @@ GDI+ = Enabled</value> <value>BUT_load</value> </data> <data name=">>BUT_load.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_load.Parent" xml:space="preserve"> <value>$this</value> @@ -9258,7 +9258,7 @@ GDI+ = Enabled</value> <value>BUT_compare</value> </data> <data name=">>BUT_compare.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4484.12593, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_compare.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.Designer.cs index e674259f9122277ee40051dc8c2cd82a0a7bb5bf..c3ddcee8a45682d0b0d110bd3b8fca365ca6d4fd 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.Designer.cs @@ -31,7 +31,7 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigAccelerometerCalibrationPlane)); this.label28 = new System.Windows.Forms.Label(); - this.BUT_levelplane = new ArdupilotMega.MyButton(); + this.BUT_levelplane = new ArdupilotMega.Controls.MyButton(); this.CHK_manuallevel = new System.Windows.Forms.CheckBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.label1 = new System.Windows.Forms.Label(); @@ -88,7 +88,7 @@ #endregion private System.Windows.Forms.Label label28; - private MyButton BUT_levelplane; + private ArdupilotMega.Controls.MyButton BUT_levelplane; private System.Windows.Forms.CheckBox CHK_manuallevel; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Label label1; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs index 6837cc9ce3c0c72a22e9bfaa76f38fec85e225b6..5c08a8ab7edc7a774bf628e48dc8612713f05243 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.resx index a4f7288080463d18d246ff455416ec247da02ced..062a6b34a52f2a97e161a4f3a44743722d8109ff 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.resx @@ -175,7 +175,7 @@ <value>BUT_levelplane</value> </data> <data name=">>BUT_levelplane.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4492.39671, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4492.39671, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_levelplane.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.Designer.cs index 823abeb9abc2931cf1ae80bd8672ef824582b4ef..b9e95dff5a79dce218f45f42acd59e15b0fefae4 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.Designer.cs @@ -33,7 +33,7 @@ this.label15 = new System.Windows.Forms.Label(); this.pictureBoxQuadX = new System.Windows.Forms.PictureBox(); this.pictureBoxQuad = new System.Windows.Forms.PictureBox(); - this.BUT_levelac2 = new ArdupilotMega.MyButton(); + this.BUT_levelac2 = new ArdupilotMega.Controls.MyButton(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); @@ -149,7 +149,7 @@ private System.Windows.Forms.Label label15; private System.Windows.Forms.PictureBox pictureBoxQuadX; private System.Windows.Forms.PictureBox pictureBoxQuad; - private MyButton BUT_levelac2; + private ArdupilotMega.Controls.MyButton BUT_levelac2; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox3; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs index 5da92ae68d61e27cfb4b013a6068ccea0a4b06d9..7cc693578def855ccd9faaeced9535691e6fc8f8 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.resx index fafc62b415747875244e6c12cc83371240d1de8d..d21598f126ca8e9ac66b973122878dd8dbbbdfca 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.resx @@ -250,7 +250,7 @@ <value>BUT_levelac2</value> </data> <data name=">>BUT_levelac2.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4496.35237, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4496.35237, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_levelac2.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs index a67ec30bdb6fc87700376076a3d6289b892c33b4..ec5d7ca2cf8a0bf66fe9c671e75f14e1abbe437e 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.Designer.cs @@ -30,12 +30,12 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigArducopter)); - this.myLabel3 = new ArdupilotMega.MyLabel(); + this.myLabel3 = new ArdupilotMega.Controls.MyLabel(); this.TUNE_LOW = new System.Windows.Forms.NumericUpDown(); this.TUNE_HIGH = new System.Windows.Forms.NumericUpDown(); - this.myLabel2 = new ArdupilotMega.MyLabel(); + this.myLabel2 = new ArdupilotMega.Controls.MyLabel(); this.TUNE = new System.Windows.Forms.ComboBox(); - this.myLabel1 = new ArdupilotMega.MyLabel(); + this.myLabel1 = new ArdupilotMega.Controls.MyLabel(); this.CH7_OPT = new System.Windows.Forms.ComboBox(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.THR_RATE_D = new System.Windows.Forms.NumericUpDown(); @@ -868,12 +868,12 @@ #endregion - private MyLabel myLabel3; + private ArdupilotMega.Controls.MyLabel myLabel3; private System.Windows.Forms.NumericUpDown TUNE_LOW; private System.Windows.Forms.NumericUpDown TUNE_HIGH; - private MyLabel myLabel2; + private ArdupilotMega.Controls.MyLabel myLabel2; private System.Windows.Forms.ComboBox TUNE; - private MyLabel myLabel1; + private ArdupilotMega.Controls.MyLabel myLabel1; private System.Windows.Forms.ComboBox CH7_OPT; private System.Windows.Forms.GroupBox groupBox5; private System.Windows.Forms.NumericUpDown THR_RATE_D; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs index 606a5f34d42c32dc19cd940e66647db38d0e4ac7..ce263e44ccd961fd4500fa6ed884b98f380a1c8e 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.cs @@ -8,6 +8,7 @@ using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; using System.Collections; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx index 1be2fe2b20058b2f6d19ea8def6842eb04f6d2b7..c404907f7dc5b1aab79b897794cef8b67a6419cd 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArducopter.resx @@ -135,7 +135,7 @@ <value>myLabel3</value> </data> <data name=">>myLabel3.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel3.Parent" xml:space="preserve"> <value>$this</value> @@ -201,7 +201,7 @@ <value>myLabel2</value> </data> <data name=">>myLabel2.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel2.Parent" xml:space="preserve"> <value>$this</value> @@ -312,7 +312,7 @@ <value>myLabel1</value> </data> <data name=">>myLabel1.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>myLabel1.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs index 34afb1dc4c35063fa6fffebe77091856f654c93d..11bbb4fb8e4bff14e627a966f14e1ab6ec98c7c8 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigArduplane.cs @@ -8,6 +8,7 @@ using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; using System.Collections; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs index d84fe9af39df8d0d32c21866fa1c9ecf778bf370..404f48b8449cb1ae9f8df1ab43b06cf6bd863e78 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigBatteryMonitoring.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs index ed3be8b2237a95313d34586f58633ed2f8204181..a9c3c3d3247cf7b19ed92af7835d8aa37b6abf89 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs @@ -59,7 +59,7 @@ this.CMB_fmode2 = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.CMB_fmode1 = new System.Windows.Forms.ComboBox(); - this.BUT_SaveModes = new ArdupilotMega.MyButton(); + this.BUT_SaveModes = new ArdupilotMega.Controls.MyButton(); ((System.ComponentModel.ISupportInitialize)(this.currentStateBindingSource)).BeginInit(); this.SuspendLayout(); // @@ -312,7 +312,7 @@ private System.Windows.Forms.ComboBox CMB_fmode2; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox CMB_fmode1; - private MyButton BUT_SaveModes; + private ArdupilotMega.Controls.MyButton BUT_SaveModes; private System.Windows.Forms.BindingSource currentStateBindingSource; } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs index a19aa5c2500a54af323687d2b671b89c0e228b31..3e89a13282bb453d12f5edb20be6db1adbfd50bf 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.cs @@ -8,6 +8,7 @@ using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; using ArdupilotMega.Utilities; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.resx index 7f2a0fb988e67c2f21b856f04036e1cc20582504..5fe9928d4b221a9fb9e6be0eaee6875dececd86e 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFlightModes.resx @@ -946,7 +946,7 @@ <value>BUT_SaveModes</value> </data> <data name=">>BUT_SaveModes.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_SaveModes.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs index e5a2e07eae8804d8d4759af95fd8128adb4c0ee8..dedab86cf263fb8b391bfb474cec5940c670e34b 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigHardwareOptions)); - this.BUT_MagCalibrationLive = new ArdupilotMega.MyButton(); + this.BUT_MagCalibrationLive = new ArdupilotMega.Controls.MyButton(); this.label27 = new System.Windows.Forms.Label(); this.CMB_sonartype = new System.Windows.Forms.ComboBox(); this.CHK_enableoptflow = new System.Windows.Forms.CheckBox(); @@ -43,7 +43,7 @@ this.pictureBox4 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.BUT_MagCalibrationLog = new ArdupilotMega.MyButton(); + this.BUT_MagCalibrationLog = new ArdupilotMega.Controls.MyButton(); this.CHK_autodec = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); @@ -202,7 +202,7 @@ #endregion - private MyButton BUT_MagCalibrationLive; + private ArdupilotMega.Controls.MyButton BUT_MagCalibrationLive; private System.Windows.Forms.Label label27; private System.Windows.Forms.ComboBox CMB_sonartype; private System.Windows.Forms.CheckBox CHK_enableoptflow; @@ -216,7 +216,7 @@ private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.PictureBox pictureBox1; - private MyButton BUT_MagCalibrationLog; + private ArdupilotMega.Controls.MyButton BUT_MagCalibrationLog; private System.Windows.Forms.CheckBox CHK_autodec; } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs index e804b8052970a685cd3300e166d5a325cb7bcb70..b9795fb111e3fe2ca0806b9f0247137c5d423f74 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx index b15fe2836a3805faf4f5ae2f2affb5ed313a2566..64dab98e71de3185c3e679bcd28e3a8891217565 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx @@ -139,7 +139,7 @@ <value>BUT_MagCalibrationLive</value> </data> <data name=">>BUT_MagCalibrationLive.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.32704, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.32704, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_MagCalibrationLive.Parent" xml:space="preserve"> <value>$this</value> @@ -526,7 +526,7 @@ <value>BUT_MagCalibrationLog</value> </data> <data name=">>BUT_MagCalibrationLog.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.32704, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.32704, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_MagCalibrationLog.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.Designer.cs index 3b6108454fd4a2ae5076634b44bc72db7cd0a511..2bd40512120e3665f29ab2482ea20c0acab0fb3b 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.Designer.cs @@ -71,9 +71,9 @@ this.CHK_hudshow = new System.Windows.Forms.CheckBox(); this.label92 = new System.Windows.Forms.Label(); this.CMB_videosources = new System.Windows.Forms.ComboBox(); - this.BUT_Joystick = new ArdupilotMega.MyButton(); - this.BUT_videostop = new ArdupilotMega.MyButton(); - this.BUT_videostart = new ArdupilotMega.MyButton(); + this.BUT_Joystick = new ArdupilotMega.Controls.MyButton(); + this.BUT_videostop = new ArdupilotMega.Controls.MyButton(); + this.BUT_videostart = new ArdupilotMega.Controls.MyButton(); ((System.ComponentModel.ISupportInitialize)(this.NUM_tracklength)).BeginInit(); this.SuspendLayout(); // @@ -512,8 +512,8 @@ private System.Windows.Forms.CheckBox CHK_hudshow; private System.Windows.Forms.Label label92; private System.Windows.Forms.ComboBox CMB_videosources; - private MyButton BUT_Joystick; - private MyButton BUT_videostop; - private MyButton BUT_videostart; + private ArdupilotMega.Controls.MyButton BUT_Joystick; + private ArdupilotMega.Controls.MyButton BUT_videostop; + private ArdupilotMega.Controls.MyButton BUT_videostart; } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.cs index 3e35ec89ce9d060608c6653ef628e6fc72182ff6..11e3e4a01ef93e7f1c544f2633454ea295970915 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.cs @@ -10,6 +10,7 @@ using System.Text; using System.Windows.Forms; using DirectShowLib; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.resx index 6e758040783b8ce005ca91e5ddca45cf3502c06d..8e15fbeacfbce438fcbbc35ad7480d9a862be90c 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigPlanner.resx @@ -1268,7 +1268,7 @@ <value>BUT_Joystick</value> </data> <data name=">>BUT_Joystick.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_Joystick.Parent" xml:space="preserve"> <value>$this</value> @@ -1295,7 +1295,7 @@ <value>BUT_videostop</value> </data> <data name=">>BUT_videostop.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_videostop.Parent" xml:space="preserve"> <value>$this</value> @@ -1322,7 +1322,7 @@ <value>BUT_videostart</value> </data> <data name=">>BUT_videostart.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_videostart.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.Designer.cs index f3e54cffe31d01144b2001ac5dcbe644f903340e..2ef80c22adfc1a19ae214c83d92df0280d3ad099 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.Designer.cs @@ -39,7 +39,7 @@ this.CHK_revch4 = new System.Windows.Forms.CheckBox(); this.CHK_revch2 = new System.Windows.Forms.CheckBox(); this.CHK_revch1 = new System.Windows.Forms.CheckBox(); - this.BUT_Calibrateradio = new ArdupilotMega.MyButton(); + this.BUT_Calibrateradio = new ArdupilotMega.Controls.MyButton(); this.BAR8 = new ArdupilotMega.HorizontalProgressBar2(); this.currentStateBindingSource = new System.Windows.Forms.BindingSource(this.components); this.BAR7 = new ArdupilotMega.HorizontalProgressBar2(); @@ -289,7 +289,7 @@ private System.Windows.Forms.CheckBox CHK_revch4; private System.Windows.Forms.CheckBox CHK_revch2; private System.Windows.Forms.CheckBox CHK_revch1; - private MyButton BUT_Calibrateradio; + private ArdupilotMega.Controls.MyButton BUT_Calibrateradio; private HorizontalProgressBar2 BAR8; private HorizontalProgressBar2 BAR7; private HorizontalProgressBar2 BAR6; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.cs index 91e6716fe9283c875a43b0715c416f1250124e2e..1cf26eacaff532b16ee1af4111f87c98feb77898 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.resx index f4c0f26f3b53c9d87c859e5fd9a61ac26872785c..55749712e8fce260345ae977ed2507625f344972 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRadioInput.resx @@ -403,7 +403,7 @@ <value>BUT_Calibrateradio</value> </data> <data name=">>BUT_Calibrateradio.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_Calibrateradio.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs index 389ce857b85ca17cbcb74bd9c73354e77b529bea..6b072f30bfaff4416f034dcc9f7e7b69f60639f0 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs @@ -32,11 +32,11 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigRawParams)); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - this.BUT_compare = new ArdupilotMega.MyButton(); - this.BUT_rerequestparams = new ArdupilotMega.MyButton(); - this.BUT_writePIDS = new ArdupilotMega.MyButton(); - this.BUT_save = new ArdupilotMega.MyButton(); - this.BUT_load = new ArdupilotMega.MyButton(); + this.BUT_compare = new ArdupilotMega.Controls.MyButton(); + this.BUT_rerequestparams = new ArdupilotMega.Controls.MyButton(); + this.BUT_writePIDS = new ArdupilotMega.Controls.MyButton(); + this.BUT_save = new ArdupilotMega.Controls.MyButton(); + this.BUT_load = new ArdupilotMega.Controls.MyButton(); this.Params = new System.Windows.Forms.DataGridView(); this.Command = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -159,11 +159,11 @@ #endregion - private MyButton BUT_compare; - private MyButton BUT_rerequestparams; - private MyButton BUT_writePIDS; - private MyButton BUT_save; - private MyButton BUT_load; + private ArdupilotMega.Controls.MyButton BUT_compare; + private ArdupilotMega.Controls.MyButton BUT_rerequestparams; + private ArdupilotMega.Controls.MyButton BUT_writePIDS; + private ArdupilotMega.Controls.MyButton BUT_save; + private ArdupilotMega.Controls.MyButton BUT_load; private System.Windows.Forms.DataGridView Params; private System.Windows.Forms.DataGridViewTextBoxColumn Command; private System.Windows.Forms.DataGridViewTextBoxColumn Value; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.cs index a131ea1b176dc97d0eb90c8033416532b542b548..a831f31c1b947711b63a566994c1901699ac0017 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.cs @@ -10,6 +10,7 @@ using System.Text; using System.Windows.Forms; using log4net; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.resx index 3a3f70f56576d95fdc68402cf8cfe3deb1f8e21a..e4bef97a511c08cab81cb316cf174b045261fd5c 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigRawParams.resx @@ -142,7 +142,7 @@ <value>BUT_compare</value> </data> <data name=">>BUT_compare.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_compare.Parent" xml:space="preserve"> <value>$this</value> @@ -172,7 +172,7 @@ <value>BUT_rerequestparams</value> </data> <data name=">>BUT_rerequestparams.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_rerequestparams.Parent" xml:space="preserve"> <value>$this</value> @@ -202,7 +202,7 @@ <value>BUT_writePIDS</value> </data> <data name=">>BUT_writePIDS.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_writePIDS.Parent" xml:space="preserve"> <value>$this</value> @@ -235,7 +235,7 @@ <value>BUT_save</value> </data> <data name=">>BUT_save.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_save.Parent" xml:space="preserve"> <value>$this</value> @@ -268,7 +268,7 @@ <value>BUT_load</value> </data> <data name=">>BUT_load.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4491.33622, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_load.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.Designer.cs index 211699c119821a2f9f4c7b13feffdf1f7c09ed5b..7a4c66226423117a8bd97b571ac1a6dbf18d68a2 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.Designer.cs @@ -33,20 +33,20 @@ this.groupBox5 = new System.Windows.Forms.GroupBox(); this.H_SWASH_TYPE = new System.Windows.Forms.RadioButton(); this.CCPM = new System.Windows.Forms.RadioButton(); - this.BUT_swash_manual = new ArdupilotMega.MyButton(); + this.BUT_swash_manual = new ArdupilotMega.Controls.MyButton(); this.label41 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.label46 = new System.Windows.Forms.Label(); this.label45 = new System.Windows.Forms.Label(); this.H_GYR_ENABLE = new System.Windows.Forms.CheckBox(); this.H_GYR_GAIN = new System.Windows.Forms.TextBox(); - this.BUT_HS4save = new ArdupilotMega.MyButton(); + this.BUT_HS4save = new ArdupilotMega.Controls.MyButton(); this.label21 = new System.Windows.Forms.Label(); this.H_COL_MIN = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.H_COL_MID = new System.Windows.Forms.TextBox(); this.H_COL_MAX = new System.Windows.Forms.TextBox(); - this.BUT_0collective = new ArdupilotMega.MyButton(); + this.BUT_0collective = new ArdupilotMega.Controls.MyButton(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.label24 = new System.Windows.Forms.Label(); this.HS4_MIN = new System.Windows.Forms.TextBox(); @@ -709,20 +709,20 @@ private System.Windows.Forms.GroupBox groupBox5; private System.Windows.Forms.RadioButton H_SWASH_TYPE; private System.Windows.Forms.RadioButton CCPM; - private MyButton BUT_swash_manual; + private ArdupilotMega.Controls.MyButton BUT_swash_manual; private System.Windows.Forms.Label label41; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.Label label46; private System.Windows.Forms.Label label45; private System.Windows.Forms.CheckBox H_GYR_ENABLE; private System.Windows.Forms.TextBox H_GYR_GAIN; - private MyButton BUT_HS4save; + private ArdupilotMega.Controls.MyButton BUT_HS4save; private System.Windows.Forms.Label label21; private System.Windows.Forms.TextBox H_COL_MIN; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.TextBox H_COL_MID; private System.Windows.Forms.TextBox H_COL_MAX; - private MyButton BUT_0collective; + private ArdupilotMega.Controls.MyButton BUT_0collective; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.Label label24; private System.Windows.Forms.TextBox HS4_MIN; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.cs index c4d3effe1d9b238b79f19754dbda457af4d2369f..6f99332ff1f3bd37ec7dab6d4667f9e3f92d7ac0 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Controls; namespace ArdupilotMega.GCSViews.ConfigurationView { @@ -428,7 +429,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } if (control[0].GetType() == typeof(MyTrackBar)) { - MyTrackBar temp = (MyTrackBar)control[0]; + ArdupilotMega.Controls.MyTrackBar temp = (MyTrackBar)control[0]; string option = MainV2.comPort.param[value].ToString(); temp.Value = int.Parse(option); } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.resx index 133ab792d2369e92796645e02238adf9f45c00ad..56cc3b35a7a04102678621b11aac4a9085291b49 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigTradHeli.resx @@ -217,7 +217,7 @@ <value>BUT_swash_manual</value> </data> <data name=">>BUT_swash_manual.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.24488, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.24488, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_swash_manual.Parent" xml:space="preserve"> <value>$this</value> @@ -409,7 +409,7 @@ <value>BUT_HS4save</value> </data> <data name=">>BUT_HS4save.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.24488, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.24488, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_HS4save.Parent" xml:space="preserve"> <value>$this</value> @@ -550,7 +550,7 @@ <value>BUT_0collective</value> </data> <data name=">>BUT_0collective.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.24488, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.24488, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_0collective.Parent" xml:space="preserve"> <value>groupBox1</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Configuration.cs index 780efaf1c5c7c24b5b3085ae4126b02809e8a350..60cc50f7b972196fb95627c1100f937b78143559 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Configuration.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Configuration.cs @@ -20,7 +20,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigFlightModes(), "Flight Modes")); this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigHardwareOptions(), "Hardware Options")); this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigBatteryMonitoring(), "Battery Monitor")); - this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "Level Calibration")); + this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter")); + this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduPlane")); this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArducopter(), "Arducopter Setup")); this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArduplane(), "Arduplane Setup")); this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigTradHeli(), "Heli Setup")); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs index fbd2dcbc8312fd682dc5c02966ddfddf2b4bd67a..9b13408161b19e9a611731745fa613333391b685 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs @@ -24,6 +24,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduPlane Level")); this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigTradHeli(), "Heli Setup")); + this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRawParams(), "Raw params (Advanced)")); + this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ArdupilotMega._3DRradio(), "3DR Radio")); this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ArdupilotMega.Antenna.Tracker(), "Antenna Tracker")); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.Designer.cs index fa56951ee98672e185197c7e5ab6421c128665b2..8dd5014360c78f32c35b3d3b1238b5d9f712bfbd 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.Designer.cs @@ -36,43 +36,43 @@ namespace ArdupilotMega.GCSViews } - private ImageLabel pictureBoxAPM; - private ImageLabel pictureBoxQuad; - private ImageLabel pictureBoxHexa; - private ImageLabel pictureBoxTri; - private ImageLabel pictureBoxY6; + private ArdupilotMega.Controls.ImageLabel pictureBoxAPM; + private ArdupilotMega.Controls.ImageLabel pictureBoxQuad; + private ArdupilotMega.Controls.ImageLabel pictureBoxHexa; + private ArdupilotMega.Controls.ImageLabel pictureBoxTri; + private ArdupilotMega.Controls.ImageLabel pictureBoxY6; private System.Windows.Forms.Label lbl_status; private System.Windows.Forms.ProgressBar progress; private System.Windows.Forms.Label label2; - private ImageLabel pictureBoxHeli; - private MyButton BUT_setup; + private ArdupilotMega.Controls.ImageLabel pictureBoxHeli; + private ArdupilotMega.Controls.MyButton BUT_setup; private PictureBox pictureBoxHilimage; private PictureBox pictureBoxAPHil; private PictureBox pictureBoxACHil; private PictureBox pictureBoxACHHil; - private ImageLabel pictureBoxOcta; + private ArdupilotMega.Controls.ImageLabel pictureBoxOcta; private Label label1; - private ImageLabel pictureBoxOctav; + private ArdupilotMega.Controls.ImageLabel pictureBoxOctav; private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Firmware)); - this.pictureBoxAPM = new ArdupilotMega.ImageLabel(); - this.pictureBoxQuad = new ArdupilotMega.ImageLabel(); - this.pictureBoxHexa = new ArdupilotMega.ImageLabel(); - this.pictureBoxTri = new ArdupilotMega.ImageLabel(); - this.pictureBoxY6 = new ArdupilotMega.ImageLabel(); + this.pictureBoxAPM = new ArdupilotMega.Controls.ImageLabel(); + this.pictureBoxQuad = new ArdupilotMega.Controls.ImageLabel(); + this.pictureBoxHexa = new ArdupilotMega.Controls.ImageLabel(); + this.pictureBoxTri = new ArdupilotMega.Controls.ImageLabel(); + this.pictureBoxY6 = new ArdupilotMega.Controls.ImageLabel(); this.lbl_status = new System.Windows.Forms.Label(); this.progress = new System.Windows.Forms.ProgressBar(); this.label2 = new System.Windows.Forms.Label(); - this.pictureBoxHeli = new ArdupilotMega.ImageLabel(); - this.BUT_setup = new ArdupilotMega.MyButton(); + this.pictureBoxHeli = new ArdupilotMega.Controls.ImageLabel(); + this.BUT_setup = new ArdupilotMega.Controls.MyButton(); this.pictureBoxHilimage = new System.Windows.Forms.PictureBox(); this.pictureBoxAPHil = new System.Windows.Forms.PictureBox(); this.pictureBoxACHil = new System.Windows.Forms.PictureBox(); this.pictureBoxACHHil = new System.Windows.Forms.PictureBox(); - this.pictureBoxOcta = new ArdupilotMega.ImageLabel(); - this.pictureBoxOctav = new ArdupilotMega.ImageLabel(); + this.pictureBoxOcta = new ArdupilotMega.Controls.ImageLabel(); + this.pictureBoxOctav = new ArdupilotMega.Controls.ImageLabel(); this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxHilimage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAPHil)).BeginInit(); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index 8971889c8b46a70669800e3c399041ce9925246b..cc696b67458aec0c943a52f81616c7146f11abe9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -7,6 +7,7 @@ using System.IO; using System.Xml; using System.Net; using log4net; +using ArdupilotMega.Arduino; namespace ArdupilotMega.GCSViews { @@ -223,42 +224,6 @@ namespace ArdupilotMega.GCSViews } return; } - else if (items.Count == 2 && false) - { - XorPlus select = new XorPlus(); - ThemeManager.ApplyThemeTo(select); - select.ShowDialog(); - int a = 0; - - if (select.frame == "") - { - return; - } - - foreach (software temp in items) - { - if (select.frame == "+" && temp.name.Contains("Plus")) - { - DialogResult dr = CustomMessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo); - if (dr == System.Windows.Forms.DialogResult.Yes) - { - update(items[a]); - return; - } - } - else if (select.frame == "X" && temp.name.Contains("X")) - { - DialogResult dr = CustomMessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo); - if (dr == System.Windows.Forms.DialogResult.Yes) - { - update(items[a]); - return; - } - } - - a++; - } - } else { CustomMessageBox.Show("Something has gone wrong, to many firmware choices"); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx index 2f436fe289735ef3f1ead5b9554c57a6591c0796..be5eb92e015ff0e6025fd8b0cfd6afb181d3d2c9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.resx @@ -367,7 +367,7 @@ <value>BUT_setup</value> </data> <data name=">>BUT_setup.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_setup.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs index 9b17adaae6ec509450d5592361e9404bb3a49a43..87435b07aac85a2813363336a4c4802e172f89f3 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs @@ -15,28 +15,28 @@ this.pointCameraHereToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MainH = new System.Windows.Forms.SplitContainer(); this.SubMainLeft = new System.Windows.Forms.SplitContainer(); - this.hud1 = new hud.HUD(); + this.hud1 = new ArdupilotMega.Controls.HUD(); this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); this.recordHudToAVIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.stopRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabActions = new System.Windows.Forms.TabPage(); - this.BUT_script = new ArdupilotMega.MyButton(); - this.BUT_joystick = new ArdupilotMega.MyButton(); - this.BUT_quickmanual = new ArdupilotMega.MyButton(); - this.BUT_quickrtl = new ArdupilotMega.MyButton(); - this.BUT_quickauto = new ArdupilotMega.MyButton(); + this.BUT_script = new ArdupilotMega.Controls.MyButton(); + this.BUT_joystick = new ArdupilotMega.Controls.MyButton(); + this.BUT_quickmanual = new ArdupilotMega.Controls.MyButton(); + this.BUT_quickrtl = new ArdupilotMega.Controls.MyButton(); + this.BUT_quickauto = new ArdupilotMega.Controls.MyButton(); this.CMB_setwp = new System.Windows.Forms.ComboBox(); - this.BUT_setwp = new ArdupilotMega.MyButton(); + this.BUT_setwp = new ArdupilotMega.Controls.MyButton(); this.CMB_modes = new System.Windows.Forms.ComboBox(); - this.BUT_setmode = new ArdupilotMega.MyButton(); - this.BUT_clear_track = new ArdupilotMega.MyButton(); + this.BUT_setmode = new ArdupilotMega.Controls.MyButton(); + this.BUT_clear_track = new ArdupilotMega.Controls.MyButton(); this.CMB_action = new System.Windows.Forms.ComboBox(); - this.BUT_Homealt = new ArdupilotMega.MyButton(); - this.BUT_RAWSensor = new ArdupilotMega.MyButton(); - this.BUTrestartmission = new ArdupilotMega.MyButton(); - this.BUTactiondo = new ArdupilotMega.MyButton(); + this.BUT_Homealt = new ArdupilotMega.Controls.MyButton(); + this.BUT_RAWSensor = new ArdupilotMega.Controls.MyButton(); + this.BUTrestartmission = new ArdupilotMega.Controls.MyButton(); + this.BUTactiondo = new ArdupilotMega.Controls.MyButton(); this.tabGauges = new System.Windows.Forms.TabPage(); this.Gvspeed = new AGaugeApp.AGauge(); this.Gheading = new AGaugeApp.AGauge(); @@ -44,33 +44,33 @@ this.Gspeed = new AGaugeApp.AGauge(); this.tabStatus = new System.Windows.Forms.TabPage(); this.tabTLogs = new System.Windows.Forms.TabPage(); - this.lbl_logpercent = new ArdupilotMega.MyLabel(); + this.lbl_logpercent = new ArdupilotMega.Controls.MyLabel(); this.NUM_playbackspeed = new System.Windows.Forms.NumericUpDown(); - this.BUT_log2kml = new ArdupilotMega.MyButton(); + this.BUT_log2kml = new ArdupilotMega.Controls.MyButton(); this.tracklog = new System.Windows.Forms.TrackBar(); - this.BUT_playlog = new ArdupilotMega.MyButton(); - this.BUT_loadtelem = new ArdupilotMega.MyButton(); + this.BUT_playlog = new ArdupilotMega.Controls.MyButton(); + this.BUT_loadtelem = new ArdupilotMega.Controls.MyButton(); this.tableMap = new System.Windows.Forms.TableLayoutPanel(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.zg1 = new ZedGraph.ZedGraphControl(); - this.lbl_hdop = new ArdupilotMega.MyLabel(); - this.lbl_sats = new ArdupilotMega.MyLabel(); - this.lbl_winddir = new ArdupilotMega.MyLabel(); - this.lbl_windvel = new ArdupilotMega.MyLabel(); - this.gMapControl1 = new ArdupilotMega.myGMAP(); + this.lbl_hdop = new ArdupilotMega.Controls.MyLabel(); + this.lbl_sats = new ArdupilotMega.Controls.MyLabel(); + this.lbl_winddir = new ArdupilotMega.Controls.MyLabel(); + this.lbl_windvel = new ArdupilotMega.Controls.MyLabel(); + this.gMapControl1 = new ArdupilotMega.Controls.myGMAP(); this.panel1 = new System.Windows.Forms.Panel(); - this.TXT_lat = new ArdupilotMega.MyLabel(); + this.TXT_lat = new ArdupilotMega.Controls.MyLabel(); this.Zoomlevel = new System.Windows.Forms.NumericUpDown(); - this.label1 = new ArdupilotMega.MyLabel(); - this.TXT_long = new ArdupilotMega.MyLabel(); - this.TXT_alt = new ArdupilotMega.MyLabel(); + this.label1 = new ArdupilotMega.Controls.MyLabel(); + this.TXT_long = new ArdupilotMega.Controls.MyLabel(); + this.TXT_alt = new ArdupilotMega.Controls.MyLabel(); this.CHK_autopan = new System.Windows.Forms.CheckBox(); this.CB_tuning = new System.Windows.Forms.CheckBox(); this.dataGridViewImageColumn1 = new System.Windows.Forms.DataGridViewImageColumn(); this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn(); this.ZedGraphTimer = new System.Windows.Forms.Timer(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.label6 = new ArdupilotMega.MyLabel(); + this.label6 = new ArdupilotMega.Controls.MyLabel(); this.contextMenuStrip1.SuspendLayout(); this.MainH.Panel1.SuspendLayout(); this.MainH.Panel2.SuspendLayout(); @@ -1311,37 +1311,37 @@ private System.Windows.Forms.DataGridViewImageColumn dataGridViewImageColumn1; private System.Windows.Forms.DataGridViewImageColumn dataGridViewImageColumn2; - private ArdupilotMega.MyLabel label6; + private ArdupilotMega.Controls.MyLabel label6; private System.Windows.Forms.BindingSource bindingSource1; private System.Windows.Forms.Timer ZedGraphTimer; private System.Windows.Forms.SplitContainer MainH; private System.Windows.Forms.SplitContainer SubMainLeft; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem goHereToolStripMenuItem; - private hud.HUD hud1; - private MyButton BUT_clear_track; + private ArdupilotMega.Controls.HUD hud1; + private ArdupilotMega.Controls.MyButton BUT_clear_track; private System.Windows.Forms.CheckBox CB_tuning; - private MyButton BUT_RAWSensor; - private MyButton BUTactiondo; - private MyButton BUTrestartmission; + private ArdupilotMega.Controls.MyButton BUT_RAWSensor; + private ArdupilotMega.Controls.MyButton BUTactiondo; + private ArdupilotMega.Controls.MyButton BUTrestartmission; private System.Windows.Forms.ComboBox CMB_action; - private MyButton BUT_Homealt; + private ArdupilotMega.Controls.MyButton BUT_Homealt; private System.Windows.Forms.TrackBar tracklog; - private MyButton BUT_playlog; - private MyButton BUT_loadtelem; + private ArdupilotMega.Controls.MyButton BUT_playlog; + private ArdupilotMega.Controls.MyButton BUT_loadtelem; private AGaugeApp.AGauge Gheading; private AGaugeApp.AGauge Galt; private AGaugeApp.AGauge Gspeed; private AGaugeApp.AGauge Gvspeed; private System.Windows.Forms.TableLayoutPanel tableMap; private System.Windows.Forms.Panel panel1; - private ArdupilotMega.MyLabel TXT_lat; + private ArdupilotMega.Controls.MyLabel TXT_lat; private System.Windows.Forms.NumericUpDown Zoomlevel; - private ArdupilotMega.MyLabel label1; - private ArdupilotMega.MyLabel TXT_long; - private ArdupilotMega.MyLabel TXT_alt; + private ArdupilotMega.Controls.MyLabel label1; + private ArdupilotMega.Controls.MyLabel TXT_long; + private ArdupilotMega.Controls.MyLabel TXT_alt; private System.Windows.Forms.CheckBox CHK_autopan; - private myGMAP gMapControl1; + private ArdupilotMega.Controls.myGMAP gMapControl1; private ZedGraph.ZedGraphControl zg1; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabGauges; @@ -1349,26 +1349,26 @@ private System.Windows.Forms.TabPage tabActions; private System.Windows.Forms.TabPage tabTLogs; private System.Windows.Forms.ComboBox CMB_modes; - private MyButton BUT_setmode; + private ArdupilotMega.Controls.MyButton BUT_setmode; private System.Windows.Forms.ComboBox CMB_setwp; - private MyButton BUT_setwp; - private MyButton BUT_quickmanual; - private MyButton BUT_quickrtl; - private MyButton BUT_quickauto; - private MyButton BUT_log2kml; - private ArdupilotMega.MyLabel lbl_windvel; - private ArdupilotMega.MyLabel lbl_winddir; - private MyButton BUT_joystick; + private ArdupilotMega.Controls.MyButton BUT_setwp; + private ArdupilotMega.Controls.MyButton BUT_quickmanual; + private ArdupilotMega.Controls.MyButton BUT_quickrtl; + private ArdupilotMega.Controls.MyButton BUT_quickauto; + private ArdupilotMega.Controls.MyButton BUT_log2kml; + private ArdupilotMega.Controls.MyLabel lbl_windvel; + private ArdupilotMega.Controls.MyLabel lbl_winddir; + private ArdupilotMega.Controls.MyButton BUT_joystick; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.NumericUpDown NUM_playbackspeed; private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; private System.Windows.Forms.ToolStripMenuItem recordHudToAVIToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem stopRecordToolStripMenuItem; - private MyLabel lbl_logpercent; + private ArdupilotMega.Controls.MyLabel lbl_logpercent; private System.Windows.Forms.ToolStripMenuItem pointCameraHereToolStripMenuItem; private System.Windows.Forms.SplitContainer splitContainer1; - private MyButton BUT_script; - private MyLabel lbl_hdop; - private MyLabel lbl_sats; + private ArdupilotMega.Controls.MyButton BUT_script; + private ArdupilotMega.Controls.MyLabel lbl_hdop; + private ArdupilotMega.Controls.MyLabel lbl_sats; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs index 11e610087c4d6991d9bd0eb0f2d2a10c7d3e3b9f..da690be4532422a5dd34d00a441c482552bb8970 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs @@ -16,6 +16,8 @@ using System.Globalization; // language using GMap.NET.WindowsForms.Markers; using ZedGraph; // Graphs using System.Drawing.Drawing2D; +using ArdupilotMega.Controls; +using ArdupilotMega.Utilities; // written by michael oborne namespace ArdupilotMega.GCSViews @@ -71,7 +73,7 @@ namespace ArdupilotMega.GCSViews const float deg2rad = (float)(1.0 / rad2deg); - public static hud.HUD myhud = null; + public static ArdupilotMega.Controls.HUD myhud = null; public static GMapControl mymap = null; bool playingLog = false; @@ -1224,7 +1226,9 @@ namespace ArdupilotMega.GCSViews private void CMB_modes_Click(object sender, EventArgs e) { - CMB_modes.DataSource = Enum.GetNames(Common.getModes()); + CMB_modes.DataSource = Common.getModesList(); + CMB_modes.ValueMember = "Key"; + CMB_modes.DisplayMember = "Value"; } private void hud1_DoubleClick(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx index 2cbf5522e0f3730313d7b488687fbfd45a076aa7..8921faf5e3eae682cc3aabc2c405d38cd73367aa 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx @@ -208,7 +208,7 @@ <value>hud1</value> </data> <data name=">>hud1.Type" xml:space="preserve"> - <value>hud.HUD, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>hud.HUD, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>hud1.Parent" xml:space="preserve"> <value>SubMainLeft.Panel1</value> @@ -247,7 +247,7 @@ <value>BUT_script</value> </data> <data name=">>BUT_script.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_script.Parent" xml:space="preserve"> <value>tabActions</value> @@ -280,7 +280,7 @@ <value>BUT_joystick</value> </data> <data name=">>BUT_joystick.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_joystick.Parent" xml:space="preserve"> <value>tabActions</value> @@ -310,7 +310,7 @@ <value>BUT_quickmanual</value> </data> <data name=">>BUT_quickmanual.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickmanual.Parent" xml:space="preserve"> <value>tabActions</value> @@ -340,7 +340,7 @@ <value>BUT_quickrtl</value> </data> <data name=">>BUT_quickrtl.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickrtl.Parent" xml:space="preserve"> <value>tabActions</value> @@ -370,7 +370,7 @@ <value>BUT_quickauto</value> </data> <data name=">>BUT_quickauto.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickauto.Parent" xml:space="preserve"> <value>tabActions</value> @@ -424,7 +424,7 @@ <value>BUT_setwp</value> </data> <data name=">>BUT_setwp.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_setwp.Parent" xml:space="preserve"> <value>tabActions</value> @@ -475,7 +475,7 @@ <value>BUT_setmode</value> </data> <data name=">>BUT_setmode.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_setmode.Parent" xml:space="preserve"> <value>tabActions</value> @@ -505,7 +505,7 @@ <value>BUT_clear_track</value> </data> <data name=">>BUT_clear_track.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_clear_track.Parent" xml:space="preserve"> <value>tabActions</value> @@ -556,7 +556,7 @@ <value>BUT_Homealt</value> </data> <data name=">>BUT_Homealt.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_Homealt.Parent" xml:space="preserve"> <value>tabActions</value> @@ -586,7 +586,7 @@ <value>BUT_RAWSensor</value> </data> <data name=">>BUT_RAWSensor.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_RAWSensor.Parent" xml:space="preserve"> <value>tabActions</value> @@ -616,7 +616,7 @@ <value>BUTrestartmission</value> </data> <data name=">>BUTrestartmission.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUTrestartmission.Parent" xml:space="preserve"> <value>tabActions</value> @@ -646,7 +646,7 @@ <value>BUTactiondo</value> </data> <data name=">>BUTactiondo.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUTactiondo.Parent" xml:space="preserve"> <value>tabActions</value> @@ -700,7 +700,7 @@ <value>Gvspeed</value> </data> <data name=">>Gvspeed.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gvspeed.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -730,7 +730,7 @@ <value>Gheading</value> </data> <data name=">>Gheading.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gheading.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -760,7 +760,7 @@ <value>Galt</value> </data> <data name=">>Galt.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Galt.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -793,7 +793,7 @@ <value>Gspeed</value> </data> <data name=">>Gspeed.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gspeed.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -874,7 +874,7 @@ <value>lbl_logpercent</value> </data> <data name=">>lbl_logpercent.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_logpercent.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -925,7 +925,7 @@ <value>BUT_log2kml</value> </data> <data name=">>BUT_log2kml.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_log2kml.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -976,7 +976,7 @@ <value>BUT_playlog</value> </data> <data name=">>BUT_playlog.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_playlog.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1003,7 +1003,7 @@ <value>BUT_loadtelem</value> </data> <data name=">>BUT_loadtelem.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_loadtelem.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1192,7 +1192,7 @@ <value>lbl_hdop</value> </data> <data name=">>lbl_hdop.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_hdop.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1225,7 +1225,7 @@ <value>lbl_sats</value> </data> <data name=">>lbl_sats.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_sats.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1255,7 +1255,7 @@ <value>lbl_winddir</value> </data> <data name=">>lbl_winddir.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_winddir.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1285,7 +1285,7 @@ <value>lbl_windvel</value> </data> <data name=">>lbl_windvel.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_windvel.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1457,7 +1457,7 @@ <value>gMapControl1</value> </data> <data name=">>gMapControl1.Type" xml:space="preserve"> - <value>ArdupilotMega.myGMAP, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>gMapControl1.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1520,7 +1520,7 @@ <value>TXT_lat</value> </data> <data name=">>TXT_lat.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_lat.Parent" xml:space="preserve"> <value>panel1</value> @@ -1577,7 +1577,7 @@ <value>label1</value> </data> <data name=">>label1.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>label1.Parent" xml:space="preserve"> <value>panel1</value> @@ -1607,7 +1607,7 @@ <value>TXT_long</value> </data> <data name=">>TXT_long.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_long.Parent" xml:space="preserve"> <value>panel1</value> @@ -1637,7 +1637,7 @@ <value>TXT_alt</value> </data> <data name=">>TXT_alt.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_alt.Parent" xml:space="preserve"> <value>panel1</value> @@ -1838,7 +1838,7 @@ <value>label6</value> </data> <data name=">>label6.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>label6.Parent" xml:space="preserve"> <value>$this</value> @@ -1916,6 +1916,6 @@ <value>FlightData</value> </data> <data name=">>$this.Type" xml:space="preserve"> - <value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.1.4489.31102, Culture=neutral, PublicKeyToken=null</value> + <value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.1.4497.35992, Culture=neutral, PublicKeyToken=null</value> </data> </root> \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs index acadb4b9052d417737587494664877264ac01c73..524e96127bb35d28763aa168af1ac91067ef964b 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs @@ -61,10 +61,10 @@ this.TXT_loiterrad = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.panel5 = new System.Windows.Forms.Panel(); - this.BUT_write = new ArdupilotMega.MyButton(); - this.BUT_read = new ArdupilotMega.MyButton(); - this.SaveFile = new ArdupilotMega.MyButton(); - this.BUT_loadwpfile = new ArdupilotMega.MyButton(); + this.BUT_write = new ArdupilotMega.Controls.MyButton(); + this.BUT_read = new ArdupilotMega.Controls.MyButton(); + this.SaveFile = new ArdupilotMega.Controls.MyButton(); + this.BUT_loadwpfile = new ArdupilotMega.Controls.MyButton(); this.panel1 = new System.Windows.Forms.Panel(); this.label4 = new System.Windows.Forms.LinkLabel(); this.label3 = new System.Windows.Forms.Label(); @@ -89,19 +89,19 @@ this.textBox1 = new System.Windows.Forms.TextBox(); this.panelWaypoints = new BSE.Windows.Forms.Panel(); this.splitter1 = new BSE.Windows.Forms.Splitter(); - this.BUT_loadkml = new ArdupilotMega.MyButton(); - this.BUT_zoomto = new ArdupilotMega.MyButton(); - this.BUT_Camera = new ArdupilotMega.MyButton(); - this.BUT_grid = new ArdupilotMega.MyButton(); - this.BUT_Prefetch = new ArdupilotMega.MyButton(); - this.button1 = new ArdupilotMega.MyButton(); - this.BUT_Add = new ArdupilotMega.MyButton(); + this.BUT_loadkml = new ArdupilotMega.Controls.MyButton(); + this.BUT_zoomto = new ArdupilotMega.Controls.MyButton(); + this.BUT_Camera = new ArdupilotMega.Controls.MyButton(); + this.BUT_grid = new ArdupilotMega.Controls.MyButton(); + this.BUT_Prefetch = new ArdupilotMega.Controls.MyButton(); + this.button1 = new ArdupilotMega.Controls.MyButton(); + this.BUT_Add = new ArdupilotMega.Controls.MyButton(); this.panelAction = new BSE.Windows.Forms.Panel(); this.panelMap = new System.Windows.Forms.Panel(); this.lbl_distance = new System.Windows.Forms.Label(); this.lbl_homedist = new System.Windows.Forms.Label(); this.lbl_prevdist = new System.Windows.Forms.Label(); - this.MainMap = new myGMAP(); + this.MainMap = new ArdupilotMega.Controls.myGMAP(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.deleteWPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loiterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -123,7 +123,7 @@ this.GeoFencedownloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setReturnLocationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadFromFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.trackBar1 = new ArdupilotMega.MyTrackBar(); + this.trackBar1 = new ArdupilotMega.Controls.MyTrackBar(); this.label11 = new System.Windows.Forms.Label(); this.panelBASE = new System.Windows.Forms.Panel(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); @@ -932,9 +932,9 @@ #endregion - private MyButton SaveFile; - private MyButton BUT_read; - private MyButton BUT_write; + private ArdupilotMega.Controls.MyButton SaveFile; + private ArdupilotMega.Controls.MyButton BUT_read; + private ArdupilotMega.Controls.MyButton BUT_write; private System.Windows.Forms.Panel panel5; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.LinkLabel label4; @@ -955,12 +955,12 @@ private System.Windows.Forms.TextBox TXT_mousealt; private System.Windows.Forms.TextBox TXT_mouselong; private System.Windows.Forms.TextBox TXT_mouselat; - private MyButton BUT_loadwpfile; + private ArdupilotMega.Controls.MyButton BUT_loadwpfile; private System.Windows.Forms.ComboBox comboBoxMapType; private System.Windows.Forms.Label lbl_status; private System.Windows.Forms.DataGridView Commands; private System.Windows.Forms.CheckBox CHK_geheight; - private MyButton BUT_Add; + private ArdupilotMega.Controls.MyButton BUT_Add; private System.Windows.Forms.TextBox TXT_WPRad; private System.Windows.Forms.TextBox TXT_DefaultAlt; private System.Windows.Forms.Label LBL_WPRad; @@ -968,21 +968,21 @@ private System.Windows.Forms.TextBox TXT_loiterrad; private System.Windows.Forms.Label label5; private System.Windows.Forms.CheckBox CHK_holdalt; - private MyButton button1; + private ArdupilotMega.Controls.MyButton button1; private System.Windows.Forms.CheckBox CHK_altmode; private BSE.Windows.Forms.Panel panelWaypoints; private BSE.Windows.Forms.Panel panelAction; private System.Windows.Forms.Panel panelMap; - private myGMAP MainMap; - private MyTrackBar trackBar1; + private ArdupilotMega.Controls.myGMAP MainMap; + private ArdupilotMega.Controls.MyTrackBar trackBar1; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label lbl_distance; private System.Windows.Forms.Label lbl_prevdist; private BSE.Windows.Forms.Splitter splitter1; private System.Windows.Forms.Panel panelBASE; private System.Windows.Forms.Label lbl_homedist; - private MyButton BUT_Prefetch; - private MyButton BUT_grid; + private ArdupilotMega.Controls.MyButton BUT_Prefetch; + private ArdupilotMega.Controls.MyButton BUT_grid; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem ContextMeasure; private System.Windows.Forms.ToolTip toolTip1; @@ -1000,7 +1000,7 @@ private System.Windows.Forms.ToolStripMenuItem jumpwPToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem deleteWPToolStripMenuItem; - private MyButton BUT_Camera; + private ArdupilotMega.Controls.MyButton BUT_Camera; private System.Windows.Forms.DataGridViewComboBoxColumn Command; private System.Windows.Forms.DataGridViewTextBoxColumn Param1; private System.Windows.Forms.DataGridViewTextBoxColumn Param2; @@ -1012,8 +1012,8 @@ private System.Windows.Forms.DataGridViewButtonColumn Delete; private System.Windows.Forms.DataGridViewImageColumn Up; private System.Windows.Forms.DataGridViewImageColumn Down; - private MyButton BUT_zoomto; - private MyButton BUT_loadkml; + private ArdupilotMega.Controls.MyButton BUT_zoomto; + private ArdupilotMega.Controls.MyButton BUT_loadkml; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ToolStripMenuItem geoFenceToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem GeoFenceuploadToolStripMenuItem; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index 5e386318598f7ac3e4e77ca65233ae2d8f210d68..bdf89907b3dcae1e96f3044748d2fe93dcc64131 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -21,6 +21,7 @@ using System.Threading; using log4net; using SharpKml.Base; using SharpKml.Dom; +using ArdupilotMega.Controls; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx index 8db443f0a28c67a8c1ce9187e4669499217ed5c7..f70e995eaddab880f0ad88ef082b3f5fbf15fcfc 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx @@ -556,7 +556,7 @@ <value>BUT_write</value> </data> <data name=">>BUT_write.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_write.Parent" xml:space="preserve"> <value>panel5</value> @@ -583,7 +583,7 @@ <value>BUT_read</value> </data> <data name=">>BUT_read.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_read.Parent" xml:space="preserve"> <value>panel5</value> @@ -610,7 +610,7 @@ <value>SaveFile</value> </data> <data name=">>SaveFile.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>SaveFile.Parent" xml:space="preserve"> <value>panel5</value> @@ -637,7 +637,7 @@ <value>BUT_loadwpfile</value> </data> <data name=">>BUT_loadwpfile.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_loadwpfile.Parent" xml:space="preserve"> <value>panel5</value> @@ -1261,7 +1261,7 @@ <value>BUT_loadkml</value> </data> <data name=">>BUT_loadkml.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_loadkml.Parent" xml:space="preserve"> <value>panelWaypoints</value> @@ -1291,7 +1291,7 @@ <value>BUT_zoomto</value> </data> <data name=">>BUT_zoomto.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_zoomto.Parent" xml:space="preserve"> <value>panelWaypoints</value> @@ -1321,7 +1321,7 @@ <value>BUT_Camera</value> </data> <data name=">>BUT_Camera.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_Camera.Parent" xml:space="preserve"> <value>panelWaypoints</value> @@ -1351,7 +1351,7 @@ <value>BUT_grid</value> </data> <data name=">>BUT_grid.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_grid.Parent" xml:space="preserve"> <value>panelWaypoints</value> @@ -1381,7 +1381,7 @@ <value>BUT_Prefetch</value> </data> <data name=">>BUT_Prefetch.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_Prefetch.Parent" xml:space="preserve"> <value>panelWaypoints</value> @@ -1411,7 +1411,7 @@ <value>button1</value> </data> <data name=">>button1.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>button1.Parent" xml:space="preserve"> <value>panelWaypoints</value> @@ -1441,7 +1441,7 @@ <value>BUT_Add</value> </data> <data name=">>BUT_Add.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_Add.Parent" xml:space="preserve"> <value>panelWaypoints</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Help.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Help.Designer.cs index 965140d1d58611637211d5ee19fc4e7f6a5d5f2c..9151f64fdb71a80d2920c1c97b7c1cbefe9fa593 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Help.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Help.Designer.cs @@ -31,7 +31,7 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Help)); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.CHK_showconsole = new System.Windows.Forms.CheckBox(); - this.BUT_updatecheck = new ArdupilotMega.MyButton(); + this.BUT_updatecheck = new ArdupilotMega.Controls.MyButton(); this.SuspendLayout(); // // richTextBox1 @@ -71,7 +71,7 @@ #endregion private System.Windows.Forms.RichTextBox richTextBox1; - private MyButton BUT_updatecheck; + private ArdupilotMega.Controls.MyButton BUT_updatecheck; private System.Windows.Forms.CheckBox CHK_showconsole; } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Help.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Help.resx index 8d7938a05c62d20e156439e1e1402b91b2a7a014..f5e2d6cd4256627cf31be16f711c12dec7ddfcf0 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Help.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Help.resx @@ -196,7 +196,7 @@ <value>BUT_updatecheck</value> </data> <data name=">>BUT_updatecheck.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_updatecheck.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.Designer.cs index 45318952a8076a73586a2e99cb6facd35ca9ba12..54ae0bb1a203d0891274a5e7e2f9b552952654dc 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.Designer.cs @@ -34,81 +34,81 @@ this.CHKREV_pitch = new System.Windows.Forms.CheckBox(); this.CHKREV_rudder = new System.Windows.Forms.CheckBox(); this.GPSrate = new System.Windows.Forms.ComboBox(); - this.ConnectComPort = new ArdupilotMega.MyButton(); + this.ConnectComPort = new ArdupilotMega.Controls.MyButton(); this.OutputLog = new System.Windows.Forms.RichTextBox(); - this.TXT_roll = new ArdupilotMega.MyLabel(); - this.TXT_pitch = new ArdupilotMega.MyLabel(); - this.TXT_heading = new ArdupilotMega.MyLabel(); - this.TXT_wpdist = new ArdupilotMega.MyLabel(); + this.TXT_roll = new ArdupilotMega.Controls.MyLabel(); + this.TXT_pitch = new ArdupilotMega.Controls.MyLabel(); + this.TXT_heading = new ArdupilotMega.Controls.MyLabel(); + this.TXT_wpdist = new ArdupilotMega.Controls.MyLabel(); this.currentStateBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.TXT_bererror = new ArdupilotMega.MyLabel(); - this.TXT_alterror = new ArdupilotMega.MyLabel(); - this.TXT_lat = new ArdupilotMega.MyLabel(); - this.TXT_long = new ArdupilotMega.MyLabel(); - this.TXT_alt = new ArdupilotMega.MyLabel(); - this.SaveSettings = new ArdupilotMega.MyButton(); + this.TXT_bererror = new ArdupilotMega.Controls.MyLabel(); + this.TXT_alterror = new ArdupilotMega.Controls.MyLabel(); + this.TXT_lat = new ArdupilotMega.Controls.MyLabel(); + this.TXT_long = new ArdupilotMega.Controls.MyLabel(); + this.TXT_alt = new ArdupilotMega.Controls.MyLabel(); + this.SaveSettings = new ArdupilotMega.Controls.MyButton(); this.RAD_softXplanes = new System.Windows.Forms.RadioButton(); this.RAD_softFlightGear = new System.Windows.Forms.RadioButton(); - this.TXT_servoroll = new ArdupilotMega.MyLabel(); - this.TXT_servopitch = new ArdupilotMega.MyLabel(); - this.TXT_servorudder = new ArdupilotMega.MyLabel(); - this.TXT_servothrottle = new ArdupilotMega.MyLabel(); + this.TXT_servoroll = new ArdupilotMega.Controls.MyLabel(); + this.TXT_servopitch = new ArdupilotMega.Controls.MyLabel(); + this.TXT_servorudder = new ArdupilotMega.Controls.MyLabel(); + this.TXT_servothrottle = new ArdupilotMega.Controls.MyLabel(); this.panel1 = new System.Windows.Forms.Panel(); - this.label4 = new ArdupilotMega.MyLabel(); - this.label3 = new ArdupilotMega.MyLabel(); - this.label2 = new ArdupilotMega.MyLabel(); - this.label1 = new ArdupilotMega.MyLabel(); + this.label4 = new ArdupilotMega.Controls.MyLabel(); + this.label3 = new ArdupilotMega.Controls.MyLabel(); + this.label2 = new ArdupilotMega.Controls.MyLabel(); + this.label1 = new ArdupilotMega.Controls.MyLabel(); this.panel2 = new System.Windows.Forms.Panel(); - this.label30 = new ArdupilotMega.MyLabel(); - this.TXT_yaw = new ArdupilotMega.MyLabel(); - this.label11 = new ArdupilotMega.MyLabel(); - this.label7 = new ArdupilotMega.MyLabel(); - this.label6 = new ArdupilotMega.MyLabel(); - this.label5 = new ArdupilotMega.MyLabel(); - this.label8 = new ArdupilotMega.MyLabel(); - this.label9 = new ArdupilotMega.MyLabel(); - this.label10 = new ArdupilotMega.MyLabel(); + this.label30 = new ArdupilotMega.Controls.MyLabel(); + this.TXT_yaw = new ArdupilotMega.Controls.MyLabel(); + this.label11 = new ArdupilotMega.Controls.MyLabel(); + this.label7 = new ArdupilotMega.Controls.MyLabel(); + this.label6 = new ArdupilotMega.Controls.MyLabel(); + this.label5 = new ArdupilotMega.Controls.MyLabel(); + this.label8 = new ArdupilotMega.Controls.MyLabel(); + this.label9 = new ArdupilotMega.Controls.MyLabel(); + this.label10 = new ArdupilotMega.Controls.MyLabel(); this.panel3 = new System.Windows.Forms.Panel(); - this.label16 = new ArdupilotMega.MyLabel(); - this.label15 = new ArdupilotMega.MyLabel(); - this.label14 = new ArdupilotMega.MyLabel(); - this.label13 = new ArdupilotMega.MyLabel(); - this.label12 = new ArdupilotMega.MyLabel(); + this.label16 = new ArdupilotMega.Controls.MyLabel(); + this.label15 = new ArdupilotMega.Controls.MyLabel(); + this.label14 = new ArdupilotMega.Controls.MyLabel(); + this.label13 = new ArdupilotMega.Controls.MyLabel(); + this.label12 = new ArdupilotMega.Controls.MyLabel(); this.panel4 = new System.Windows.Forms.Panel(); - this.label20 = new ArdupilotMega.MyLabel(); - this.label19 = new ArdupilotMega.MyLabel(); - this.TXT_control_mode = new ArdupilotMega.MyLabel(); - this.TXT_WP = new ArdupilotMega.MyLabel(); - this.label18 = new ArdupilotMega.MyLabel(); - this.label17 = new ArdupilotMega.MyLabel(); + this.label20 = new ArdupilotMega.Controls.MyLabel(); + this.label19 = new ArdupilotMega.Controls.MyLabel(); + this.TXT_control_mode = new ArdupilotMega.Controls.MyLabel(); + this.TXT_WP = new ArdupilotMega.Controls.MyLabel(); + this.label18 = new ArdupilotMega.Controls.MyLabel(); + this.label17 = new ArdupilotMega.Controls.MyLabel(); this.panel5 = new System.Windows.Forms.Panel(); this.zg1 = new ZedGraph.ZedGraphControl(); this.timer_servo_graph = new System.Windows.Forms.Timer(this.components); this.panel6 = new System.Windows.Forms.Panel(); - this.label28 = new ArdupilotMega.MyLabel(); - this.label29 = new ArdupilotMega.MyLabel(); - this.label27 = new ArdupilotMega.MyLabel(); - this.label25 = new ArdupilotMega.MyLabel(); + this.label28 = new ArdupilotMega.Controls.MyLabel(); + this.label29 = new ArdupilotMega.Controls.MyLabel(); + this.label27 = new ArdupilotMega.Controls.MyLabel(); + this.label25 = new ArdupilotMega.Controls.MyLabel(); this.TXT_throttlegain = new System.Windows.Forms.TextBox(); - this.label24 = new ArdupilotMega.MyLabel(); - this.label23 = new ArdupilotMega.MyLabel(); - this.label22 = new ArdupilotMega.MyLabel(); - this.label21 = new ArdupilotMega.MyLabel(); + this.label24 = new ArdupilotMega.Controls.MyLabel(); + this.label23 = new ArdupilotMega.Controls.MyLabel(); + this.label22 = new ArdupilotMega.Controls.MyLabel(); + this.label21 = new ArdupilotMega.Controls.MyLabel(); this.TXT_ruddergain = new System.Windows.Forms.TextBox(); this.TXT_pitchgain = new System.Windows.Forms.TextBox(); this.TXT_rollgain = new System.Windows.Forms.TextBox(); - this.label26 = new ArdupilotMega.MyLabel(); + this.label26 = new ArdupilotMega.Controls.MyLabel(); this.CHKdisplayall = new System.Windows.Forms.CheckBox(); this.CHKgraphroll = new System.Windows.Forms.CheckBox(); this.CHKgraphpitch = new System.Windows.Forms.CheckBox(); this.CHKgraphrudder = new System.Windows.Forms.CheckBox(); this.CHKgraphthrottle = new System.Windows.Forms.CheckBox(); - this.but_advsettings = new ArdupilotMega.MyButton(); + this.but_advsettings = new ArdupilotMega.Controls.MyButton(); this.chkSensor = new System.Windows.Forms.CheckBox(); this.CHK_quad = new System.Windows.Forms.CheckBox(); - this.BUT_startfgquad = new ArdupilotMega.MyButton(); - this.BUT_startfgplane = new ArdupilotMega.MyButton(); - this.BUT_startxplane = new ArdupilotMega.MyButton(); + this.BUT_startfgquad = new ArdupilotMega.Controls.MyButton(); + this.BUT_startfgplane = new ArdupilotMega.Controls.MyButton(); + this.BUT_startxplane = new ArdupilotMega.Controls.MyButton(); this.CHK_heli = new System.Windows.Forms.CheckBox(); this.RAD_aerosimrc = new System.Windows.Forms.RadioButton(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); @@ -763,81 +763,81 @@ private System.Windows.Forms.CheckBox CHKREV_pitch; private System.Windows.Forms.CheckBox CHKREV_rudder; private System.Windows.Forms.ComboBox GPSrate; - private MyButton ConnectComPort; + private ArdupilotMega.Controls.MyButton ConnectComPort; private System.Windows.Forms.RichTextBox OutputLog; - private ArdupilotMega.MyLabel TXT_roll; - private ArdupilotMega.MyLabel TXT_pitch; - private ArdupilotMega.MyLabel TXT_heading; - private ArdupilotMega.MyLabel TXT_wpdist; - private ArdupilotMega.MyLabel TXT_bererror; - private ArdupilotMega.MyLabel TXT_alterror; - private ArdupilotMega.MyLabel TXT_lat; - private ArdupilotMega.MyLabel TXT_long; - private ArdupilotMega.MyLabel TXT_alt; - private MyButton SaveSettings; + private ArdupilotMega.Controls.MyLabel TXT_roll; + private ArdupilotMega.Controls.MyLabel TXT_pitch; + private ArdupilotMega.Controls.MyLabel TXT_heading; + private ArdupilotMega.Controls.MyLabel TXT_wpdist; + private ArdupilotMega.Controls.MyLabel TXT_bererror; + private ArdupilotMega.Controls.MyLabel TXT_alterror; + private ArdupilotMega.Controls.MyLabel TXT_lat; + private ArdupilotMega.Controls.MyLabel TXT_long; + private ArdupilotMega.Controls.MyLabel TXT_alt; + private ArdupilotMega.Controls.MyButton SaveSettings; private System.Windows.Forms.RadioButton RAD_softXplanes; private System.Windows.Forms.RadioButton RAD_softFlightGear; - private ArdupilotMega.MyLabel TXT_servoroll; - private ArdupilotMega.MyLabel TXT_servopitch; - private ArdupilotMega.MyLabel TXT_servorudder; - private ArdupilotMega.MyLabel TXT_servothrottle; + private ArdupilotMega.Controls.MyLabel TXT_servoroll; + private ArdupilotMega.Controls.MyLabel TXT_servopitch; + private ArdupilotMega.Controls.MyLabel TXT_servorudder; + private ArdupilotMega.Controls.MyLabel TXT_servothrottle; private System.Windows.Forms.Panel panel1; - private ArdupilotMega.MyLabel label3; - private ArdupilotMega.MyLabel label2; - private ArdupilotMega.MyLabel label1; + private ArdupilotMega.Controls.MyLabel label3; + private ArdupilotMega.Controls.MyLabel label2; + private ArdupilotMega.Controls.MyLabel label1; private System.Windows.Forms.Panel panel2; - private ArdupilotMega.MyLabel label4; - private ArdupilotMega.MyLabel label10; - private ArdupilotMega.MyLabel label9; - private ArdupilotMega.MyLabel label8; - private ArdupilotMega.MyLabel label7; - private ArdupilotMega.MyLabel label6; - private ArdupilotMega.MyLabel label5; - private ArdupilotMega.MyLabel label11; + private ArdupilotMega.Controls.MyLabel label4; + private ArdupilotMega.Controls.MyLabel label10; + private ArdupilotMega.Controls.MyLabel label9; + private ArdupilotMega.Controls.MyLabel label8; + private ArdupilotMega.Controls.MyLabel label7; + private ArdupilotMega.Controls.MyLabel label6; + private ArdupilotMega.Controls.MyLabel label5; + private ArdupilotMega.Controls.MyLabel label11; private System.Windows.Forms.Panel panel3; - private ArdupilotMega.MyLabel label16; - private ArdupilotMega.MyLabel label15; - private ArdupilotMega.MyLabel label14; - private ArdupilotMega.MyLabel label13; - private ArdupilotMega.MyLabel label12; + private ArdupilotMega.Controls.MyLabel label16; + private ArdupilotMega.Controls.MyLabel label15; + private ArdupilotMega.Controls.MyLabel label14; + private ArdupilotMega.Controls.MyLabel label13; + private ArdupilotMega.Controls.MyLabel label12; private System.Windows.Forms.Panel panel4; - private ArdupilotMega.MyLabel label17; - private ArdupilotMega.MyLabel TXT_WP; - private ArdupilotMega.MyLabel label18; + private ArdupilotMega.Controls.MyLabel label17; + private ArdupilotMega.Controls.MyLabel TXT_WP; + private ArdupilotMega.Controls.MyLabel label18; private System.Windows.Forms.Panel panel5; - private ArdupilotMega.MyLabel label20; - private ArdupilotMega.MyLabel label19; - private ArdupilotMega.MyLabel TXT_control_mode; + private ArdupilotMega.Controls.MyLabel label20; + private ArdupilotMega.Controls.MyLabel label19; + private ArdupilotMega.Controls.MyLabel TXT_control_mode; private ZedGraph.ZedGraphControl zg1; private System.Windows.Forms.Timer timer_servo_graph; private System.Windows.Forms.Panel panel6; private System.Windows.Forms.TextBox TXT_ruddergain; private System.Windows.Forms.TextBox TXT_pitchgain; private System.Windows.Forms.TextBox TXT_rollgain; - private ArdupilotMega.MyLabel label24; - private ArdupilotMega.MyLabel label23; - private ArdupilotMega.MyLabel label22; - private ArdupilotMega.MyLabel label21; - private ArdupilotMega.MyLabel label25; + private ArdupilotMega.Controls.MyLabel label24; + private ArdupilotMega.Controls.MyLabel label23; + private ArdupilotMega.Controls.MyLabel label22; + private ArdupilotMega.Controls.MyLabel label21; + private ArdupilotMega.Controls.MyLabel label25; private System.Windows.Forms.TextBox TXT_throttlegain; - private ArdupilotMega.MyLabel label28; - private ArdupilotMega.MyLabel label29; - private ArdupilotMega.MyLabel label27; - private ArdupilotMega.MyLabel label26; + private ArdupilotMega.Controls.MyLabel label28; + private ArdupilotMega.Controls.MyLabel label29; + private ArdupilotMega.Controls.MyLabel label27; + private ArdupilotMega.Controls.MyLabel label26; private System.Windows.Forms.CheckBox CHKdisplayall; private System.Windows.Forms.CheckBox CHKgraphroll; private System.Windows.Forms.CheckBox CHKgraphpitch; private System.Windows.Forms.CheckBox CHKgraphrudder; private System.Windows.Forms.CheckBox CHKgraphthrottle; - private ArdupilotMega.MyLabel label30; - private ArdupilotMega.MyLabel TXT_yaw; - private MyButton but_advsettings; + private ArdupilotMega.Controls.MyLabel label30; + private ArdupilotMega.Controls.MyLabel TXT_yaw; + private ArdupilotMega.Controls.MyButton but_advsettings; private System.Windows.Forms.CheckBox chkSensor; private System.Windows.Forms.BindingSource currentStateBindingSource; private System.Windows.Forms.CheckBox CHK_quad; - private MyButton BUT_startfgquad; - private MyButton BUT_startfgplane; - private MyButton BUT_startxplane; + private ArdupilotMega.Controls.MyButton BUT_startfgquad; + private ArdupilotMega.Controls.MyButton BUT_startfgplane; + private ArdupilotMega.Controls.MyButton BUT_startxplane; private System.Windows.Forms.CheckBox CHK_heli; private System.Windows.Forms.RadioButton RAD_aerosimrc; private System.Windows.Forms.ToolTip toolTip1; diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs index fca5683952e14d4a172b4163f00cd3792b5e3206..307090fb1b3a3ef47635cb62f055a8cd5802eaa2 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs @@ -13,7 +13,7 @@ using log4net; using ZedGraph; // Graphs using ArdupilotMega; using System.Reflection; - +using ArdupilotMega.Controls; using System.Drawing.Drawing2D; // Written by Michael Oborne diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.resx index b78bdb87cf109523e6c271c50a6ee78681c58f53..0b480ae370df648dee9c1d7f8a481dc42c7add69 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.resx @@ -261,7 +261,7 @@ <value>ConnectComPort</value> </data> <data name=">>ConnectComPort.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>ConnectComPort.Parent" xml:space="preserve"> <value>panel5</value> @@ -309,7 +309,7 @@ <value>TXT_roll</value> </data> <data name=">>TXT_roll.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_roll.Parent" xml:space="preserve"> <value>panel2</value> @@ -330,7 +330,7 @@ <value>TXT_pitch</value> </data> <data name=">>TXT_pitch.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_pitch.Parent" xml:space="preserve"> <value>panel2</value> @@ -351,7 +351,7 @@ <value>TXT_heading</value> </data> <data name=">>TXT_heading.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_heading.Parent" xml:space="preserve"> <value>panel2</value> @@ -372,7 +372,7 @@ <value>TXT_wpdist</value> </data> <data name=">>TXT_wpdist.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_wpdist.Parent" xml:space="preserve"> <value>panel4</value> @@ -396,7 +396,7 @@ <value>TXT_bererror</value> </data> <data name=">>TXT_bererror.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_bererror.Parent" xml:space="preserve"> <value>panel4</value> @@ -417,7 +417,7 @@ <value>TXT_alterror</value> </data> <data name=">>TXT_alterror.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_alterror.Parent" xml:space="preserve"> <value>panel4</value> @@ -438,7 +438,7 @@ <value>TXT_lat</value> </data> <data name=">>TXT_lat.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_lat.Parent" xml:space="preserve"> <value>panel1</value> @@ -459,7 +459,7 @@ <value>TXT_long</value> </data> <data name=">>TXT_long.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_long.Parent" xml:space="preserve"> <value>panel1</value> @@ -480,7 +480,7 @@ <value>TXT_alt</value> </data> <data name=">>TXT_alt.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_alt.Parent" xml:space="preserve"> <value>panel1</value> @@ -504,7 +504,7 @@ <value>SaveSettings</value> </data> <data name=">>SaveSettings.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>SaveSettings.Parent" xml:space="preserve"> <value>$this</value> @@ -588,7 +588,7 @@ <value>TXT_servoroll</value> </data> <data name=">>TXT_servoroll.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_servoroll.Parent" xml:space="preserve"> <value>panel3</value> @@ -609,7 +609,7 @@ <value>TXT_servopitch</value> </data> <data name=">>TXT_servopitch.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_servopitch.Parent" xml:space="preserve"> <value>panel3</value> @@ -630,7 +630,7 @@ <value>TXT_servorudder</value> </data> <data name=">>TXT_servorudder.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_servorudder.Parent" xml:space="preserve"> <value>panel3</value> @@ -651,7 +651,7 @@ <value>TXT_servothrottle</value> </data> <data name=">>TXT_servothrottle.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_servothrottle.Parent" xml:space="preserve"> <value>panel3</value> @@ -675,7 +675,7 @@ <value>label4</value> </data> <data name=">>label4.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label4.Parent" xml:space="preserve"> <value>panel1</value> @@ -699,7 +699,7 @@ <value>label3</value> </data> <data name=">>label3.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label3.Parent" xml:space="preserve"> <value>panel1</value> @@ -723,7 +723,7 @@ <value>label2</value> </data> <data name=">>label2.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label2.Parent" xml:space="preserve"> <value>panel1</value> @@ -747,7 +747,7 @@ <value>label1</value> </data> <data name=">>label1.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label1.Parent" xml:space="preserve"> <value>panel1</value> @@ -792,7 +792,7 @@ <value>label30</value> </data> <data name=">>label30.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label30.Parent" xml:space="preserve"> <value>panel2</value> @@ -813,7 +813,7 @@ <value>TXT_yaw</value> </data> <data name=">>TXT_yaw.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_yaw.Parent" xml:space="preserve"> <value>panel2</value> @@ -837,7 +837,7 @@ <value>label11</value> </data> <data name=">>label11.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label11.Parent" xml:space="preserve"> <value>panel2</value> @@ -861,7 +861,7 @@ <value>label7</value> </data> <data name=">>label7.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label7.Parent" xml:space="preserve"> <value>panel2</value> @@ -885,7 +885,7 @@ <value>label6</value> </data> <data name=">>label6.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label6.Parent" xml:space="preserve"> <value>panel2</value> @@ -909,7 +909,7 @@ <value>label5</value> </data> <data name=">>label5.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label5.Parent" xml:space="preserve"> <value>panel2</value> @@ -954,7 +954,7 @@ <value>label8</value> </data> <data name=">>label8.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label8.Parent" xml:space="preserve"> <value>panel4</value> @@ -978,7 +978,7 @@ <value>label9</value> </data> <data name=">>label9.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label9.Parent" xml:space="preserve"> <value>panel4</value> @@ -1002,7 +1002,7 @@ <value>label10</value> </data> <data name=">>label10.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label10.Parent" xml:space="preserve"> <value>panel4</value> @@ -1026,7 +1026,7 @@ <value>label16</value> </data> <data name=">>label16.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label16.Parent" xml:space="preserve"> <value>panel3</value> @@ -1050,7 +1050,7 @@ <value>label15</value> </data> <data name=">>label15.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label15.Parent" xml:space="preserve"> <value>panel3</value> @@ -1074,7 +1074,7 @@ <value>label14</value> </data> <data name=">>label14.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label14.Parent" xml:space="preserve"> <value>panel3</value> @@ -1098,7 +1098,7 @@ <value>label13</value> </data> <data name=">>label13.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label13.Parent" xml:space="preserve"> <value>panel3</value> @@ -1122,7 +1122,7 @@ <value>label12</value> </data> <data name=">>label12.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label12.Parent" xml:space="preserve"> <value>panel3</value> @@ -1167,7 +1167,7 @@ <value>label20</value> </data> <data name=">>label20.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label20.Parent" xml:space="preserve"> <value>panel4</value> @@ -1191,7 +1191,7 @@ <value>label19</value> </data> <data name=">>label19.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label19.Parent" xml:space="preserve"> <value>panel4</value> @@ -1212,7 +1212,7 @@ <value>TXT_control_mode</value> </data> <data name=">>TXT_control_mode.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_control_mode.Parent" xml:space="preserve"> <value>panel4</value> @@ -1233,7 +1233,7 @@ <value>TXT_WP</value> </data> <data name=">>TXT_WP.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>TXT_WP.Parent" xml:space="preserve"> <value>panel4</value> @@ -1257,7 +1257,7 @@ <value>label18</value> </data> <data name=">>label18.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label18.Parent" xml:space="preserve"> <value>panel4</value> @@ -1302,7 +1302,7 @@ <value>label17</value> </data> <data name=">>label17.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label17.Parent" xml:space="preserve"> <value>$this</value> @@ -1375,7 +1375,7 @@ <value>label28</value> </data> <data name=">>label28.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label28.Parent" xml:space="preserve"> <value>panel6</value> @@ -1399,7 +1399,7 @@ <value>label29</value> </data> <data name=">>label29.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label29.Parent" xml:space="preserve"> <value>panel6</value> @@ -1423,7 +1423,7 @@ <value>label27</value> </data> <data name=">>label27.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label27.Parent" xml:space="preserve"> <value>panel6</value> @@ -1447,7 +1447,7 @@ <value>label25</value> </data> <data name=">>label25.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label25.Parent" xml:space="preserve"> <value>panel6</value> @@ -1495,7 +1495,7 @@ <value>label24</value> </data> <data name=">>label24.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label24.Parent" xml:space="preserve"> <value>panel6</value> @@ -1519,7 +1519,7 @@ <value>label23</value> </data> <data name=">>label23.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label23.Parent" xml:space="preserve"> <value>panel6</value> @@ -1543,7 +1543,7 @@ <value>label22</value> </data> <data name=">>label22.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label22.Parent" xml:space="preserve"> <value>panel6</value> @@ -1567,7 +1567,7 @@ <value>label21</value> </data> <data name=">>label21.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label21.Parent" xml:space="preserve"> <value>panel6</value> @@ -1684,7 +1684,7 @@ <value>label26</value> </data> <data name=">>label26.Type" xml:space="preserve"> - <value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>label26.Parent" xml:space="preserve"> <value>$this</value> @@ -1855,7 +1855,7 @@ <value>but_advsettings</value> </data> <data name=">>but_advsettings.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>but_advsettings.Parent" xml:space="preserve"> <value>$this</value> @@ -1939,7 +1939,7 @@ <value>BUT_startfgquad</value> </data> <data name=">>BUT_startfgquad.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_startfgquad.Parent" xml:space="preserve"> <value>$this</value> @@ -1966,7 +1966,7 @@ <value>BUT_startfgplane</value> </data> <data name=">>BUT_startfgplane.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_startfgplane.Parent" xml:space="preserve"> <value>$this</value> @@ -1993,7 +1993,7 @@ <value>BUT_startxplane</value> </data> <data name=">>BUT_startxplane.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_startxplane.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs index 29b1c3207ef8503143870c65331209f50f0b00e5..eacae4685d4fac8388653a215d588cebc9f9ef36 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs @@ -30,11 +30,11 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Terminal)); this.TXT_terminal = new System.Windows.Forms.RichTextBox(); - this.BUTsetupshow = new ArdupilotMega.MyButton(); - this.BUTradiosetup = new ArdupilotMega.MyButton(); - this.BUTtests = new ArdupilotMega.MyButton(); - this.Logs = new ArdupilotMega.MyButton(); - this.BUT_logbrowse = new ArdupilotMega.MyButton(); + this.BUTsetupshow = new ArdupilotMega.Controls.MyButton(); + this.BUTradiosetup = new ArdupilotMega.Controls.MyButton(); + this.BUTtests = new ArdupilotMega.Controls.MyButton(); + this.Logs = new ArdupilotMega.Controls.MyButton(); + this.BUT_logbrowse = new ArdupilotMega.Controls.MyButton(); this.SuspendLayout(); // // TXT_terminal @@ -101,10 +101,10 @@ #endregion private System.Windows.Forms.RichTextBox TXT_terminal; - private MyButton BUTsetupshow; - private MyButton BUTradiosetup; - private MyButton BUTtests; - private MyButton Logs; - private MyButton BUT_logbrowse; + private ArdupilotMega.Controls.MyButton BUTsetupshow; + private ArdupilotMega.Controls.MyButton BUTradiosetup; + private ArdupilotMega.Controls.MyButton BUTtests; + private ArdupilotMega.Controls.MyButton Logs; + private ArdupilotMega.Controls.MyButton BUT_logbrowse; } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs index 2c4897acef1f302b3ca9fa412ac70cf4f3f610d6..9dbeb0d323d219ea84d326288aaf922e60cb38ce 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs @@ -8,6 +8,8 @@ using System.Text; using System.Windows.Forms; using ArdupilotMega; using System.IO.Ports; +using ArdupilotMega.Comms; + namespace ArdupilotMega.GCSViews { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx index 4da6d80a1b95ec8254242776dc932adb37a5fdb6..af41b2749b586c60d2d4874a29d8cadac5eeea1d 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx @@ -166,7 +166,7 @@ <value>BUTsetupshow</value> </data> <data name=">>BUTsetupshow.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUTsetupshow.Parent" xml:space="preserve"> <value>$this</value> @@ -190,7 +190,7 @@ <value>BUTradiosetup</value> </data> <data name=">>BUTradiosetup.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUTradiosetup.Parent" xml:space="preserve"> <value>$this</value> @@ -214,7 +214,7 @@ <value>BUTtests</value> </data> <data name=">>BUTtests.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUTtests.Parent" xml:space="preserve"> <value>$this</value> @@ -238,7 +238,7 @@ <value>Logs</value> </data> <data name=">>Logs.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>Logs.Parent" xml:space="preserve"> <value>$this</value> @@ -262,7 +262,7 @@ <value>BUT_logbrowse</value> </data> <data name=">>BUT_logbrowse.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value> </data> <data name=">>BUT_logbrowse.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/JoystickSetup.Designer.cs b/Tools/ArdupilotMegaPlanner/JoystickSetup.Designer.cs index 567ecfd7c92f6aad26c9f5d8db3835ca4c121b6a..6b6ab46c6d1fd6c95dcb780a73c9823d3b8439ff 100644 --- a/Tools/ArdupilotMegaPlanner/JoystickSetup.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/JoystickSetup.Designer.cs @@ -70,23 +70,23 @@ this.label13 = new System.Windows.Forms.Label(); this.expo_ch8 = new System.Windows.Forms.TextBox(); this.CMB_CH8 = new System.Windows.Forms.ComboBox(); - this.BUT_detch8 = new ArdupilotMega.MyButton(); + this.BUT_detch8 = new ArdupilotMega.Controls.MyButton(); this.horizontalProgressBar4 = new ArdupilotMega.HorizontalProgressBar(); - this.BUT_detch4 = new ArdupilotMega.MyButton(); - this.BUT_detch3 = new ArdupilotMega.MyButton(); - this.BUT_detch2 = new ArdupilotMega.MyButton(); - this.BUT_detch1 = new ArdupilotMega.MyButton(); - this.BUT_enable = new ArdupilotMega.MyButton(); - this.BUT_save = new ArdupilotMega.MyButton(); + this.BUT_detch4 = new ArdupilotMega.Controls.MyButton(); + this.BUT_detch3 = new ArdupilotMega.Controls.MyButton(); + this.BUT_detch2 = new ArdupilotMega.Controls.MyButton(); + this.BUT_detch1 = new ArdupilotMega.Controls.MyButton(); + this.BUT_enable = new ArdupilotMega.Controls.MyButton(); + this.BUT_save = new ArdupilotMega.Controls.MyButton(); this.progressBar4 = new ArdupilotMega.HorizontalProgressBar(); this.progressBar3 = new ArdupilotMega.HorizontalProgressBar(); this.progressBar2 = new ArdupilotMega.HorizontalProgressBar(); this.progressBar1 = new ArdupilotMega.HorizontalProgressBar(); - this.BUT_detch5 = new ArdupilotMega.MyButton(); + this.BUT_detch5 = new ArdupilotMega.Controls.MyButton(); this.horizontalProgressBar1 = new ArdupilotMega.HorizontalProgressBar(); - this.BUT_detch6 = new ArdupilotMega.MyButton(); + this.BUT_detch6 = new ArdupilotMega.Controls.MyButton(); this.horizontalProgressBar2 = new ArdupilotMega.HorizontalProgressBar(); - this.BUT_detch7 = new ArdupilotMega.MyButton(); + this.BUT_detch7 = new ArdupilotMega.Controls.MyButton(); this.horizontalProgressBar3 = new ArdupilotMega.HorizontalProgressBar(); this.SuspendLayout(); // @@ -625,38 +625,38 @@ private System.Windows.Forms.CheckBox revCH2; private System.Windows.Forms.CheckBox revCH3; private System.Windows.Forms.CheckBox revCH4; - private MyButton BUT_save; - private MyButton BUT_enable; + private ArdupilotMega.Controls.MyButton BUT_save; + private ArdupilotMega.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 MyButton BUT_detch1; - private MyButton BUT_detch2; - private MyButton BUT_detch3; - private MyButton BUT_detch4; + private ArdupilotMega.Controls.MyButton BUT_detch1; + private ArdupilotMega.Controls.MyButton BUT_detch2; + private ArdupilotMega.Controls.MyButton BUT_detch3; + private ArdupilotMega.Controls.MyButton BUT_detch4; private System.Windows.Forms.CheckBox CHK_elevons; - private MyButton BUT_detch5; + private ArdupilotMega.Controls.MyButton BUT_detch5; private System.Windows.Forms.CheckBox revCH5; private System.Windows.Forms.Label label10; private System.Windows.Forms.TextBox expo_ch5; private HorizontalProgressBar horizontalProgressBar1; private System.Windows.Forms.ComboBox CMB_CH5; - private MyButton BUT_detch6; + private ArdupilotMega.Controls.MyButton BUT_detch6; private System.Windows.Forms.CheckBox revCH6; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox expo_ch6; private HorizontalProgressBar horizontalProgressBar2; private System.Windows.Forms.ComboBox CMB_CH6; - private MyButton BUT_detch7; + private ArdupilotMega.Controls.MyButton BUT_detch7; private System.Windows.Forms.CheckBox revCH7; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox expo_ch7; private HorizontalProgressBar horizontalProgressBar3; private System.Windows.Forms.ComboBox CMB_CH7; - private MyButton BUT_detch8; + private ArdupilotMega.Controls.MyButton BUT_detch8; private System.Windows.Forms.CheckBox revCH8; private System.Windows.Forms.Label label13; private System.Windows.Forms.TextBox expo_ch8; diff --git a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs index 92e7c613d49f4a727bbd24f67c813dd715965415..c750515d5c5c5cf670799f2a1851ea02acf31a3f 100644 --- a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs +++ b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs @@ -7,7 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.DirectX.DirectInput; - +using ArdupilotMega.Controls; +using ArdupilotMega.Utilities; namespace ArdupilotMega @@ -408,7 +409,7 @@ namespace ArdupilotMega { MyLabel lbl = new MyLabel(); ComboBox cmbbutton = new ComboBox(); - MyButton mybut = new MyButton(); + ArdupilotMega.Controls.MyButton mybut = new ArdupilotMega.Controls.MyButton(); HorizontalProgressBar hbar = new HorizontalProgressBar(); ComboBox cmbaction = new ComboBox(); @@ -440,7 +441,11 @@ namespace ArdupilotMega cmbaction.Location = new Point(hbar.Right + 5, y); cmbaction.Size = new Size(100, 21); - cmbaction.DataSource = (Enum.GetValues(Common.getModes())); + + cmbaction.DataSource = Common.getModesList(); + cmbaction.ValueMember = "Key"; + cmbaction.DisplayMember = "Value"; + cmbaction.DropDownStyle = ComboBoxStyle.DropDownList; cmbaction.Name = "cmbaction" + name; if (MainV2.config["butaction" + name] != null) diff --git a/Tools/ArdupilotMegaPlanner/JoystickSetup.resx b/Tools/ArdupilotMegaPlanner/JoystickSetup.resx index 9b38147048441121b14782ec38cc3762f08c8e56..1912c313d486c68ec03935bef7acf3e6524333e7 100644 --- a/Tools/ArdupilotMegaPlanner/JoystickSetup.resx +++ b/Tools/ArdupilotMegaPlanner/JoystickSetup.resx @@ -1258,7 +1258,7 @@ <value>BUT_detch8</value> </data> <data name=">>BUT_detch8.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch8.Parent" xml:space="preserve"> <value>$this</value> @@ -1309,7 +1309,7 @@ <value>BUT_detch4</value> </data> <data name=">>BUT_detch4.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch4.Parent" xml:space="preserve"> <value>$this</value> @@ -1336,7 +1336,7 @@ <value>BUT_detch3</value> </data> <data name=">>BUT_detch3.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch3.Parent" xml:space="preserve"> <value>$this</value> @@ -1363,7 +1363,7 @@ <value>BUT_detch2</value> </data> <data name=">>BUT_detch2.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch2.Parent" xml:space="preserve"> <value>$this</value> @@ -1390,7 +1390,7 @@ <value>BUT_detch1</value> </data> <data name=">>BUT_detch1.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch1.Parent" xml:space="preserve"> <value>$this</value> @@ -1417,7 +1417,7 @@ <value>BUT_enable</value> </data> <data name=">>BUT_enable.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_enable.Parent" xml:space="preserve"> <value>$this</value> @@ -1444,7 +1444,7 @@ <value>BUT_save</value> </data> <data name=">>BUT_save.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_save.Parent" xml:space="preserve"> <value>$this</value> @@ -1567,7 +1567,7 @@ <value>BUT_detch5</value> </data> <data name=">>BUT_detch5.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch5.Parent" xml:space="preserve"> <value>$this</value> @@ -1618,7 +1618,7 @@ <value>BUT_detch6</value> </data> <data name=">>BUT_detch6.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch6.Parent" xml:space="preserve"> <value>$this</value> @@ -1669,7 +1669,7 @@ <value>BUT_detch7</value> </data> <data name=">>BUT_detch7.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_detch7.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/Log.Designer.cs b/Tools/ArdupilotMegaPlanner/Log.Designer.cs index 97aeebba07bff47fde6f8bfa480182665929e9e8..5268c07d9e4f175b7b60dceeceaca94ac20b11d9 100644 --- a/Tools/ArdupilotMegaPlanner/Log.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Log.Designer.cs @@ -30,13 +30,13 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Log)); this.TXT_seriallog = new System.Windows.Forms.TextBox(); - this.BUT_DLall = new ArdupilotMega.MyButton(); - this.BUT_DLthese = new ArdupilotMega.MyButton(); - this.BUT_clearlogs = new ArdupilotMega.MyButton(); + this.BUT_DLall = new ArdupilotMega.Controls.MyButton(); + this.BUT_DLthese = new ArdupilotMega.Controls.MyButton(); + this.BUT_clearlogs = new ArdupilotMega.Controls.MyButton(); this.CHK_logs = new System.Windows.Forms.CheckedListBox(); this.TXT_status = new System.Windows.Forms.TextBox(); - this.BUT_redokml = new ArdupilotMega.MyButton(); - this.BUT_firstperson = new ArdupilotMega.MyButton(); + this.BUT_redokml = new ArdupilotMega.Controls.MyButton(); + this.BUT_firstperson = new ArdupilotMega.Controls.MyButton(); this.SuspendLayout(); // // TXT_seriallog @@ -114,13 +114,13 @@ #endregion - private MyButton BUT_DLall; - private MyButton BUT_DLthese; - private MyButton BUT_clearlogs; + private ArdupilotMega.Controls.MyButton BUT_DLall; + private ArdupilotMega.Controls.MyButton BUT_DLthese; + private ArdupilotMega.Controls.MyButton BUT_clearlogs; private System.Windows.Forms.CheckedListBox CHK_logs; private System.Windows.Forms.TextBox TXT_status; - private MyButton BUT_redokml; + private ArdupilotMega.Controls.MyButton BUT_redokml; private System.Windows.Forms.TextBox TXT_seriallog; - private MyButton BUT_firstperson; + private ArdupilotMega.Controls.MyButton BUT_firstperson; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Log.cs b/Tools/ArdupilotMegaPlanner/Log.cs index 5bef471ab66af891c2b3195dd2473da43ca2d629..520c59ac4425a4a8371ef0d8fe1c87a3ac307718 100644 --- a/Tools/ArdupilotMegaPlanner/Log.cs +++ b/Tools/ArdupilotMegaPlanner/Log.cs @@ -17,6 +17,7 @@ using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Checksums; using ICSharpCode.SharpZipLib.Core; using log4net; +using ArdupilotMega.Comms; namespace ArdupilotMega diff --git a/Tools/ArdupilotMegaPlanner/Log.resx b/Tools/ArdupilotMegaPlanner/Log.resx index b1e09b2bb41769c75905bbf38eb1b9771878e7d8..cf6b035012933b6bcba080dc2579a42da1b25251 100644 --- a/Tools/ArdupilotMegaPlanner/Log.resx +++ b/Tools/ArdupilotMegaPlanner/Log.resx @@ -159,7 +159,7 @@ <value>BUT_DLall</value> </data> <data name=">>BUT_DLall.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_DLall.Parent" xml:space="preserve"> <value>$this</value> @@ -183,7 +183,7 @@ <value>BUT_DLthese</value> </data> <data name=">>BUT_DLthese.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_DLthese.Parent" xml:space="preserve"> <value>$this</value> @@ -207,7 +207,7 @@ <value>BUT_clearlogs</value> </data> <data name=">>BUT_clearlogs.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_clearlogs.Parent" xml:space="preserve"> <value>$this</value> @@ -276,7 +276,7 @@ <value>BUT_redokml</value> </data> <data name=">>BUT_redokml.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_redokml.Parent" xml:space="preserve"> <value>$this</value> @@ -300,7 +300,7 @@ <value>BUT_firstperson</value> </data> <data name=">>BUT_firstperson.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_firstperson.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/LogBrowse.designer.cs b/Tools/ArdupilotMegaPlanner/LogBrowse.designer.cs index e262c3dc0ec247817c13725e6d9fdbeb1a9ebf0a..aa1db0eff6048619701dd24ed144190e45cd1919 100644 --- a/Tools/ArdupilotMegaPlanner/LogBrowse.designer.cs +++ b/Tools/ArdupilotMegaPlanner/LogBrowse.designer.cs @@ -32,9 +32,9 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LogBrowse)); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.zg1 = new ZedGraph.ZedGraphControl(); - this.Graphit = new ArdupilotMega.MyButton(); - this.BUT_cleargraph = new ArdupilotMega.MyButton(); - this.BUT_loadlog = new ArdupilotMega.MyButton(); + this.Graphit = new ArdupilotMega.Controls.MyButton(); + this.BUT_cleargraph = new ArdupilotMega.Controls.MyButton(); + this.BUT_loadlog = new ArdupilotMega.Controls.MyButton(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); @@ -107,9 +107,9 @@ private System.Windows.Forms.DataGridView dataGridView1; private ZedGraph.ZedGraphControl zg1; - private MyButton Graphit; - private MyButton BUT_cleargraph; - private MyButton BUT_loadlog; + private ArdupilotMega.Controls.MyButton Graphit; + private ArdupilotMega.Controls.MyButton BUT_cleargraph; + private ArdupilotMega.Controls.MyButton BUT_loadlog; private System.Windows.Forms.ToolTip toolTip1; } } diff --git a/Tools/ArdupilotMegaPlanner/LogBrowse.resx b/Tools/ArdupilotMegaPlanner/LogBrowse.resx index f122be17d458741355e2f55497bbc04dd90257dc..93a5287ca166f1d4812a8365d813600e782dc3f2 100644 --- a/Tools/ArdupilotMegaPlanner/LogBrowse.resx +++ b/Tools/ArdupilotMegaPlanner/LogBrowse.resx @@ -193,7 +193,7 @@ <value>Graphit</value> </data> <data name=">>Graphit.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>Graphit.Parent" xml:space="preserve"> <value>$this</value> @@ -220,7 +220,7 @@ <value>BUT_cleargraph</value> </data> <data name=">>BUT_cleargraph.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_cleargraph.Parent" xml:space="preserve"> <value>$this</value> @@ -247,7 +247,7 @@ <value>BUT_loadlog</value> </data> <data name=">>BUT_loadlog.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_loadlog.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/MAVLink.cs b/Tools/ArdupilotMegaPlanner/MAVLink.cs index b9fa51deecafffcaeb97154d8c17e7b4dcd8d9be..485ef2a42afc9ea0332ae8a6a4f8d778e09df7eb 100644 --- a/Tools/ArdupilotMegaPlanner/MAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/MAVLink.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text; -using System.IO.Ports; using System.Runtime.InteropServices; using System.Collections; // hashs using System.Diagnostics; // stopwatch @@ -13,6 +12,7 @@ using System.Threading; using ArdupilotMega.Controls; using System.ComponentModel; using log4net; +using ArdupilotMega.Comms; namespace ArdupilotMega { @@ -1027,9 +1027,9 @@ namespace ArdupilotMega public void requestDatastream(byte id, byte hzrate) { - - double pps = 0; /* + double pps = 0; + switch (id) { case (byte)MAVLink.MAV_DATA_STREAM.ALL: @@ -1962,7 +1962,7 @@ namespace ArdupilotMega // test fabs idea - http://diydrones.com/profiles/blogs/flying-with-joystick?commentId=705844%3AComment%3A818712&xg_source=msg_com_blogpost if (BaseStream.IsOpen && BaseStream.BytesToWrite > 0) { - // slow down execution. + // slow down execution. else 100% cpu Thread.Sleep(1); return new byte[0]; } @@ -2161,8 +2161,18 @@ namespace ArdupilotMega { log.InfoFormat("Mavlink Bad Packet (Len Fail) len {0} pkno {1}", temp.Length, temp[5]); #if MAVLINK10 - if (temp.Length == 11 && temp[0] == 'U' && temp[5] == 0) - throw new Exception("Mavlink 0.9 Heartbeat, Please upgrade your AP, This planner is for Mavlink 1.0\n\n"); + if (temp.Length == 11 && temp[0] == 'U' && temp[5] == 0){ + string message ="Mavlink 0.9 Heartbeat, Please upgrade your AP, This planner is for Mavlink 1.0\n\n"; + System.Windows.Forms.CustomMessageBox.Show(message); + throw new Exception(message); + } +#else + if (temp.Length == 17 && temp[0] == 254 && temp[5] == 0) + { + string message = "Mavlink 1.0 Heartbeat, Please Upgrade your Mission Planner, This planner is for Mavlink 0.9\n\n"; + System.Windows.Forms.CustomMessageBox.Show(message); + throw new Exception(message); + } #endif return new byte[0]; } diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs index 83e817b7e129e5d49519fec508bb34ec989ca657..be039b53e84903bd924fb0178c59d1c07a9168c0 100644 --- a/Tools/ArdupilotMegaPlanner/MainV2.cs +++ b/Tools/ArdupilotMegaPlanner/MainV2.cs @@ -7,7 +7,6 @@ using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; -using System.IO.Ports; using System.IO; using System.Xml; using System.Collections; @@ -24,6 +23,9 @@ using IronPython.Hosting; using log4net; using ArdupilotMega.Controls; using System.Security.Cryptography; +using ArdupilotMega.Comms; +using ArdupilotMega.Arduino; +using System.IO.Ports; namespace ArdupilotMega { @@ -197,7 +199,7 @@ namespace ArdupilotMega // CMB_serialport.SelectedIndex = 0; // } // ** new - _connectionControl.CMB_serialport.Items.AddRange(SerialPort.GetPortNames()); + _connectionControl.CMB_serialport.Items.AddRange(ArdupilotMega.Comms.SerialPort.GetPortNames()); _connectionControl.CMB_serialport.Items.Add("TCP"); _connectionControl.CMB_serialport.Items.Add("UDP"); if (_connectionControl.CMB_serialport.Items.Count > 0) @@ -356,7 +358,7 @@ namespace ArdupilotMega { string oldport = _connectionControl.CMB_serialport.Text; _connectionControl.CMB_serialport.Items.Clear(); - _connectionControl.CMB_serialport.Items.AddRange(SerialPort.GetPortNames()); + _connectionControl.CMB_serialport.Items.AddRange(ArdupilotMega.Comms.SerialPort.GetPortNames()); _connectionControl.CMB_serialport.Items.Add("TCP"); _connectionControl.CMB_serialport.Items.Add("UDP"); if (_connectionControl.CMB_serialport.Items.Contains(oldport)) @@ -565,7 +567,7 @@ namespace ArdupilotMega } else { - comPort.BaseStream = new SerialPort(); + comPort.BaseStream = new ArdupilotMega.Comms.SerialPort(); } try @@ -700,7 +702,7 @@ namespace ArdupilotMega else { _connectionControl.CMB_baudrate.Enabled = true; - MainV2.comPort.BaseStream = new ArdupilotMega.SerialPort(); + MainV2.comPort.BaseStream = new ArdupilotMega.Comms.SerialPort(); } try diff --git a/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs b/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs index cd4e7d8217cd2925c0d4eaec39e4eccbe9c120a8..0a77c3dfce3f8356cf7530d745530f7f5c5bc7b7 100644 --- a/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs @@ -29,10 +29,10 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MavlinkLog)); - this.BUT_redokml = new ArdupilotMega.MyButton(); + this.BUT_redokml = new ArdupilotMega.Controls.MyButton(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.BUT_humanreadable = new ArdupilotMega.MyButton(); - this.BUT_graphmavlog = new ArdupilotMega.MyButton(); + this.BUT_humanreadable = new ArdupilotMega.Controls.MyButton(); + this.BUT_graphmavlog = new ArdupilotMega.Controls.MyButton(); this.zg1 = new ZedGraph.ZedGraphControl(); this.SuspendLayout(); // @@ -91,10 +91,10 @@ #endregion - private MyButton BUT_redokml; + private ArdupilotMega.Controls.MyButton BUT_redokml; private System.Windows.Forms.ProgressBar progressBar1; - private MyButton BUT_humanreadable; - private MyButton BUT_graphmavlog; + private ArdupilotMega.Controls.MyButton BUT_humanreadable; + private ArdupilotMega.Controls.MyButton BUT_graphmavlog; private ZedGraph.ZedGraphControl zg1; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/MavlinkLog.resx b/Tools/ArdupilotMegaPlanner/MavlinkLog.resx index 9406a8df5f5c8e352a2b35f7e11b4af4a9380923..ec4f313eb2a2ab97a40ae6a344603890235fe1f4 100644 --- a/Tools/ArdupilotMegaPlanner/MavlinkLog.resx +++ b/Tools/ArdupilotMegaPlanner/MavlinkLog.resx @@ -139,7 +139,7 @@ <value>BUT_redokml</value> </data> <data name=">>BUT_redokml.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_redokml.Parent" xml:space="preserve"> <value>$this</value> @@ -193,7 +193,7 @@ <value>BUT_humanreadable</value> </data> <data name=">>BUT_humanreadable.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_humanreadable.Parent" xml:space="preserve"> <value>$this</value> @@ -223,7 +223,7 @@ <value>BUT_graphmavlog</value> </data> <data name=">>BUT_graphmavlog.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_graphmavlog.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/Msi/wix.pdb b/Tools/ArdupilotMegaPlanner/Msi/wix.pdb index 2d3c43918b28a85dab27db8f74975b70e7568756..a80ac1fd2da69224d03866940c09c8d5d87c5271 100644 Binary files a/Tools/ArdupilotMegaPlanner/Msi/wix.pdb and b/Tools/ArdupilotMegaPlanner/Msi/wix.pdb differ diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index f7879443a53a50a0cea171cfa286bb6acc7d8565..9df71d799de5fefeaa52eae24e42a2be073206c9 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs +++ b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ using System.Resources; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.*")] -[assembly: AssemblyFileVersion("1.1.74")] +[assembly: AssemblyFileVersion("1.1.75")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/RAW_Sensor.Designer.cs b/Tools/ArdupilotMegaPlanner/RAW_Sensor.Designer.cs index 33fc751bc742c2817a2fa5d5d51a95659a77911b..15d24263fa2b0a8b5786b711730908d582ad266e 100644 --- a/Tools/ArdupilotMegaPlanner/RAW_Sensor.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/RAW_Sensor.Designer.cs @@ -53,7 +53,7 @@ this.horizontalProgressBar2 = new ArdupilotMega.HorizontalProgressBar(); this.horizontalProgressBar1 = new ArdupilotMega.HorizontalProgressBar(); this.tabRawSensor = new System.Windows.Forms.TabPage(); - this.BUT_savecsv = new ArdupilotMega.MyButton(); + this.BUT_savecsv = new ArdupilotMega.Controls.MyButton(); this.label3 = new System.Windows.Forms.Label(); this.CMB_rawupdaterate = new System.Windows.Forms.ComboBox(); this.aGauge1 = new AGaugeApp.AGauge(); @@ -1129,7 +1129,7 @@ private VerticalProgressBar verticalProgressBar2; private VerticalProgressBar verticalProgressBar1; private System.Windows.Forms.TabControl tabControl; - private MyButton BUT_savecsv; + private ArdupilotMega.Controls.MyButton BUT_savecsv; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/RAW_Sensor.resx b/Tools/ArdupilotMegaPlanner/RAW_Sensor.resx index e16890666dcc5f273550227be877e6ff38e3fb87..44efc71179e1b5dbf4818f13c527fb0c5e0af4e5 100644 --- a/Tools/ArdupilotMegaPlanner/RAW_Sensor.resx +++ b/Tools/ArdupilotMegaPlanner/RAW_Sensor.resx @@ -558,7 +558,7 @@ <value>BUT_savecsv</value> </data> <data name=">>BUT_savecsv.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c</value> </data> <data name=">>BUT_savecsv.Parent" xml:space="preserve"> <value>tabRawSensor</value> diff --git a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.Designer.cs b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.Designer.cs index aa2773fdfc016b0697efbfb05e73af90178e5587..ba32270f0c54a29767b7d8a7f4ab324af8165ea1 100644 --- a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.Designer.cs @@ -73,13 +73,13 @@ this.ATI = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); - this.BUT_savesettings = new ArdupilotMega.MyButton(); - this.BUT_getcurrent = new ArdupilotMega.MyButton(); + this.BUT_savesettings = new ArdupilotMega.Controls.MyButton(); + this.BUT_getcurrent = new ArdupilotMega.Controls.MyButton(); this.lbl_status = new System.Windows.Forms.Label(); - this.BUT_upload = new ArdupilotMega.MyButton(); - this.BUT_syncS2 = new ArdupilotMega.MyButton(); - this.BUT_syncS3 = new ArdupilotMega.MyButton(); - this.BUT_syncS5 = new ArdupilotMega.MyButton(); + this.BUT_upload = new ArdupilotMega.Controls.MyButton(); + this.BUT_syncS2 = new ArdupilotMega.Controls.MyButton(); + this.BUT_syncS3 = new ArdupilotMega.Controls.MyButton(); + this.BUT_syncS5 = new ArdupilotMega.Controls.MyButton(); this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); @@ -98,9 +98,9 @@ this.label30 = new System.Windows.Forms.Label(); this.label31 = new System.Windows.Forms.Label(); this.label32 = new System.Windows.Forms.Label(); - this.BUT_syncS8 = new ArdupilotMega.MyButton(); - this.BUT_syncS9 = new ArdupilotMega.MyButton(); - this.BUT_syncS10 = new ArdupilotMega.MyButton(); + this.BUT_syncS8 = new ArdupilotMega.Controls.MyButton(); + this.BUT_syncS9 = new ArdupilotMega.Controls.MyButton(); + this.BUT_syncS10 = new ArdupilotMega.Controls.MyButton(); this.SuspendLayout(); // // Progressbar @@ -858,12 +858,12 @@ #endregion - private MyButton BUT_upload; + private ArdupilotMega.Controls.MyButton BUT_upload; private System.Windows.Forms.ProgressBar Progressbar; private System.Windows.Forms.Label lbl_status; private System.Windows.Forms.ComboBox S1; private System.Windows.Forms.Label label1; - private MyButton BUT_getcurrent; + private ArdupilotMega.Controls.MyButton BUT_getcurrent; private System.Windows.Forms.TextBox S0; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; @@ -878,7 +878,7 @@ private System.Windows.Forms.CheckBox S6; private System.Windows.Forms.Label label8; private System.Windows.Forms.CheckBox S7; - private MyButton BUT_savesettings; + private ArdupilotMega.Controls.MyButton BUT_savesettings; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.CheckBox RS7; private System.Windows.Forms.CheckBox RS6; @@ -895,9 +895,9 @@ private System.Windows.Forms.TextBox RSSI; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label12; - private MyButton BUT_syncS2; - private MyButton BUT_syncS3; - private MyButton BUT_syncS5; + private ArdupilotMega.Controls.MyButton BUT_syncS2; + private ArdupilotMega.Controls.MyButton BUT_syncS3; + private ArdupilotMega.Controls.MyButton BUT_syncS5; private System.Windows.Forms.ComboBox S9; private System.Windows.Forms.ComboBox S10; private System.Windows.Forms.ComboBox S11; @@ -926,8 +926,8 @@ private System.Windows.Forms.Label label30; private System.Windows.Forms.Label label31; private System.Windows.Forms.Label label32; - private MyButton BUT_syncS8; - private MyButton BUT_syncS9; - private MyButton BUT_syncS10; + private ArdupilotMega.Controls.MyButton BUT_syncS8; + private ArdupilotMega.Controls.MyButton BUT_syncS9; + private ArdupilotMega.Controls.MyButton BUT_syncS10; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs index d1b6f9ad9acc6843669277e32b5625a7aa0b52c6..56fdc082002c616b7461c609fd871c1f3f1d8e71 100644 --- a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs +++ b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs @@ -9,6 +9,8 @@ using System.Windows.Forms; using System.Net; using System.IO; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Arduino; +using ArdupilotMega.Comms; namespace ArdupilotMega { @@ -226,7 +228,7 @@ S13: MANCHESTER=0 private void BUT_savesettings_Click(object sender, EventArgs e) { - ArdupilotMega.ICommsSerial comPort = new SerialPort(); + ArdupilotMega.Comms.ICommsSerial comPort = new SerialPort(); try { @@ -402,7 +404,7 @@ S13: MANCHESTER=0 private void BUT_getcurrent_Click(object sender, EventArgs e) { - ArdupilotMega.ICommsSerial comPort = new SerialPort(); + ArdupilotMega.Comms.ICommsSerial comPort = new SerialPort(); try { @@ -531,7 +533,7 @@ S13: MANCHESTER=0 BUT_savesettings.Enabled = true; } - string Serial_ReadLine(ArdupilotMega.ICommsSerial comPort) + string Serial_ReadLine(ArdupilotMega.Comms.ICommsSerial comPort) { StringBuilder sb = new StringBuilder(); DateTime Deadline = DateTime.Now.AddMilliseconds(comPort.ReadTimeout); @@ -550,7 +552,7 @@ S13: MANCHESTER=0 return sb.ToString(); } - string doCommand(ArdupilotMega.ICommsSerial comPort, string cmd, int level = 0) + string doCommand(ArdupilotMega.Comms.ICommsSerial comPort, string cmd, int level = 0) { if (!comPort.IsOpen) return ""; @@ -602,7 +604,7 @@ S13: MANCHESTER=0 return ans; } - bool doConnect(ArdupilotMega.ICommsSerial comPort) + bool doConnect(ArdupilotMega.Comms.ICommsSerial comPort) { // clear buffer comPort.DiscardInBuffer(); diff --git a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.resx b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.resx index 99cb96659b7ba14238374113953ce98043c39f25..d13b7ec707a4a49f4e0e5ee433e46402c0e71594 100644 --- a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.resx +++ b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.resx @@ -1959,7 +1959,7 @@ which result in a valid packet CRC <value>BUT_savesettings</value> </data> <data name=">>BUT_savesettings.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_savesettings.Parent" xml:space="preserve"> <value>$this</value> @@ -1986,7 +1986,7 @@ which result in a valid packet CRC <value>BUT_getcurrent</value> </data> <data name=">>BUT_getcurrent.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_getcurrent.Parent" xml:space="preserve"> <value>$this</value> @@ -2037,7 +2037,7 @@ which result in a valid packet CRC <value>BUT_upload</value> </data> <data name=">>BUT_upload.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_upload.Parent" xml:space="preserve"> <value>$this</value> @@ -2061,7 +2061,7 @@ which result in a valid packet CRC <value>BUT_syncS2</value> </data> <data name=">>BUT_syncS2.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_syncS2.Parent" xml:space="preserve"> <value>$this</value> @@ -2085,7 +2085,7 @@ which result in a valid packet CRC <value>BUT_syncS3</value> </data> <data name=">>BUT_syncS3.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_syncS3.Parent" xml:space="preserve"> <value>$this</value> @@ -2109,7 +2109,7 @@ which result in a valid packet CRC <value>BUT_syncS5</value> </data> <data name=">>BUT_syncS5.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_syncS5.Parent" xml:space="preserve"> <value>$this</value> @@ -2715,7 +2715,7 @@ which result in a valid packet CRC <value>BUT_syncS8</value> </data> <data name=">>BUT_syncS8.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_syncS8.Parent" xml:space="preserve"> <value>$this</value> @@ -2742,7 +2742,7 @@ which result in a valid packet CRC <value>BUT_syncS9</value> </data> <data name=">>BUT_syncS9.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_syncS9.Parent" xml:space="preserve"> <value>$this</value> @@ -2769,7 +2769,7 @@ which result in a valid packet CRC <value>BUT_syncS10</value> </data> <data name=">>BUT_syncS10.Type" xml:space="preserve"> - <value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4494.22181, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_syncS10.Parent" xml:space="preserve"> <value>$this</value> diff --git a/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs b/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs index babfd7e31572c9f2a9e9c3b4f816b4a38f76033e..06d99e0a851c488ea83bba3ce1fce94fa168cede 100644 --- a/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs @@ -30,7 +30,7 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SerialInput)); this.CMB_serialport = new System.Windows.Forms.ComboBox(); - this.BUT_connect = new ArdupilotMega.MyButton(); + this.BUT_connect = new ArdupilotMega.Controls.MyButton(); this.CMB_baudrate = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.LBL_location = new System.Windows.Forms.Label(); @@ -125,7 +125,7 @@ #endregion private System.Windows.Forms.ComboBox CMB_serialport; - private MyButton BUT_connect; + private ArdupilotMega.Controls.MyButton BUT_connect; private System.Windows.Forms.ComboBox CMB_baudrate; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label LBL_location; diff --git a/Tools/ArdupilotMegaPlanner/SerialOutput.Designer.cs b/Tools/ArdupilotMegaPlanner/SerialOutput.Designer.cs index 099d4b32b56efca4ea82bf62ba437a9f883cfb3b..1f57d7eefd93e15724453dd86ff268234bad02a3 100644 --- a/Tools/ArdupilotMegaPlanner/SerialOutput.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/SerialOutput.Designer.cs @@ -30,7 +30,7 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SerialOutput)); this.CMB_serialport = new System.Windows.Forms.ComboBox(); - this.BUT_connect = new ArdupilotMega.MyButton(); + this.BUT_connect = new ArdupilotMega.Controls.MyButton(); this.CMB_baudrate = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); // @@ -90,7 +90,7 @@ #endregion private System.Windows.Forms.ComboBox CMB_serialport; - private MyButton BUT_connect; + private ArdupilotMega.Controls.MyButton BUT_connect; private System.Windows.Forms.ComboBox CMB_baudrate; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/ThemeManager.cs b/Tools/ArdupilotMegaPlanner/ThemeManager.cs index 859cd8e7d4411e328920bb4ccc8d3a04e4ab9eda..c15b74ec62bacae1065af70cd9f47fec6c0ef836 100644 --- a/Tools/ArdupilotMegaPlanner/ThemeManager.cs +++ b/Tools/ArdupilotMegaPlanner/ThemeManager.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; using log4net; +using ArdupilotMega.Controls; namespace ArdupilotMega { @@ -84,7 +85,7 @@ namespace ArdupilotMega { Color PrimeColor = Color.FromArgb(0x94, 0xc1, 0x1f); - MyButton but = (MyButton)ctl; + ArdupilotMega.Controls.MyButton but = (MyButton)ctl; //but.BGGradTop = Color.FromArgb(PrimeColor.R, PrimeColor.G, PrimeColor.B); //but.BGGradBot = Color.FromArgb(255 - (int)(PrimeColor.R * 0.27), 255 - (int)(PrimeColor.G * 0.14), 255 - (int)(PrimeColor.B * 0.79)); //but.ForeColor = Color.FromArgb(0x40, 0x57, 0x04); //Color.FromArgb(255 - (int)(PrimeColor.R * 0.7), 255 - (int)(PrimeColor.G * 0.8), 255 - (int)(PrimeColor.B * 0.1)); diff --git a/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj b/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj index 8b7bd960df71064e927cde302631a024904f0afb..11c4d121c40274c91ac917426854600a17467c84 100644 --- a/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj +++ b/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj @@ -56,7 +56,8 @@ <SignAssembly>false</SignAssembly> </PropertyGroup> <PropertyGroup> - <AssemblyOriginatorKeyFile>mykey.pfx</AssemblyOriginatorKeyFile> + <AssemblyOriginatorKeyFile> + </AssemblyOriginatorKeyFile> </PropertyGroup> <ItemGroup> <Reference Include="System" /> @@ -80,7 +81,6 @@ <DesignTime>True</DesignTime> </Compile> <None Include="app.config" /> - <None Include="mykey.pfx" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/aircraft/arducopter/Models/_propeller0_.skb b/Tools/ArdupilotMegaPlanner/bin/Release/aircraft/arducopter/Models/_propeller0_.skb deleted file mode 100644 index 700b26fc31b08bcf5a75f298ce80e6115710d7a1..0000000000000000000000000000000000000000 Binary files a/Tools/ArdupilotMegaPlanner/bin/Release/aircraft/arducopter/Models/_propeller0_.skb and /dev/null differ diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/aircraft/arducopter/Models/_propeller0_.skp b/Tools/ArdupilotMegaPlanner/bin/Release/aircraft/arducopter/Models/_propeller0_.skp deleted file mode 100644 index d525f6e3f18177d89e61ed3a8c1a322f9dfb169e..0000000000000000000000000000000000000000 Binary files a/Tools/ArdupilotMegaPlanner/bin/Release/aircraft/arducopter/Models/_propeller0_.skp and /dev/null differ diff --git a/Tools/ArdupilotMegaPlanner/georefimage.cs b/Tools/ArdupilotMegaPlanner/georefimage.cs index 17c166f02e383982facbaa1a348676ff4ec0ed2c..21b6374671640bf3118a50c08e5bbd2cad6b140e 100644 --- a/Tools/ArdupilotMegaPlanner/georefimage.cs +++ b/Tools/ArdupilotMegaPlanner/georefimage.cs @@ -19,16 +19,16 @@ namespace ArdupilotMega { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private OpenFileDialog openFileDialog1; - private MyButton BUT_browselog; - private MyButton BUT_browsedir; + private ArdupilotMega.Controls.MyButton BUT_browselog; + private ArdupilotMega.Controls.MyButton BUT_browsedir; private TextBox TXT_logfile; private TextBox TXT_jpgdir; private TextBox TXT_offsetseconds; - private MyButton BUT_doit; + private ArdupilotMega.Controls.MyButton BUT_doit; private FolderBrowserDialog folderBrowserDialog1; private Label label1; private TextBox TXT_outputlog; - private MyButton BUT_estoffset; + private ArdupilotMega.Controls.MyButton BUT_estoffset; int latpos = 4, lngpos = 5, altpos = 7, cogpos = 9; private NumericUpDown numericUpDown1; @@ -40,7 +40,7 @@ namespace ArdupilotMega private Label label4; private Label label5; private Label label6; - private MyButton BUT_Geotagimages; + private ArdupilotMega.Controls.MyButton BUT_Geotagimages; internal Georefimage() { InitializeComponent(); @@ -419,11 +419,11 @@ namespace ArdupilotMega this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.TXT_outputlog = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); - this.BUT_Geotagimages = new ArdupilotMega.MyButton(); - this.BUT_estoffset = new ArdupilotMega.MyButton(); - this.BUT_doit = new ArdupilotMega.MyButton(); - this.BUT_browsedir = new ArdupilotMega.MyButton(); - this.BUT_browselog = new ArdupilotMega.MyButton(); + this.BUT_Geotagimages = new ArdupilotMega.Controls.MyButton(); + this.BUT_estoffset = new ArdupilotMega.Controls.MyButton(); + this.BUT_doit = new ArdupilotMega.Controls.MyButton(); + this.BUT_browsedir = new ArdupilotMega.Controls.MyButton(); + this.BUT_browselog = new ArdupilotMega.Controls.MyButton(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); diff --git a/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs b/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs index 8e87811847128d6e63a7e118d5392ebfe5cd12f7..2d90d5f5d04b7e38584fc33304c15e72a311f88a 100644 --- a/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/paramcompare.Designer.cs @@ -34,7 +34,7 @@ this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.newvalue = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Use = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.BUT_save = new ArdupilotMega.MyButton(); + this.BUT_save = new ArdupilotMega.Controls.MyButton(); this.CHK_toggleall = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit(); this.SuspendLayout(); @@ -124,7 +124,7 @@ #endregion private System.Windows.Forms.DataGridView Params; - private MyButton BUT_save; + private ArdupilotMega.Controls.MyButton BUT_save; private System.Windows.Forms.DataGridViewTextBoxColumn Command; private System.Windows.Forms.DataGridViewTextBoxColumn Value; private System.Windows.Forms.DataGridViewTextBoxColumn newvalue; diff --git a/Tools/ArdupilotMegaPlanner/temp.Designer.cs b/Tools/ArdupilotMegaPlanner/temp.Designer.cs index 767443ebc44368746d1461e69fdd913df24fe8a2..1f5e4d0834ec36dd3a408939704ce32dd002511e 100644 --- a/Tools/ArdupilotMegaPlanner/temp.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/temp.Designer.cs @@ -28,26 +28,26 @@ /// </summary> private void InitializeComponent() { - this.button1 = new ArdupilotMega.MyButton(); - this.BUT_wipeeeprom = new ArdupilotMega.MyButton(); - this.BUT_flashdl = new ArdupilotMega.MyButton(); - this.BUT_flashup = new ArdupilotMega.MyButton(); - this.BUT_dleeprom = new ArdupilotMega.MyButton(); - this.BUT_copy1280 = new ArdupilotMega.MyButton(); - this.BUT_copy2560 = new ArdupilotMega.MyButton(); - this.BUT_copyto2560 = new ArdupilotMega.MyButton(); - this.BUT_copyto1280 = new ArdupilotMega.MyButton(); - this.button2 = new ArdupilotMega.MyButton(); + this.button1 = new ArdupilotMega.Controls.MyButton(); + this.BUT_wipeeeprom = new ArdupilotMega.Controls.MyButton(); + this.BUT_flashdl = new ArdupilotMega.Controls.MyButton(); + this.BUT_flashup = new ArdupilotMega.Controls.MyButton(); + this.BUT_dleeprom = new ArdupilotMega.Controls.MyButton(); + this.BUT_copy1280 = new ArdupilotMega.Controls.MyButton(); + this.BUT_copy2560 = new ArdupilotMega.Controls.MyButton(); + this.BUT_copyto2560 = new ArdupilotMega.Controls.MyButton(); + this.BUT_copyto1280 = new ArdupilotMega.Controls.MyButton(); + this.button2 = new ArdupilotMega.Controls.MyButton(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); - this.BUT_geinjection = new ArdupilotMega.MyButton(); - this.BUT_clearcustommaps = new ArdupilotMega.MyButton(); - this.BUT_lang_edit = new ArdupilotMega.MyButton(); - this.BUT_georefimage = new ArdupilotMega.MyButton(); - this.BUT_follow_me = new ArdupilotMega.MyButton(); - this.BUT_ant_track = new ArdupilotMega.MyButton(); - this.BUT_magcalib = new ArdupilotMega.MyButton(); + this.BUT_geinjection = new ArdupilotMega.Controls.MyButton(); + this.BUT_clearcustommaps = new ArdupilotMega.Controls.MyButton(); + this.BUT_lang_edit = new ArdupilotMega.Controls.MyButton(); + this.BUT_georefimage = new ArdupilotMega.Controls.MyButton(); + this.BUT_follow_me = new ArdupilotMega.Controls.MyButton(); + this.BUT_ant_track = new ArdupilotMega.Controls.MyButton(); + this.BUT_magcalib = new ArdupilotMega.Controls.MyButton(); this.SuspendLayout(); // // button1 @@ -279,26 +279,26 @@ #endregion - private MyButton button1; - private MyButton BUT_wipeeeprom; - private MyButton BUT_flashdl; - private MyButton BUT_flashup; - private MyButton BUT_dleeprom; - private MyButton BUT_copy1280; - private MyButton BUT_copy2560; - private MyButton BUT_copyto2560; - private MyButton BUT_copyto1280; - private MyButton button2; + private ArdupilotMega.Controls.MyButton button1; + private ArdupilotMega.Controls.MyButton BUT_wipeeeprom; + private ArdupilotMega.Controls.MyButton BUT_flashdl; + private ArdupilotMega.Controls.MyButton BUT_flashup; + private ArdupilotMega.Controls.MyButton BUT_dleeprom; + private ArdupilotMega.Controls.MyButton BUT_copy1280; + private ArdupilotMega.Controls.MyButton BUT_copy2560; + private ArdupilotMega.Controls.MyButton BUT_copyto2560; + private ArdupilotMega.Controls.MyButton BUT_copyto1280; + private ArdupilotMega.Controls.MyButton button2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; - private MyButton BUT_geinjection; - private MyButton BUT_clearcustommaps; - private MyButton BUT_lang_edit; - private MyButton BUT_georefimage; - private MyButton BUT_follow_me; - private MyButton BUT_ant_track; - private MyButton BUT_magcalib; + private ArdupilotMega.Controls.MyButton BUT_geinjection; + private ArdupilotMega.Controls.MyButton BUT_clearcustommaps; + private ArdupilotMega.Controls.MyButton BUT_lang_edit; + private ArdupilotMega.Controls.MyButton BUT_georefimage; + private ArdupilotMega.Controls.MyButton BUT_follow_me; + private ArdupilotMega.Controls.MyButton BUT_ant_track; + private ArdupilotMega.Controls.MyButton BUT_magcalib; //private SharpVectors.Renderers.Forms.SvgPictureBox svgPictureBox1; } diff --git a/Tools/ArdupilotMegaPlanner/temp.cs b/Tools/ArdupilotMegaPlanner/temp.cs index 219e468aec1494758af7641678bde7e9e83903fa..28e7bb4dc27d36a4c4ab32c16bbfc5c9819a47f4 100644 --- a/Tools/ArdupilotMegaPlanner/temp.cs +++ b/Tools/ArdupilotMegaPlanner/temp.cs @@ -16,6 +16,7 @@ using GMap.NET.CacheProviders; using log4net; using System.Security.Permissions; +using ArdupilotMega.Arduino; namespace ArdupilotMega { diff --git a/Tools/ArdupilotMegaPlanner/test.cs b/Tools/ArdupilotMegaPlanner/test.cs deleted file mode 100644 index 5f282702bb03ef11d7184d19c80927b47f919764..0000000000000000000000000000000000000000 --- a/Tools/ArdupilotMegaPlanner/test.cs +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file