diff --git a/Tools/ArdupilotMegaPlanner/Antenna/ITrackerOutput.cs b/Tools/ArdupilotMegaPlanner/Antenna/ITrackerOutput.cs new file mode 100644 index 0000000000..deb5e84f42 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Antenna/ITrackerOutput.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ArdupilotMega.Antenna +{ + interface ITrackerOutput + { + SerialPort ComPort { get; set; } + + double TrimPan { get; set; } + double TrimTilt { get; set; } + + int PanStartRange { get; set; } + int TiltStartRange { get; set; } + int PanEndRange { get; set; } + int TiltEndRange { get; set; } + + bool PanReverse { get; set; } + bool TiltReverse { get; set; } + + bool Init(); + bool Setup(); + bool Pan(double Angle); + bool Tilt(double Angle); + bool PanAndTilt(double Pan,double Tilt); + bool Close(); + } +} diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Maestro.cs b/Tools/ArdupilotMegaPlanner/Antenna/Maestro.cs new file mode 100644 index 0000000000..172853c1fe --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Antenna/Maestro.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ArdupilotMega.Antenna +{ + class Maestro : ITrackerOutput + { + public SerialPort ComPort { get; set; } + /// + /// 0-360 + /// + public double TrimPan { get; set; } + /// + /// -90 - 90 + /// + public double TrimTilt { get; set; } + + public int PanStartRange { get; set; } + public int TiltStartRange { get; set; } + public int PanEndRange { get; set; } + public int TiltEndRange { get; set; } + + public bool PanReverse { get { return _panreverse == -1; } set { _panreverse = value == true ? -1 : 1 ; } } + public bool TiltReverse { get { return _tiltreverse == -1; } set { _tiltreverse = value == true ? -1 : 1; } } + + int _panreverse = 1; + int _tiltreverse = 1; + + byte PanAddress = 0; + byte TiltAddress = 1; + + public bool Init() + { + + if ((PanStartRange - PanEndRange) == 0) + { + System.Windows.Forms.MessageBox.Show("Invalid Pan Range", "Error"); + return false; + } + + if ((TiltStartRange - TiltEndRange) == 0) + { + System.Windows.Forms.MessageBox.Show("Invalid Tilt Range", "Error"); + return false; + } + + try + { + ComPort.Open(); + } + catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Connect failed " + ex.Message,"Error"); return false; } + + return true; + } + public bool Setup() + { + int target = 100; + // speed + var buffer = new byte[] { 0x87, PanAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) }; + ComPort.Write(buffer, 0, buffer.Length); + + buffer = new byte[] { 0x87, TiltAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) }; + ComPort.Write(buffer, 0, buffer.Length); + + // accel + target = 3; + buffer = new byte[] { 0x89, PanAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) }; + ComPort.Write(buffer, 0, buffer.Length); + + buffer = new byte[] { 0x89, TiltAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) }; + ComPort.Write(buffer, 0, buffer.Length); + + return true; + } + + double wrap_180(double input) + { + if (input > 180) + return input - 360; + if (input < -180) + return input + 360; + return input; + } + + public bool Pan(double Angle) + { + // using a byte so it will autowrap + + double range = Math.Abs(PanStartRange - PanEndRange); + + double centerrange = (range / 2) - TrimPan; + + short PointAtAngle = Constrain(wrap_180(Angle - TrimPan), PanStartRange, PanEndRange); + + byte target = (byte)((((PointAtAngle / range) * 2.0) * 127 + 127) * _panreverse); + + Console.WriteLine("P " + Angle + " " + target + " " + PointAtAngle); + + var buffer = new byte[] { 0xff,PanAddress,target}; + ComPort.Write(buffer, 0, buffer.Length); + + return true; + } + + public bool Tilt(double Angle) + { + double range = Math.Abs(TiltStartRange - TiltEndRange); + + short PointAtAngle = Constrain((Angle - TrimTilt), TiltStartRange - TrimTilt, TiltEndRange - TrimTilt); + + byte target = (byte)((((PointAtAngle / range ) * 2) * 127 + 127) * _tiltreverse); + + Console.WriteLine("T " + Angle + " " + target + " " + PointAtAngle); + + var buffer = new byte[] { 0xff, TiltAddress, target }; + ComPort.Write(buffer, 0, buffer.Length); + + return true; + } + + public bool PanAndTilt(double pan, double tilt) + { + if (Tilt(tilt) && Pan(pan)) + return true; + + return false; + } + + public bool Close() + { + ComPort.Close(); + return true; + } + + short Constrain(double input, double min, double max) + { + if (input < min) + return (short)min; + if (input > max) + return (short)max; + return (short)input; + } + } +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.Designer.cs b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.Designer.cs new file mode 100644 index 0000000000..b81d0f868e --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.Designer.cs @@ -0,0 +1,269 @@ +namespace ArdupilotMega.Antenna +{ + partial class Tracker + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Tracker)); + this.CMB_interface = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.CMB_baudrate = new System.Windows.Forms.ComboBox(); + this.CMB_serialport = new System.Windows.Forms.ComboBox(); + this.BUT_connect = new ArdupilotMega.MyButton(); + this.TRK_pantrim = new System.Windows.Forms.TrackBar(); + this.TXT_panstart = new System.Windows.Forms.TextBox(); + this.TXT_panstop = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.TXT_tiltstop = new System.Windows.Forms.TextBox(); + this.TXT_tiltstart = new System.Windows.Forms.TextBox(); + this.TRK_tilttrim = new System.Windows.Forms.TrackBar(); + ((System.ComponentModel.ISupportInitialize)(this.TRK_pantrim)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.TRK_tilttrim)).BeginInit(); + this.SuspendLayout(); + // + // CMB_interface + // + this.CMB_interface.FormattingEnabled = true; + this.CMB_interface.Items.AddRange(new object[] { + "Maestro"}); + this.CMB_interface.Location = new System.Drawing.Point(83, 10); + this.CMB_interface.Name = "CMB_interface"; + this.CMB_interface.Size = new System.Drawing.Size(121, 21); + this.CMB_interface.TabIndex = 0; + this.CMB_interface.Text = "Maestro"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(49, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Interface"; + // + // CMB_baudrate + // + this.CMB_baudrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CMB_baudrate.FormattingEnabled = true; + this.CMB_baudrate.Items.AddRange(new object[] { + "4800", + "9600", + "14400", + "19200", + "28800", + "38400", + "57600", + "115200"}); + this.CMB_baudrate.Location = new System.Drawing.Point(337, 9); + this.CMB_baudrate.Name = "CMB_baudrate"; + this.CMB_baudrate.Size = new System.Drawing.Size(121, 21); + this.CMB_baudrate.TabIndex = 5; + // + // CMB_serialport + // + this.CMB_serialport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CMB_serialport.FormattingEnabled = true; + this.CMB_serialport.Location = new System.Drawing.Point(210, 10); + this.CMB_serialport.Name = "CMB_serialport"; + this.CMB_serialport.Size = new System.Drawing.Size(121, 21); + this.CMB_serialport.TabIndex = 3; + // + // BUT_connect + // + this.BUT_connect.Location = new System.Drawing.Point(476, 9); + this.BUT_connect.Name = "BUT_connect"; + this.BUT_connect.Size = new System.Drawing.Size(75, 23); + this.BUT_connect.TabIndex = 4; + this.BUT_connect.Text = "Connect"; + this.BUT_connect.UseVisualStyleBackColor = true; + this.BUT_connect.Click += new System.EventHandler(this.BUT_connect_Click); + // + // TRK_pantrim + // + this.TRK_pantrim.Location = new System.Drawing.Point(83, 65); + this.TRK_pantrim.Maximum = 180; + this.TRK_pantrim.Minimum = -180; + this.TRK_pantrim.Name = "TRK_pantrim"; + this.TRK_pantrim.Size = new System.Drawing.Size(375, 45); + this.TRK_pantrim.TabIndex = 6; + this.TRK_pantrim.Scroll += new System.EventHandler(this.TRK_pantrim_Scroll); + // + // TXT_panstart + // + this.TXT_panstart.Location = new System.Drawing.Point(13, 65); + this.TXT_panstart.Name = "TXT_panstart"; + this.TXT_panstart.Size = new System.Drawing.Size(64, 20); + this.TXT_panstart.TabIndex = 7; + this.TXT_panstart.Text = "-90"; + // + // TXT_panstop + // + this.TXT_panstop.Location = new System.Drawing.Point(464, 65); + this.TXT_panstop.Name = "TXT_panstop"; + this.TXT_panstop.Size = new System.Drawing.Size(64, 20); + this.TXT_panstop.TabIndex = 8; + this.TXT_panstop.Text = "90"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(461, 49); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(32, 13); + this.label2.TabIndex = 9; + this.label2.Text = "Right"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(261, 49); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(38, 13); + this.label3.TabIndex = 10; + this.label3.Text = "Center"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(13, 49); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(25, 13); + this.label4.TabIndex = 11; + this.label4.Text = "Left"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(13, 125); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(35, 13); + this.label5.TabIndex = 17; + this.label5.Text = "Down"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(261, 125); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(38, 13); + this.label6.TabIndex = 16; + this.label6.Text = "Center"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(461, 125); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(21, 13); + this.label7.TabIndex = 15; + this.label7.Text = "Up"; + // + // TXT_tiltstop + // + this.TXT_tiltstop.Location = new System.Drawing.Point(464, 141); + this.TXT_tiltstop.Name = "TXT_tiltstop"; + this.TXT_tiltstop.Size = new System.Drawing.Size(64, 20); + this.TXT_tiltstop.TabIndex = 14; + this.TXT_tiltstop.Text = "90"; + // + // TXT_tiltstart + // + this.TXT_tiltstart.Location = new System.Drawing.Point(13, 141); + this.TXT_tiltstart.Name = "TXT_tiltstart"; + this.TXT_tiltstart.Size = new System.Drawing.Size(64, 20); + this.TXT_tiltstart.TabIndex = 13; + this.TXT_tiltstart.Text = "0"; + // + // TRK_tilttrim + // + this.TRK_tilttrim.Location = new System.Drawing.Point(83, 141); + this.TRK_tilttrim.Maximum = 90; + this.TRK_tilttrim.Minimum = -90; + this.TRK_tilttrim.Name = "TRK_tilttrim"; + this.TRK_tilttrim.Size = new System.Drawing.Size(375, 45); + this.TRK_tilttrim.TabIndex = 12; + this.TRK_tilttrim.Value = 45; + this.TRK_tilttrim.Scroll += new System.EventHandler(this.TRK_tilttrim_Scroll); + // + // Tracker + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(569, 195); + this.Controls.Add(this.label5); + this.Controls.Add(this.label6); + this.Controls.Add(this.label7); + this.Controls.Add(this.TXT_tiltstop); + this.Controls.Add(this.TXT_tiltstart); + this.Controls.Add(this.TRK_tilttrim); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.TXT_panstop); + this.Controls.Add(this.TXT_panstart); + this.Controls.Add(this.TRK_pantrim); + this.Controls.Add(this.CMB_baudrate); + this.Controls.Add(this.BUT_connect); + this.Controls.Add(this.CMB_serialport); + this.Controls.Add(this.label1); + this.Controls.Add(this.CMB_interface); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "Tracker"; + this.Text = "Tracker"; + ((System.ComponentModel.ISupportInitialize)(this.TRK_pantrim)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.TRK_tilttrim)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + 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 System.Windows.Forms.ComboBox CMB_serialport; + private System.Windows.Forms.TrackBar TRK_pantrim; + private System.Windows.Forms.TextBox TXT_panstart; + private System.Windows.Forms.TextBox TXT_panstop; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox TXT_tiltstop; + private System.Windows.Forms.TextBox TXT_tiltstart; + private System.Windows.Forms.TrackBar TRK_tilttrim; + } +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs new file mode 100644 index 0000000000..5f5635c41e --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ArdupilotMega.Antenna +{ + public partial class Tracker : Form + { + System.Threading.Thread t12; + static bool threadrun = false; + static ITrackerOutput tracker; + + public Tracker() + { + InitializeComponent(); + + MainV2.fixtheme(this); + + CMB_serialport.DataSource = SerialPort.GetPortNames(); + + if (threadrun) + { + BUT_connect.Text = "Disconnect"; + } + } + + private void BUT_connect_Click(object sender, EventArgs e) + { + if (threadrun) + { + threadrun = false; + BUT_connect.Text = "Connect"; + tracker.Close(); + return; + } + + tracker = new ArdupilotMega.Antenna.Maestro(); + + try + { + tracker.ComPort = new SerialPort() + { + PortName = CMB_serialport.Text, + BaudRate = int.Parse(CMB_baudrate.Text) + }; + } + catch (Exception ex) { MessageBox.Show("Bad Port settings " + ex.Message); return; } + + try + { + tracker.PanStartRange = int.Parse(TXT_panstart.Text); + tracker.PanEndRange = int.Parse(TXT_panstop.Text); + tracker.TrimPan = TRK_pantrim.Value; + + tracker.TiltStartRange = int.Parse(TXT_tiltstart.Text); + tracker.TiltEndRange = int.Parse(TXT_tiltstop.Text); + tracker.TrimTilt = TRK_tilttrim.Value; + + } + catch (Exception ex) { MessageBox.Show("Bad User input " + ex.Message); return; } + + if (tracker.Init()) + { + if (tracker.Setup()) + { + tracker.PanAndTilt(0, 0); + + t12 = new System.Threading.Thread(new System.Threading.ThreadStart(mainloop)) + { + IsBackground = true, + Name = "Antenna Tracker" + }; + t12.Start(); + + /* + for (int a = ting.PanStartRange; a < ting.PanEndRange; a++) + { + System.Threading.Thread.Sleep(100); + ting.Pan(a); + } + + for (int a = ting.TiltStartRange; a < ting.TiltEndRange; a++) + { + System.Threading.Thread.Sleep(100); + ting.Tilt(a); + } + */ + } + } + } + + void mainloop() + { + threadrun = true; + while (threadrun) + { + try + { + // 10 hz - position updates default to 3 hz on the stream rate + tracker.PanAndTilt(MainV2.cs.AZToMAV, MainV2.cs.ELToMAV); + System.Threading.Thread.Sleep(100); + } + catch { } + } + } + + private void TRK_pantrim_Scroll(object sender, EventArgs e) + { + if (tracker != null) + tracker.TrimPan = TRK_pantrim.Value; + } + + private void TRK_tilttrim_Scroll(object sender, EventArgs e) + { + if (tracker != null) + tracker.TrimTilt = TRK_tilttrim.Value; + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/Antenna/Tracker.resx b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.resx new file mode 100644 index 0000000000..222a74addf --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Antenna/Tracker.resx @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA + AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADOxkjAtnoOAKpJ4vyiK + c+8nh3D/J4Zv/yeHcP8oi3PvKpJ4vy6fg4AzsZIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjGo2AyspPfLZ+D/yiQ + d/8hlXj/G6F9/xeqg/8XqYL/GKqD/xuhfv8ilnn/KZB3/y2fhP8yspPfN8ajYAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvRrDA1vpzfL6uN/yel + hP8XvJD/DMyY/wfQl/8FzJP/A8qS/wPJkf8EypL/BsyU/wnRmP8PzZn/Gb2R/yemhP8tqoz/Mb2a3zbQ + qkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAA4y6ZgMbWV/yin + iP8WwZP/Btqf/wDPlf8AyI7/A8aP/yfNnv9T2LP/UNax/03XsP8506b/G8ya/wHKkf8F0Zf/CNuf/xLB + kv8fpYT/J7KQ/y7IomAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAANcajny+w + kf8hqoj/CNSd/wDRlf8Axor/Hcyd/3Lhwf+p7Nj/o+vV/57m0/+X5dD/k+TN/4/jzf+K5Mz/fuHH/0PW + rf8HzJT/ANCT/wDRlv8OpX//HayI/yrFn58AAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAADDC + nmAtro7/H62J/wPWmv8Ay47/AMaO/3XhxP+e6tT/mObP/5Pjy/+Q4sr/jODJ/4ffx/+C3MT/f9vC/3nb + wf9y2r7/adq7/2DauP8ZzZv/Fdae/8T/9/9WxKj/HKuI/y7IomAAAAAAAAAAAAAAAAD///8AAAAAAAAA + AAAiuZMwKKyM/x6ohf8C1Zr/AMmL/wHGjv+49OL///////////9+3ML/f9zD/4Dcwv9+28L/e9rA/3bZ + vv9w1rr/Z9S4/17Rs/9Qz63/Qcyn/3LewP////////////n///8MpH7/JbKP/zXQqUAAAAAAAAAAAP// + /wAAAAAAAAAAABymhN8dnn//BNGa/wDKjP8AxY3/sfHf/////////////////2nXt/9w1rv/c9e8/3TX + vP9x17z/a9W5/2TTtf9Y0K//SMyp/zXFoP9i07X/////////////////f/LR/wDQlf8epYT/Mb2a3wAA + AAAAAAAA////AAAAAAADlnJgFZR1/wq4iv8AzpH/AMCD/4rmzf//////////////////////WdGv/2PU + tf9p1rf/atS4/2nUtv9i0rT/Vc+u/0fKpv8zxZz/Ws+w//////////////////////8GyJL/ANCS/xLB + kv8tq4z/OMajYAAAAAD///8AAAAAAACHZt8NkW//ANKV/wDChP9i27r//////////////////////9Dx + 6P9MzKn/Vc+v/17Rsv9g0rP/XNCx/1XNrv9Fyaf/McSd/1fPr///////////////////////QM2m/ynK + oP8JzJX/C9yh/ymmhf80spPfAAAAAP///wAAcUwwAHtc/wCrfP8AyIv/AMKK//////////////////// + /////////////5Dgyv9Gyqb/TMyq/07Nq/9MzKn/Qcmj/y/Fnf9Wzq3//////////////////////57k + 0v8av5T/Lceg/yzOo/8M05v/Hr6T/zCghf80spIw////AABoRYAAclT/AL2H/wDBhf9R1rL///////// + ////////4vfw//////////////////H8+P9KzKn/Ocah/zTFnv8qwpj/Us2t//////////////////// + ////////DLqM/yDBlv8wxp//OM6m/xPPm/8Xz53/LZF5/y+fg4////8AAGNAvwB7Wf8Aw4j/ALyC/4bj + yP+g5tL/g93E/2HSsv9Pzqz/Us6s//////////////////////9Yzq//Gr2S/0jLp/////////////// + /////////////yrDm/8SvI//JMGY/zDHn/81zKT/Is2e/xTUnf8nl3v/LJJ5v////wAAXz3vAIlg/wDA + hf8AuoD/quzZ/5Hjyv9628D/ada2/1jRsP9Jy6f/a9a4//////////////////////+Y4s7///////// + //////////////////+c4tD/AbaH/xW8kf8jwZj/LcWd/y/Jn/8kzJ3/E9Ca/yGjgf8ri3Tv////AABd + PP8Ak2b/AL6D/w/Ekv+m6tf/j+HJ/3vawP9p1rf/W9Gx/0rNqf85yJ//Nsaf//////////////////// + /////////////////////////////wCwe/8AtoT/ELqP/xu+k/8jwZj/KMeb/yHKm/8QzZf/HqyG/ymI + cf////8AAF07/wCSZP8AvYL/GMWU/6Dn1P+K38f/ddi+/27Wuf+E3MX/leHN/6fm1f+l5tX/neLQ//// + ////////////////////////////////////////j9/J/27Vuv9Tzq7/JsKY/xa/kv8aw5T/FcaW/wvL + lf8aqoT/J4dw/////wAAXTv/AJFk/wC9gP8GwY3/mObQ/5rkz/+26dv/y/Hl/8Dt3/+06tz/pebV/5bg + zP+g5NL//////////////v///f7+//7+/v//////7fn2////////////tOnb/6Ll0v+v6Nj/jeDI/zXK + o/8IxJD/BMqS/xaqgv8lh2//////AABeO+8AgVf/AL1//wDBif/R9uv/1PPq/8Tv5P+36t3/rujY/6Lk + 0v+U4cv/jt7J//j8+///////+/38//f8+//2+/r/+Pz7//3+/v/m9/P/9Pv6//D6+P9/28L/jd7J/5jj + z/+h5dL/qOvX/4Hmyf8f1J//E596/yOJcO////8AAGA8vwB3U/8p06P/hufM/8Ty5f/D7+T/s+vb/6bm + 1P+c4c//j9/K/4vcyP/t+fb///7///j8/P/0+/r/8vr5//P7+f/1+/r/+/39///////i9fL/ZNO1/3HW + vP992sH/htzG/4vhyv+S5dD/mO7W/6X74v80noT/Io90v////wAAZkCAAHla/33ny/945cb/nunV/7Xr + 3v+l5tT/luDN/4ndxv992cL/1vLq//v9/P/1+/n/8vv4//L69//z+/j/9Pv5/7Xo2//x+vn///////// + //+y59n/aNS3/3LWvP932r//fNzD/4Ljyf+J7ND/l/bd/yORdf8knH6A////AABuRzAAdlT/Xc6x/23o + xv9s4MH/qurZ/5jiz/+I3cb/edjA/8ju5f/3/Pv/8vv4//H6+P/y+/j/6/f0/7np3v/7/fz//v7+/6fk + 1f+56tz///////////9h0bT/aNW4/23Wu/9v3L//dOLG/37w0f9m1rn/Hpt8/ymujTD///8AAAAAAACD + X98po4X/Z+7K/1vgvP+A4sf/jOHK/3rZwv+r59f/9Pv6/+/69//v+vf/8vr4/9fy6/9n0rf/VM6t/6Di + 0v/N7+f/adO4/1PMrf9t1Lr/i9zI/1/Rs/9h0rX/ZNe4/2bbvf9s5sb/ePfV/z2ylf8lrozfAAAAAP// + /wAAAAAAAJNsYAWQbf9U1rP/Vee//0rYsf993sb/pebV//P7+v/s+Pb/6/f1/+749v+s5tj/Vc2u/1jP + r/9ZzrD/btW5/1bOr/9Wza//Vs6v/1fOr/9Z0LD/WdCy/1vTtP9d1rX/Xt+8/2btyP9k4L//IaaF/y7D + nmAAAAAA////AAAAAAAAAAAAD6J9zyCjgv9S68L/P9+0/2Pevv/5////7/v6/+v59//j9/L/gtvF/1PN + r/9Wz7D/Wc+x/1nQsf9Zz7H/WM6w/1fPsP9UzrD/VM+w/1TPrv9U0a//U9Oy/1Tatv9Z5sD/Y/LL/zSx + lP8qupbPAAAAAAAAAAD///8AAAAAAAAAAAAYto4wGaeE/y23lP8+5rn/6/////j////w//3/ve/i/2bV + uP9Tzq7/Vc+v/1jPsP9Z0LL/WM+w/1fOsf9Wz7D/Us2w/1HOrf9Qzq3/T9Cu/0zSr/9M2LP/TeC5/1bt + xP9HxaX/KLKQ/zTPqDAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAkvpdgG6iF/y++m//e/////P///3rl + yf9G0K3/VdKy/1bPsf9Wz7H/Vs6w/1bPsP9Sza//Ucyu/0/Nrf9NzKz/S82s/0fOrP9G0a7/QdWv/0Le + tP9I6L7/Q8Ok/yitjP8yyKJgAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAmwJlgG6iF/yK3 + kP8k3q7/H9el/x7Pn/8tzKT/Q9Cs/1HQsP9Q0K7/TM6u/0nMrf9Hzaz/RMyp/0LNqf8+zqn/ONGo/zTV + qf833rD/O+S4/zvCof8orIv/MMSfYAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAA + AAAkvpdgG6iE/xukgv8gy53/HNql/xzRn/8czJz/HcmZ/yXJnP8qyp7/Lcqg/yzLn/8nypz/JMqc/yTO + n/8l1KT/KN2r/y3Tpv8nq4n/JaqJ/yzAm2AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAato8wFKN/zxCScv8RnHn/DbqM/wjIlP8GyZT/BsaS/wbFkf8GxZH/B8WR/wfH + k/8IypX/DMmV/xG3jP8WoX3/Fph2/xqkgs8ft5EwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJVvYACGZM8Aelr/AHlZ/wCFX/8AiWL/AJlr/wCb + bP8AlGf/AI5k/wB/W/8AeFj/AHtb/wCHZd8ClXBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwSzAAaESAAGI/vwBf + Pd8AXTz/AF08/wBdPP8AXz3fAGJAvwBoRIAAcUswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A/+AD//+AAP/+AAA//AAAH/gAAA/wAAAH4AAAA+AAAAPAAAABwAAAAYAA + AACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAwAAAAcAAAAHgAAAD4AAAA/AA + AAf4AAAP/AAAH/4AAD//gAD//+AD//////8= + + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/ArduinoDetect.cs b/Tools/ArdupilotMegaPlanner/ArduinoDetect.cs index 82d49c690b..62e86d3639 100644 --- a/Tools/ArdupilotMegaPlanner/ArduinoDetect.cs +++ b/Tools/ArdupilotMegaPlanner/ArduinoDetect.cs @@ -1,15 +1,15 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Reflection; using System.Management; using System.Windows.Forms; using System.Threading; +using log4net; namespace ArdupilotMega { class ArduinoDetect { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// detects STK version 1 or 2 /// @@ -27,7 +27,7 @@ namespace ArdupilotMega serialPort.BaudRate = 57600; serialPort.Open(); - System.Threading.Thread.Sleep(100); + Thread.Sleep(100); int a = 0; while (a < 20) // 20 * 50 = 1 sec @@ -36,7 +36,7 @@ namespace ArdupilotMega serialPort.DiscardInBuffer(); serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); a++; - System.Threading.Thread.Sleep(50); + Thread.Sleep(50); //Console.WriteLine("btr {0}", serialPort.BytesToRead); if (serialPort.BytesToRead >= 2) @@ -53,15 +53,15 @@ namespace ArdupilotMega serialPort.Close(); - Console.WriteLine("Not a 1280"); + log.Warn("Not a 1280"); - System.Threading.Thread.Sleep(500); + Thread.Sleep(500); serialPort.DtrEnable = true; serialPort.BaudRate = 115200; serialPort.Open(); - System.Threading.Thread.Sleep(100); + Thread.Sleep(100); a = 0; while (a < 4) @@ -69,7 +69,7 @@ namespace ArdupilotMega byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 }; temp = ArduinoDetect.genstkv2packet(serialPort, temp); a++; - System.Threading.Thread.Sleep(50); + Thread.Sleep(50); try { @@ -81,11 +81,13 @@ namespace ArdupilotMega } } - catch { } + catch + { + } } serialPort.Close(); - Console.WriteLine("Not a 2560"); + log.Warn("Not a 2560"); return ""; } @@ -106,7 +108,7 @@ namespace ArdupilotMega serialPort.BaudRate = 57600; serialPort.Open(); - System.Threading.Thread.Sleep(100); + Thread.Sleep(100); int a = 0; while (a < 20) // 20 * 50 = 1 sec @@ -115,7 +117,7 @@ namespace ArdupilotMega serialPort.DiscardInBuffer(); serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2); a++; - System.Threading.Thread.Sleep(50); + Thread.Sleep(50); //Console.WriteLine("btr {0}", serialPort.BytesToRead); if (serialPort.BytesToRead >= 2) @@ -132,15 +134,15 @@ namespace ArdupilotMega serialPort.Close(); - Console.WriteLine("Not a 1280"); + log.Warn("Not a 1280"); - System.Threading.Thread.Sleep(500); + Thread.Sleep(500); serialPort.DtrEnable = true; serialPort.BaudRate = 115200; serialPort.Open(); - System.Threading.Thread.Sleep(100); + Thread.Sleep(100); a = 0; while (a < 4) @@ -148,7 +150,7 @@ namespace ArdupilotMega byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 }; temp = ArduinoDetect.genstkv2packet(serialPort, temp); a++; - System.Threading.Thread.Sleep(50); + Thread.Sleep(50); try { @@ -192,7 +194,7 @@ namespace ArdupilotMega } serialPort.Close(); - Console.WriteLine("Not a 2560"); + log.Warn("Not a 2560"); return ""; } @@ -281,11 +283,11 @@ namespace ArdupilotMega key = buffer[pos]; pos++; - Console.Write("{0:X4}: key {1} size {2}\n ", pos - 2, key, size + 1); + log.InfoFormat("{0:X4}: key {1} size {2}\n ", pos - 2, key, size + 1); if (key == 0xff) { - Console.WriteLine("end sentinal at {0}", pos - 2); + log.InfoFormat("end sentinal at {0}", pos - 2); break; } @@ -301,7 +303,6 @@ namespace ArdupilotMega Console.Write(" {0:X2}", buffer[pos]); pos++; } - Console.WriteLine(); } } @@ -325,7 +326,7 @@ namespace ArdupilotMega if (key == 0xff) { - Console.WriteLine("end sentinal at {0}", pos - 2); + log.InfoFormat("end sentinal at {0}", pos - 2); break; } @@ -341,7 +342,6 @@ namespace ArdupilotMega Console.Write(" {0:X2}", buffer[pos]); pos++; } - Console.WriteLine(); } } } diff --git a/Tools/ArdupilotMegaPlanner/ArduinoSTK.cs b/Tools/ArdupilotMegaPlanner/ArduinoSTK.cs index 04e4189f27..372cf568c8 100644 --- a/Tools/ArdupilotMegaPlanner/ArduinoSTK.cs +++ b/Tools/ArdupilotMegaPlanner/ArduinoSTK.cs @@ -1,8 +1,10 @@ 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 @@ -10,6 +12,7 @@ namespace ArdupilotMega { class ArduinoSTK : SerialPort, ArduinoComms { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public event ProgressEventHandler Progress; public new void Open() @@ -48,7 +51,7 @@ namespace ArdupilotMega a++; Thread.Sleep(50); - Console.WriteLine("btr {0}", this.BytesToRead); + log.InfoFormat("btr {0}", this.BytesToRead); if (this.BytesToRead >= 2) { byte b1 = (byte)this.ReadByte(); @@ -96,14 +99,14 @@ namespace ArdupilotMega { byte b1 = (byte)this.ReadByte(); byte b2 = (byte)this.ReadByte(); - Console.WriteLine("bytes {0:X} {1:X}", b1, b2); + log.DebugFormat("bytes {0:X} {1:X}", b1, b2); if (b1 == 0x14 && b2 == 0x10) { return true; } } - Console.WriteLine("btr {0}", this.BytesToRead); + log.DebugFormat("btr {0}", this.BytesToRead); Thread.Sleep(10); a++; } @@ -210,7 +213,7 @@ namespace ArdupilotMega byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'F' }; this.Write(command, 0, command.Length); - Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending); + log.Info((startfrom + (length - totalleft)) + " - " + sending); this.Write(data, startfrom + (length - totalleft), sending); command = new byte[] { (byte)' ' }; this.Write(command, 0, command.Length); @@ -223,7 +226,7 @@ namespace ArdupilotMega if (!sync()) { - Console.WriteLine("No Sync"); + log.Info("No Sync"); return false; } } @@ -247,7 +250,7 @@ namespace ArdupilotMega throw new Exception("Address must be an even number"); } - Console.WriteLine("Sending address " + ((ushort)(address / 2))); + log.Info("Sending address " + ((ushort)(address / 2))); address /= 2; address = (ushort)address; @@ -295,7 +298,7 @@ namespace ArdupilotMega byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'E' }; this.Write(command, 0, command.Length); - Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending); + log.Info((startfrom + (length - totalleft)) + " - " + sending); this.Write(data, startfrom + (length - totalleft), sending); command = new byte[] { (byte)' ' }; this.Write(command, 0, command.Length); @@ -304,7 +307,7 @@ namespace ArdupilotMega if (!sync()) { - Console.WriteLine("No Sync"); + log.Info("No Sync"); return false; } } diff --git a/Tools/ArdupilotMegaPlanner/ArduinoSTKv2.cs b/Tools/ArdupilotMegaPlanner/ArduinoSTKv2.cs index 3483695ff3..746a6f0e10 100644 --- a/Tools/ArdupilotMegaPlanner/ArduinoSTKv2.cs +++ b/Tools/ArdupilotMegaPlanner/ArduinoSTKv2.cs @@ -1,8 +1,10 @@ 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 @@ -10,6 +12,7 @@ namespace ArdupilotMega { class ArduinoSTKv2 : SerialPort,ArduinoComms { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public event ProgressEventHandler Progress; public new void Open() @@ -250,7 +253,7 @@ namespace ArdupilotMega byte[] command = new byte[] { (byte)0x13, (byte)(sending >> 8), (byte)(sending & 0xff) }; - Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending); + log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending); Array.Resize(ref command, sending + 10); // sending + head @@ -266,7 +269,7 @@ namespace ArdupilotMega if (command[1] != 0) { - Console.WriteLine("No Sync"); + log.InfoFormat("No Sync"); return false; } } @@ -290,7 +293,7 @@ namespace ArdupilotMega throw new Exception("Address must be an even number"); } - Console.WriteLine("Sending address " + ((address / 2))); + 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) }; @@ -342,7 +345,7 @@ namespace ArdupilotMega byte[] command = new byte[] { (byte)0x15, (byte)(sending >> 8), (byte)(sending & 0xff) }; - Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending); + log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending); Array.Resize(ref command, sending + 10); // sending + head @@ -358,7 +361,7 @@ namespace ArdupilotMega if (command[1] != 0) { - Console.WriteLine("No Sync"); + log.InfoFormat("No Sync"); return false; } } diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index 082b9bd929..46560d91e3 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -147,6 +147,10 @@ ..\..\..\..\..\Desktop\DIYDrones\kml-library\KmlTestbed\bin\Release\KMLib.dll + + False + Lib\log4net.dll + ..\..\..\..\..\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\MetaDataExtractor.dll @@ -225,6 +229,14 @@ + + + + Form + + + Tracker.cs + Form @@ -445,7 +457,10 @@ temp.cs - + + + Tracker.cs + ProgressReporterDialogue.cs diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj.user b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj.user index a4d8cafb2b..496c214467 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj.user +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj.user @@ -11,6 +11,6 @@ - C:\Users\hog\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\;C:\Users\hog\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\;C:\Users\hog\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\ + C:\Users\hog\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\;C:\Users\hog\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\;C:\Users\hog\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\;C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\Lib\ \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln b/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln index be5d5ee4df..8c86aa7b2d 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln @@ -5,8 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArdupilotMega", "ArdupilotM EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{E64A1A41-A5B0-458E-8284-BB63705354DA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArduinoCPP", "..\..\ArduinoCPP\ArduinoCPP.csproj", "{C38A02C5-3179-4047-8DC3-945341008A74}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -43,18 +41,6 @@ Global {E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|Win32.ActiveCfg = Release|x86 {E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|x86.ActiveCfg = Release|x86 {E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|x86.Build.0 = Release|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Any CPU.ActiveCfg = Debug|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Win32.ActiveCfg = Debug|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Debug|x86.ActiveCfg = Debug|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Debug|x86.Build.0 = Debug|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Release|Any CPU.ActiveCfg = Release|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Release|Mixed Platforms.Build.0 = Release|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Release|Win32.ActiveCfg = Release|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Release|x86.ActiveCfg = Release|x86 - {C38A02C5-3179-4047-8DC3-945341008A74}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tools/ArdupilotMegaPlanner/Camera.Designer.cs b/Tools/ArdupilotMegaPlanner/Camera.Designer.cs index abf69d3313..3e6eb16e5d 100644 --- a/Tools/ArdupilotMegaPlanner/Camera.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Camera.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Camera)); this.num_agl = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); this.num_focallength = new System.Windows.Forms.NumericUpDown(); @@ -74,15 +75,13 @@ 0, 0, 0}); - this.num_agl.Location = new System.Drawing.Point(12, 38); + resources.ApplyResources(this.num_agl, "num_agl"); this.num_agl.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); this.num_agl.Name = "num_agl"; - this.num_agl.Size = new System.Drawing.Size(64, 20); - this.num_agl.TabIndex = 1; this.num_agl.Value = new decimal(new int[] { 200, 0, @@ -92,12 +91,8 @@ // // label2 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(82, 40); + resources.ApplyResources(this.label2, "label2"); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(72, 13); - this.label2.TabIndex = 4; - this.label2.Text = "Height m (agl)"; // // num_focallength // @@ -107,7 +102,7 @@ 0, 0, 65536}); - this.num_focallength.Location = new System.Drawing.Point(12, 64); + resources.ApplyResources(this.num_focallength, "num_focallength"); this.num_focallength.Maximum = new decimal(new int[] { 180, 0, @@ -119,8 +114,6 @@ 0, 0}); this.num_focallength.Name = "num_focallength"; - this.num_focallength.Size = new System.Drawing.Size(64, 20); - this.num_focallength.TabIndex = 6; this.num_focallength.Value = new decimal(new int[] { 5, 0, @@ -130,181 +123,113 @@ // // TXT_fovH // - this.TXT_fovH.Location = new System.Drawing.Point(361, 12); + resources.ApplyResources(this.TXT_fovH, "TXT_fovH"); this.TXT_fovH.Name = "TXT_fovH"; - this.TXT_fovH.Size = new System.Drawing.Size(100, 20); - this.TXT_fovH.TabIndex = 10; // // TXT_fovV // - this.TXT_fovV.Location = new System.Drawing.Point(361, 39); + resources.ApplyResources(this.TXT_fovV, "TXT_fovV"); this.TXT_fovV.Name = "TXT_fovV"; - this.TXT_fovV.Size = new System.Drawing.Size(100, 20); - this.TXT_fovV.TabIndex = 11; // // TXT_fovAV // - this.TXT_fovAV.Location = new System.Drawing.Point(361, 92); + resources.ApplyResources(this.TXT_fovAV, "TXT_fovAV"); this.TXT_fovAV.Name = "TXT_fovAV"; - this.TXT_fovAV.Size = new System.Drawing.Size(100, 20); - this.TXT_fovAV.TabIndex = 14; // // TXT_fovAH // - this.TXT_fovAH.Location = new System.Drawing.Point(361, 65); + resources.ApplyResources(this.TXT_fovAH, "TXT_fovAH"); this.TXT_fovAH.Name = "TXT_fovAH"; - this.TXT_fovAH.Size = new System.Drawing.Size(100, 20); - this.TXT_fovAH.TabIndex = 13; // // TXT_cmpixel // - this.TXT_cmpixel.Location = new System.Drawing.Point(361, 118); + resources.ApplyResources(this.TXT_cmpixel, "TXT_cmpixel"); this.TXT_cmpixel.Name = "TXT_cmpixel"; - this.TXT_cmpixel.Size = new System.Drawing.Size(100, 20); - this.TXT_cmpixel.TabIndex = 16; // // TXT_imgwidth // - this.TXT_imgwidth.Location = new System.Drawing.Point(12, 90); + resources.ApplyResources(this.TXT_imgwidth, "TXT_imgwidth"); this.TXT_imgwidth.Name = "TXT_imgwidth"; - this.TXT_imgwidth.Size = new System.Drawing.Size(64, 20); - this.TXT_imgwidth.TabIndex = 17; - this.TXT_imgwidth.Text = "4608"; this.TXT_imgwidth.TextChanged += new System.EventHandler(this.TXT_imgwidth_TextChanged); // // TXT_imgheight // - this.TXT_imgheight.Location = new System.Drawing.Point(12, 116); + resources.ApplyResources(this.TXT_imgheight, "TXT_imgheight"); this.TXT_imgheight.Name = "TXT_imgheight"; - this.TXT_imgheight.Size = new System.Drawing.Size(64, 20); - this.TXT_imgheight.TabIndex = 18; - this.TXT_imgheight.Text = "3456"; this.TXT_imgheight.TextChanged += new System.EventHandler(this.TXT_imgheight_TextChanged); // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(82, 71); + resources.ApplyResources(this.label1, "label1"); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(69, 13); - this.label1.TabIndex = 19; - this.label1.Text = "Focal Length"; // // label6 // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(298, 19); + resources.ApplyResources(this.label6, "label6"); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(56, 13); - this.label6.TabIndex = 21; - this.label6.Text = "FOV H (m)"; // // label7 // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(299, 72); + resources.ApplyResources(this.label7, "label7"); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(45, 13); - this.label7.TabIndex = 22; - this.label7.Text = "Angle H"; // // label8 // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(300, 99); + resources.ApplyResources(this.label8, "label8"); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(44, 13); - this.label8.TabIndex = 23; - this.label8.Text = "Angle V"; // // label10 // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(299, 46); + resources.ApplyResources(this.label10, "label10"); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(55, 13); - this.label10.TabIndex = 25; - this.label10.Text = "FOV V (m)"; // // label12 // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(299, 125); + resources.ApplyResources(this.label12, "label12"); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(50, 13); - this.label12.TabIndex = 27; - this.label12.Text = "CM/Pixel"; // // label13 // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(82, 93); + resources.ApplyResources(this.label13, "label13"); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(60, 13); - this.label13.TabIndex = 28; - this.label13.Text = "Pixel Width"; // // label14 // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(82, 119); + resources.ApplyResources(this.label14, "label14"); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(63, 13); - this.label14.TabIndex = 29; - this.label14.Text = "Pixel Height"; // // label3 // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(82, 171); + resources.ApplyResources(this.label3, "label3"); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(74, 13); - this.label3.TabIndex = 33; - this.label3.Text = "Sensor Height"; // // label4 // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(82, 145); + resources.ApplyResources(this.label4, "label4"); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(71, 13); - this.label4.TabIndex = 32; - this.label4.Text = "Sensor Width"; // // TXT_sensheight // - this.TXT_sensheight.Location = new System.Drawing.Point(12, 168); + resources.ApplyResources(this.TXT_sensheight, "TXT_sensheight"); this.TXT_sensheight.Name = "TXT_sensheight"; - this.TXT_sensheight.Size = new System.Drawing.Size(64, 20); - this.TXT_sensheight.TabIndex = 31; - this.TXT_sensheight.Text = "4.62"; this.TXT_sensheight.TextChanged += new System.EventHandler(this.TXT_sensheight_TextChanged); // // TXT_senswidth // - this.TXT_senswidth.Location = new System.Drawing.Point(12, 142); + resources.ApplyResources(this.TXT_senswidth, "TXT_senswidth"); this.TXT_senswidth.Name = "TXT_senswidth"; - this.TXT_senswidth.Size = new System.Drawing.Size(64, 20); - this.TXT_senswidth.TabIndex = 30; - this.TXT_senswidth.Text = "6.16"; this.TXT_senswidth.TextChanged += new System.EventHandler(this.TXT_senswidth_TextChanged); // // label5 // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(82, 201); + resources.ApplyResources(this.label5, "label5"); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(44, 13); - this.label5.TabIndex = 35; - this.label5.Text = "Overlap"; // // num_overlap // this.num_overlap.DecimalPlaces = 1; - this.num_overlap.Location = new System.Drawing.Point(12, 194); + resources.ApplyResources(this.num_overlap, "num_overlap"); this.num_overlap.Name = "num_overlap"; - this.num_overlap.Size = new System.Drawing.Size(64, 20); - this.num_overlap.TabIndex = 34; this.num_overlap.Value = new decimal(new int[] { 60, 0, @@ -314,20 +239,14 @@ // // label15 // - this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(82, 227); + resources.ApplyResources(this.label15, "label15"); this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(42, 13); - this.label15.TabIndex = 37; - this.label15.Text = "Sidelap"; // // num_sidelap // this.num_sidelap.DecimalPlaces = 1; - this.num_sidelap.Location = new System.Drawing.Point(12, 220); + resources.ApplyResources(this.num_sidelap, "num_sidelap"); this.num_sidelap.Name = "num_sidelap"; - this.num_sidelap.Size = new System.Drawing.Size(64, 20); - this.num_sidelap.TabIndex = 36; this.num_sidelap.Value = new decimal(new int[] { 30, 0, @@ -337,73 +256,51 @@ // // CHK_camdirection // - this.CHK_camdirection.AutoSize = true; + resources.ApplyResources(this.CHK_camdirection, "CHK_camdirection"); this.CHK_camdirection.Checked = true; this.CHK_camdirection.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_camdirection.Location = new System.Drawing.Point(13, 247); this.CHK_camdirection.Name = "CHK_camdirection"; - this.CHK_camdirection.Size = new System.Drawing.Size(150, 17); - this.CHK_camdirection.TabIndex = 38; - this.CHK_camdirection.Text = "Camera top facing forward"; this.CHK_camdirection.UseVisualStyleBackColor = true; this.CHK_camdirection.CheckedChanged += new System.EventHandler(this.CHK_camdirection_CheckedChanged); // // label9 // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(261, 198); + resources.ApplyResources(this.label9, "label9"); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(86, 13); - this.label9.TabIndex = 42; - this.label9.Text = "Across Flight line"; // // label11 // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(261, 171); + resources.ApplyResources(this.label11, "label11"); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(94, 13); - this.label11.TabIndex = 41; - this.label11.Text = "Flight line distance"; // // TXT_distacflphotos // - this.TXT_distacflphotos.Location = new System.Drawing.Point(361, 195); + resources.ApplyResources(this.TXT_distacflphotos, "TXT_distacflphotos"); this.TXT_distacflphotos.Name = "TXT_distacflphotos"; - this.TXT_distacflphotos.Size = new System.Drawing.Size(100, 20); - this.TXT_distacflphotos.TabIndex = 40; // // TXT_distflphotos // - this.TXT_distflphotos.Location = new System.Drawing.Point(361, 168); + resources.ApplyResources(this.TXT_distflphotos, "TXT_distflphotos"); this.TXT_distflphotos.Name = "TXT_distflphotos"; - this.TXT_distflphotos.Size = new System.Drawing.Size(100, 20); - this.TXT_distflphotos.TabIndex = 39; // // CMB_camera // this.CMB_camera.FormattingEnabled = true; - this.CMB_camera.Location = new System.Drawing.Point(13, 13); + resources.ApplyResources(this.CMB_camera, "CMB_camera"); this.CMB_camera.Name = "CMB_camera"; - this.CMB_camera.Size = new System.Drawing.Size(143, 21); - this.CMB_camera.TabIndex = 43; this.CMB_camera.SelectedIndexChanged += new System.EventHandler(this.CMB_camera_SelectedIndexChanged); // // BUT_save // - this.BUT_save.Location = new System.Drawing.Point(163, 10); + resources.ApplyResources(this.BUT_save, "BUT_save"); this.BUT_save.Name = "BUT_save"; - this.BUT_save.Size = new System.Drawing.Size(75, 23); - this.BUT_save.TabIndex = 44; - this.BUT_save.Text = "Save"; this.BUT_save.UseVisualStyleBackColor = true; this.BUT_save.Click += new System.EventHandler(this.BUT_save_Click); // // Camera // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(473, 275); this.Controls.Add(this.BUT_save); this.Controls.Add(this.CMB_camera); this.Controls.Add(this.label9); @@ -438,7 +335,6 @@ this.Controls.Add(this.label2); this.Controls.Add(this.num_agl); this.Name = "Camera"; - this.Text = "Camera"; this.Load += new System.EventHandler(this.Camera_Load); ((System.ComponentModel.ISupportInitialize)(this.num_agl)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.num_focallength)).EndInit(); diff --git a/Tools/ArdupilotMegaPlanner/Camera.resx b/Tools/ArdupilotMegaPlanner/Camera.resx index 7080a7d118..f9635c451b 100644 --- a/Tools/ArdupilotMegaPlanner/Camera.resx +++ b/Tools/ArdupilotMegaPlanner/Camera.resx @@ -117,4 +117,828 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 12, 38 + + + 64, 20 + + + + 1 + + + num_agl + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 32 + + + True + + + 82, 40 + + + 72, 13 + + + 4 + + + Height m (agl) + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 31 + + + 12, 64 + + + 64, 20 + + + 6 + + + num_focallength + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 30 + + + 361, 12 + + + 100, 20 + + + 10 + + + TXT_fovH + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 29 + + + 361, 39 + + + 100, 20 + + + 11 + + + TXT_fovV + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 28 + + + 361, 92 + + + 100, 20 + + + 14 + + + TXT_fovAV + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 26 + + + 361, 65 + + + 100, 20 + + + 13 + + + TXT_fovAH + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 27 + + + 361, 118 + + + 100, 20 + + + 16 + + + TXT_cmpixel + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 25 + + + 12, 90 + + + 64, 20 + + + 17 + + + 4608 + + + TXT_imgwidth + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 24 + + + 12, 116 + + + 64, 20 + + + 18 + + + 3456 + + + TXT_imgheight + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 23 + + + True + + + 82, 71 + + + 69, 13 + + + 19 + + + Focal Length + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 22 + + + True + + + 298, 19 + + + 56, 13 + + + 21 + + + FOV H (m) + + + label6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 21 + + + True + + + 299, 72 + + + 45, 13 + + + 22 + + + Angle H + + + label7 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 20 + + + True + + + 300, 99 + + + 44, 13 + + + 23 + + + Angle V + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 19 + + + True + + + 299, 46 + + + 55, 13 + + + 25 + + + FOV V (m) + + + label10 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 18 + + + True + + + 299, 125 + + + 50, 13 + + + 27 + + + CM/Pixel + + + label12 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 17 + + + True + + + 82, 93 + + + 60, 13 + + + 28 + + + Pixel Width + + + label13 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 16 + + + True + + + 82, 119 + + + 63, 13 + + + 29 + + + Pixel Height + + + label14 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 15 + + + True + + + 82, 171 + + + 74, 13 + + + 33 + + + Sensor Height + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 11 + + + True + + + 82, 145 + + + 71, 13 + + + 32 + + + Sensor Width + + + label4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 12 + + + 12, 168 + + + 64, 20 + + + 31 + + + 4.62 + + + TXT_sensheight + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 13 + + + 12, 142 + + + 64, 20 + + + 30 + + + 6.16 + + + TXT_senswidth + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 14 + + + True + + + 82, 201 + + + 44, 13 + + + 35 + + + Overlap + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 9 + + + 12, 194 + + + 64, 20 + + + 34 + + + num_overlap + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 10 + + + True + + + 82, 227 + + + 42, 13 + + + 37 + + + Sidelap + + + label15 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + + + 12, 220 + + + 64, 20 + + + 36 + + + num_sidelap + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 8 + + + True + + + 13, 247 + + + 150, 17 + + + 38 + + + Camera top facing forward + + + CHK_camdirection + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + + + True + + + 261, 198 + + + 86, 13 + + + 42 + + + Across Flight line + + + label9 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + 261, 171 + + + 94, 13 + + + 41 + + + Flight line distance + + + label11 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + 361, 195 + + + 100, 20 + + + 40 + + + TXT_distacflphotos + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + 361, 168 + + + 100, 20 + + + 39 + + + TXT_distflphotos + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + 13, 13 + + + 143, 21 + + + 43 + + + CMB_camera + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 163, 10 + + + 75, 23 + + + 44 + + + Save + + + BUT_save + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + $this + + + 0 + + + True + + + 6, 13 + + + 473, 275 + + + Camera + + + Camera + + + System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Common.cs b/Tools/ArdupilotMegaPlanner/Common.cs index bb2beb1726..ed1c1a99c9 100644 --- a/Tools/ArdupilotMegaPlanner/Common.cs +++ b/Tools/ArdupilotMegaPlanner/Common.cs @@ -18,6 +18,7 @@ using System.Net; using System.Net.Sockets; using System.Xml; // config file using System.Runtime.InteropServices; // dll imports +using log4net; using ZedGraph; // Graphs using ArdupilotMega; using System.Reflection; @@ -213,6 +214,13 @@ namespace ArdupilotMega this.Lng = pll.Lng; } + public PointLatLngAlt(Locationwp locwp) + { + this.Lat = locwp.lat; + this.Lng = locwp.lng; + this.Alt = locwp.alt; + } + public PointLatLngAlt(PointLatLngAlt plla) { this.Lat = plla.Lat; @@ -280,6 +288,7 @@ namespace ArdupilotMega public class Common { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public enum distances { Meters, @@ -323,6 +332,57 @@ namespace ArdupilotMega OF_LOITER = 10 } + public enum ac2ch7modes + { + CH7_DO_NOTHING = 0, + CH7_SET_HOVER = 1, + CH7_FLIP = 2, + CH7_SIMPLE_MODE = 3, + CH7_RTL = 4, + CH7_AUTO_TRIM = 5, + CH7_ADC_FILTER = 6, + CH7_SAVE_WP = 7 + } + + public enum ac2ch6modes + { + // CH_6 Tuning + // ----------- + CH6_NONE = 0, + // Attitude + CH6_STABILIZE_KP = 1, + CH6_STABILIZE_KI = 2, + CH6_YAW_KP = 3, + // Rate + CH6_RATE_KP = 4, + CH6_RATE_KI = 5, + CH6_RATE_KD = 21, + CH6_YAW_RATE_KP = 6, + // Altitude rate controller + CH6_THROTTLE_KP = 7, + // Extras + CH6_TOP_BOTTOM_RATIO = 8, + CH6_RELAY = 9, + CH6_TRAVERSE_SPEED = 10, + + CH6_NAV_P = 11, + CH6_LOITER_P = 12, + CH6_HELI_EXTERNAL_GYRO = 13, + + // altitude controller + CH6_THR_HOLD_KP = 14, + CH6_Z_GAIN = 15, + CH6_DAMP = 16, + + // optical flow controller + CH6_OPTFLOW_KP = 17, + CH6_OPTFLOW_KI = 18, + CH6_OPTFLOW_KD = 19, + + CH6_NAV_I = 20 + } + + public static void linearRegression() { double[] values = { 4.8, 4.8, 4.5, 3.9, 4.4, 3.6, 3.6, 2.9, 3.5, 3.0, 2.5, 2.2, 2.6, 2.1, 2.2 }; @@ -352,9 +412,9 @@ namespace ArdupilotMega double a = v1 / v2; double b = yAvg - a * xAvg; - Console.WriteLine("y = ax + b"); - Console.WriteLine("a = {0}, the slope of the trend line.", Math.Round(a, 2)); - Console.WriteLine("b = {0}, the intercept of the trend line.", Math.Round(b, 2)); + log.Debug("y = ax + b"); + log.DebugFormat("a = {0}, the slope of the trend line.", Math.Round(a, 2)); + log.DebugFormat("b = {0}, the intercept of the trend line.", Math.Round(b, 2)); //Console.ReadLine(); } @@ -518,7 +578,7 @@ namespace ArdupilotMega // Get the response. WebResponse response = request.GetResponse(); // Display the status. - Console.WriteLine(((HttpWebResponse)response).StatusDescription); + log.Info(((HttpWebResponse)response).StatusDescription); if (((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) return false; // Get the stream containing content returned by the server. @@ -536,7 +596,7 @@ namespace ArdupilotMega while (dataStream.CanRead && bytes > 0) { Application.DoEvents(); - Console.WriteLine(saveto + " " + bytes); + log.Info(saveto + " " + bytes); int len = dataStream.Read(buf1, 0, buf1.Length); bytes -= len; fs.Write(buf1, 0, len); @@ -551,7 +611,7 @@ namespace ArdupilotMega return true; } - catch (Exception ex) { Console.WriteLine("getFilefromNet(): " + ex.ToString()); return false; } + catch (Exception ex) { log.Info("getFilefromNet(): " + ex.ToString()); return false; } } public static Type getModes() diff --git a/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs b/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs index 8b4101039f..5b08850731 100644 --- a/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs +++ b/Tools/ArdupilotMegaPlanner/CommsSerialPort.cs @@ -8,7 +8,13 @@ namespace ArdupilotMega { class SerialPort : System.IO.Ports.SerialPort,ICommsSerial { + public new void Open() + { + if (base.IsOpen) + return; + base.Open(); + } public void toggleDTR() { diff --git a/Tools/ArdupilotMegaPlanner/CommsTCPSerial.cs b/Tools/ArdupilotMegaPlanner/CommsTCPSerial.cs index 8bfe204897..b9c2fbc5b8 100644 --- a/Tools/ArdupilotMegaPlanner/CommsTCPSerial.cs +++ b/Tools/ArdupilotMegaPlanner/CommsTCPSerial.cs @@ -1,16 +1,19 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Reflection; using System.Text; using System.IO.Ports; using System.Threading; using System.Net; // dns, ip address using System.Net.Sockets; // tcplistner +using log4net; namespace System.IO.Ports { public class TcpSerial : ArdupilotMega.ICommsSerial { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); TcpClient client = new TcpClient(); IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); byte[] rbuffer = new byte[0]; @@ -73,7 +76,7 @@ namespace System.IO.Ports { if (client.Client.Connected) { - Console.WriteLine("tcpserial socket already open"); + log.Warn("tcpserial socket already open"); return; } @@ -186,7 +189,7 @@ namespace System.IO.Ports VerifyConnected(); int size = client.Available; byte[] crap = new byte[size]; - Console.WriteLine("TcpSerial DiscardInBuffer {0}",size); + log.InfoFormat("TcpSerial DiscardInBuffer {0}",size); Read(crap, 0, size); } diff --git a/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs b/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs index 621e4ac277..e446c4df94 100644 --- a/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs +++ b/Tools/ArdupilotMegaPlanner/CommsUdpSerial.cs @@ -1,16 +1,14 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; +using System.Reflection; using System.Text; -using System.IO.Ports; -using System.Threading; using System.Net; // dns, ip address using System.Net.Sockets; // tcplistner +using log4net; 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]; @@ -73,7 +71,7 @@ namespace System.IO.Ports { if (client.Client.Connected) { - Console.WriteLine("udpserial socket already open"); + log.Info("udpserial socket already open"); return; } @@ -97,12 +95,16 @@ namespace System.IO.Ports try { client.Receive(ref RemoteIpEndPoint); - Console.WriteLine("NetSerial connecting to {0} : {1}", RemoteIpEndPoint.Address, RemoteIpEndPoint.Port); + log.InfoFormat("NetSerial connecting to {0} : {1}", RemoteIpEndPoint.Address, RemoteIpEndPoint.Port); client.Connect(RemoteIpEndPoint); } - catch (Exception e) { - if (client != null && client.Client.Connected) { client.Close(); } - Console.WriteLine(e.ToString()); + catch (Exception e) + { + if (client != null && client.Client.Connected) + { + client.Close(); + } + log.Info(e.ToString()); System.Windows.Forms.MessageBox.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); } @@ -208,7 +210,7 @@ namespace System.IO.Ports VerifyConnected(); int size = client.Available; byte[] crap = new byte[size]; - Console.WriteLine("UdpSerial DiscardInBuffer {0}",size); + log.InfoFormat("UdpSerial DiscardInBuffer {0}",size); Read(crap, 0, size); } diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index 6912ffd17c..9f1c63087f 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -1,13 +1,16 @@ using System; using System.Collections.Generic; +using System.Reflection; using System.Text; using System.ComponentModel; using ArdupilotMega.Mavlink; +using log4net; namespace ArdupilotMega { public class CurrentState : ICloneable { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // multipliers public float multiplierdist = 1; public float multiplierspeed = 1; @@ -858,7 +861,7 @@ namespace ArdupilotMega //Console.WriteLine(DateTime.Now.Millisecond + " done "); } } - catch { Console.WriteLine("CurrentState Binding error"); } + catch { log.InfoFormat("CurrentState Binding error"); } } public object Clone() diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs index 4c0332e32b..760c3222da 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs @@ -30,8 +30,8 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.Params = new System.Windows.Forms.DataGridView(); this.Command = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -141,6 +141,8 @@ this.RLL2SRV_P = new System.Windows.Forms.NumericUpDown(); this.label52 = new System.Windows.Forms.Label(); this.TabAC = new System.Windows.Forms.TabPage(); + this.TUNE_LOW = new System.Windows.Forms.NumericUpDown(); + this.TUNE_HIGH = new System.Windows.Forms.NumericUpDown(); this.myLabel2 = new ArdupilotMega.MyLabel(); this.TUNE = new System.Windows.Forms.ComboBox(); this.myLabel1 = new ArdupilotMega.MyLabel(); @@ -345,6 +347,8 @@ ((System.ComponentModel.ISupportInitialize)(this.RLL2SRV_I)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.RLL2SRV_P)).BeginInit(); this.TabAC.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).BeginInit(); this.groupBox5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.THR_RATE_D)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.THR_RATE_IMAX)).BeginInit(); @@ -403,14 +407,14 @@ this.Params.AllowUserToAddRows = false; this.Params.AllowUserToDeleteRows = false; resources.ApplyResources(this.Params, "Params"); - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.Maroon; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.Maroon; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle3.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3; this.Params.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.Params.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Command, @@ -419,14 +423,14 @@ this.mavScale, this.RawValue}); this.Params.Name = "Params"; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.ActiveCaption; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.ActiveCaption; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; this.Params.RowHeadersVisible = false; this.Params.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.Params_CellValueChanged); // @@ -1087,6 +1091,8 @@ // // TabAC // + this.TabAC.Controls.Add(this.TUNE_LOW); + this.TabAC.Controls.Add(this.TUNE_HIGH); this.TabAC.Controls.Add(this.myLabel2); this.TabAC.Controls.Add(this.TUNE); this.TabAC.Controls.Add(this.myLabel1); @@ -1106,6 +1112,16 @@ resources.ApplyResources(this.TabAC, "TabAC"); this.TabAC.Name = "TabAC"; // + // TUNE_LOW + // + resources.ApplyResources(this.TUNE_LOW, "TUNE_LOW"); + this.TUNE_LOW.Name = "TUNE_LOW"; + // + // TUNE_HIGH + // + resources.ApplyResources(this.TUNE_HIGH, "TUNE_HIGH"); + this.TUNE_HIGH.Name = "TUNE_HIGH"; + // // myLabel2 // resources.ApplyResources(this.myLabel2, "myLabel2"); @@ -1138,7 +1154,8 @@ resources.GetString("TUNE.Items17"), resources.GetString("TUNE.Items18"), resources.GetString("TUNE.Items19"), - resources.GetString("TUNE.Items20")}); + resources.GetString("TUNE.Items20"), + resources.GetString("TUNE.Items21")}); resources.ApplyResources(this.TUNE, "TUNE"); this.TUNE.Name = "TUNE"; // @@ -2190,6 +2207,8 @@ ((System.ComponentModel.ISupportInitialize)(this.RLL2SRV_P)).EndInit(); this.TabAC.ResumeLayout(false); this.TabAC.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).EndInit(); this.groupBox5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.THR_RATE_D)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.THR_RATE_IMAX)).EndInit(); @@ -2500,5 +2519,7 @@ private System.Windows.Forms.Label label29; private System.Windows.Forms.NumericUpDown STAB_D; private System.Windows.Forms.Label lblSTAB_D; + private System.Windows.Forms.NumericUpDown TUNE_LOW; + private System.Windows.Forms.NumericUpDown TUNE_HIGH; } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs index 2a10e2a59e..ff0a1614a0 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs @@ -164,6 +164,10 @@ namespace ArdupilotMega.GCSViews // set distance/speed unit states CMB_distunits.DataSource = Enum.GetNames(typeof(Common.distances)); CMB_speedunits.DataSource = Enum.GetNames(typeof(Common.speeds)); + + CH7_OPT.DataSource = Enum.GetNames(typeof(Common.ac2ch7modes)); + TUNE.DataSource = Enum.GetNames(typeof(Common.ac2ch6modes)); + if (MainV2.config["distunits"] != null) CMB_distunits.Text = MainV2.config["distunits"].ToString(); if (MainV2.config["speedunits"] != null) @@ -180,13 +184,13 @@ namespace ArdupilotMega.GCSViews CMB_language.DisplayMember = "DisplayName"; CMB_language.DataSource = languages; - ci = Thread.CurrentThread.CurrentUICulture; + ci = Thread.CurrentThread.CurrentUICulture; for (int i = 0; i < languages.Count; i++) - { - if (ci.IsChildOf(languages[i])) { - CMB_language.SelectedIndex = i; - break; + if (ci.IsChildOf(languages[i])) + { + CMB_language.SelectedIndex = i; + break; } } CMB_language.SelectedIndexChanged += CMB_language_SelectedIndexChanged; @@ -231,7 +235,9 @@ namespace ArdupilotMega.GCSViews string data = resources.GetString("MAVParam"); if (data == null) - return; + { + data = global::ArdupilotMega.Properties.Resources.MAVParam; + } string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); @@ -549,23 +555,23 @@ namespace ArdupilotMega.GCSViews if (text.Length > 0) { if (text[0].GetType() == typeof(NumericUpDown)) - { - decimal option = (decimal)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString())); - ((NumericUpDown)text[0]).Value = option; - ((NumericUpDown)text[0]).BackColor = Color.Green; - } + { + decimal option = (decimal)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString())); + ((NumericUpDown)text[0]).Value = option; + ((NumericUpDown)text[0]).BackColor = Color.Green; + } else if (text[0].GetType() == typeof(ComboBox)) - { - int option = (int)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString())); - ((ComboBox)text[0]).SelectedIndex = option; - ((ComboBox)text[0]).BackColor = Color.Green; - } + { + int option = (int)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString())); + ((ComboBox)text[0]).SelectedIndex = option; + ((ComboBox)text[0]).BackColor = Color.Green; + } } } catch { ((Control)text[0]).BackColor = Color.Red; } Params.Focus(); - } + } private void BUT_load_Click(object sender, EventArgs e) { @@ -593,12 +599,12 @@ namespace ArdupilotMega.GCSViews continue; if (index2 != -1) - line = line.Replace(',', '.'); + line = line.Replace(',','.'); string name = line.Substring(0, index); float value = float.Parse(line.Substring(index + 1), new System.Globalization.CultureInfo("en-US")); - MAVLink.modifyParamForDisplay(true, name, ref value); + MAVLink.modifyParamForDisplay(true,name,ref value); // set param table as well foreach (DataGridViewRow row in Params.Rows) @@ -753,6 +759,8 @@ namespace ArdupilotMega.GCSViews MainV2.cam.Start(); + MainV2.config["video_options"] = CMB_videoresolutions.SelectedIndex; + BUT_videostart.Enabled = false; } catch (Exception ex) { MessageBox.Show("Camera Fail: " + ex.Message); } @@ -807,10 +815,9 @@ namespace ArdupilotMega.GCSViews { DsError.ThrowExceptionForHR(hr); } - catch (Exception ex) - { - MessageBox.Show("Can not add video source\n" + ex.ToString()); - return; + catch (Exception ex) { + MessageBox.Show("Can not add video source\n" + ex.ToString()); + return; } // Find the stream config interface @@ -839,6 +846,11 @@ namespace ArdupilotMega.GCSViews DsUtils.FreeAMMediaType(media); CMB_videoresolutions.DataSource = modes; + + if (MainV2.getConfig("video_options") != "" && CMB_videosources.Text != "") + { + CMB_videoresolutions.SelectedIndex = int.Parse(MainV2.getConfig("video_options")); + } } private void CHK_hudshow_CheckedChanged(object sender, EventArgs e) @@ -935,7 +947,7 @@ namespace ArdupilotMega.GCSViews - + } catch { MessageBox.Show("Error: getting param list"); } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx index d92de5c219..0cf4249838 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.resx @@ -192,6 +192,2346 @@ Top, Bottom, Left, Right + + groupBox3 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 0 + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 1 + + + groupBox2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 2 + + + groupBox15 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 3 + + + groupBox16 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 4 + + + groupBox14 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 5 + + + groupBox13 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 6 + + + groupBox12 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 7 + + + groupBox11 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 8 + + + groupBox10 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 9 + + + groupBox9 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 10 + + + groupBox8 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 11 + + + 4, 22 + + + 0, 0, 0, 0 + + + 722, 434 + + + 0 + + + ArduPlane + + + TabAP + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ConfigTabs + + + 0 + + + 543, 297 + + + 78, 20 + + + 22 + + + TUNE_LOW + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 0 + + + 627, 296 + + + 78, 20 + + + 21 + + + TUNE_HIGH + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 1 + + + 534, 270 + + + 53, 23 + + + 20 + + + Ch6 Opt + + + myLabel2 + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + TabAC + + + 2 + + + CH6_NONE + + + CH6_STABILIZE_KP + + + CH6_STABILIZE_KI + + + CH6_YAW_KP + + + CH6_RATE_KP + + + CH6_RATE_KI + + + CH6_YAW_RATE_KP + + + CH6_THROTTLE_KP + + + CH6_TOP_BOTTOM_RATIO + + + CH6_RELAY + + + CH6_TRAVERSE_SPEED + + + CH6_NAV_P + + + CH6_LOITER_P + + + CH6_HELI_EXTERNAL_GYRO + + + CH6_THR_HOLD_KP + + + CH6_Z_GAIN + + + CH6_DAMP + + + CH6_OPTFLOW_KP + + + CH6_OPTFLOW_KI + + + CH6_OPTFLOW_KD + + + CH6_NAV_I + + + CH6_RATE_KD + + + 593, 270 + + + 112, 21 + + + 19 + + + TUNE + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 3 + + + 534, 322 + + + 53, 23 + + + 18 + + + Ch7 Opt + + + myLabel1 + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + TabAC + + + 4 + + + Do Nothing + + + + + + + + + Simple Mode + + + RTL + + + + + + + + + Save WP + + + 593, 322 + + + 112, 21 + + + 17 + + + CH7_OPT + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 5 + + + THR_RATE_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 0 + + + label29 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 1 + + + label14 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 2 + + + THR_RATE_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 3 + + + THR_RATE_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 4 + + + label20 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 5 + + + THR_RATE_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 6 + + + label25 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 7 + + + 6, 260 + + + 170, 110 + + + 16 + + + Throttle Rate + + + groupBox5 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 6 + + + True + + + 3, 240 + + + 154, 17 + + + 13 + + + Lock Pitch and Roll Values + + + CHK_lockrollpitch + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 7 + + + NAV_LAT_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 0 + + + label27 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 1 + + + WP_SPEED_MAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 2 + + + label9 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 3 + + + NAV_LAT_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 4 + + + label13 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 5 + + + NAV_LAT_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 6 + + + label15 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 7 + + + NAV_LAT_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 8 + + + label16 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 9 + + + 534, 126 + + + 170, 131 + + + 0 + + + Nav WP + + + groupBox4 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 8 + + + XTRK_GAIN_SC1 + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 0 + + + label18 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 1 + + + 358, 260 + + + 170, 43 + + + 2 + + + Crosstrack Correction + + + groupBox6 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 9 + + + THR_ALT_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox7 + + + 0 + + + label19 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox7 + + + 1 + + + THR_ALT_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox7 + + + 2 + + + label21 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox7 + + + 3 + + + THR_ALT_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox7 + + + 4 + + + label22 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox7 + + + 5 + + + 182, 260 + + + 170, 110 + + + 3 + + + Altitude Hold + + + groupBox7 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 10 + + + HLD_LAT_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox19 + + + 0 + + + label28 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox19 + + + 1 + + + HLD_LAT_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox19 + + + 2 + + + label30 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox19 + + + 3 + + + HLD_LAT_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox19 + + + 4 + + + label31 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox19 + + + 5 + + + 531, 6 + + + 170, 95 + + + 6 + + + Loiter + + + groupBox19 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 11 + + + STB_YAW_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox20 + + + 0 + + + label32 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox20 + + + 1 + + + STB_YAW_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox20 + + + 2 + + + label34 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox20 + + + 3 + + + STB_YAW_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox20 + + + 4 + + + label35 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox20 + + + 5 + + + 358, 6 + + + 170, 95 + + + 7 + + + Stabilize Yaw + + + groupBox20 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 12 + + + STAB_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 0 + + + lblSTAB_D + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 1 + + + STB_PIT_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 2 + + + label36 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 3 + + + STB_PIT_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 4 + + + label41 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 5 + + + STB_PIT_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 6 + + + label42 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox21 + + + 7 + + + 182, 6 + + + 170, 114 + + + 8 + + + Stabilize Pitch + + + groupBox21 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 13 + + + STB_RLL_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox22 + + + 0 + + + label43 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox22 + + + 1 + + + STB_RLL_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox22 + + + 2 + + + label45 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox22 + + + 3 + + + STB_RLL_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox22 + + + 4 + + + label46 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox22 + + + 5 + + + 6, 6 + + + 170, 95 + + + 9 + + + Stabilize Roll + + + groupBox22 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 14 + + + RATE_YAW_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 0 + + + label10 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 1 + + + RATE_YAW_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 2 + + + label47 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 3 + + + RATE_YAW_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 4 + + + label77 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 5 + + + RATE_YAW_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 6 + + + label82 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox23 + + + 7 + + + 358, 126 + + + 170, 108 + + + 10 + + + Rate Yaw + + + groupBox23 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 15 + + + RATE_PIT_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 0 + + + label11 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 1 + + + RATE_PIT_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 2 + + + label84 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 3 + + + RATE_PIT_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 4 + + + label86 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 5 + + + RATE_PIT_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 6 + + + label87 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox24 + + + 7 + + + 182, 126 + + + 170, 108 + + + 11 + + + Rate Pitch + + + groupBox24 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 16 + + + RATE_RLL_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 0 + + + label17 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 1 + + + RATE_RLL_IMAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 2 + + + label88 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 3 + + + RATE_RLL_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 4 + + + label90 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 5 + + + RATE_RLL_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 6 + + + label91 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox25 + + + 7 + + + 6, 126 + + + 170, 108 + + + 12 + + + Rate Roll + + + groupBox25 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAC + + + 17 + + + 4, 22 + + + 3, 3, 3, 3 + + + 722, 434 + + + 1 + + + ArduCopter + + + TabAC + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ConfigTabs + + + 1 + + + label26 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 0 + + + CMB_videoresolutions + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 1 + + + label12 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 2 + + + CHK_GDIPlus + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 3 + + + label24 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 4 + + + CHK_loadwponconnect + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 5 + + + label23 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 6 + + + NUM_tracklength + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 7 + + + CHK_speechaltwarning + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 8 + + + label108 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 9 + + + CHK_resetapmonconnect + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 10 + + + CHK_mavdebug + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 11 + + + label107 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 12 + + + CMB_raterc + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 13 + + + label104 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 14 + + + label103 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 15 + + + label102 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 16 + + + label101 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 17 + + + CMB_ratestatus + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 18 + + + CMB_rateposition + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 19 + + + CMB_rateattitude + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 20 + + + label99 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 21 + + + label98 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 22 + + + label97 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 23 + + + CMB_speedunits + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 24 + + + CMB_distunits + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 25 + + + label96 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 26 + + + label95 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 27 + + + CHK_speechbattery + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 28 + + + CHK_speechcustom + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 29 + + + CHK_speechmode + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 30 + + + CHK_speechwaypoint + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 31 + + + label94 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 32 + + + CMB_osdcolor + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 33 + + + CMB_language + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 34 + + + label93 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 35 + + + CHK_enablespeech + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 36 + + + CHK_hudshow + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 37 + + + label92 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 38 + + + CMB_videosources + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabPlanner + + + 39 + + + BUT_Joystick + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + TabPlanner + + + 40 + + + BUT_videostop + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + TabPlanner + + + 41 + + + BUT_videostart + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + TabPlanner + + + 42 + + + 4, 22 + + + 3, 3, 3, 3 + + + 722, 434 + + + 2 + + + Planner + + + TabPlanner + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ConfigTabs + + + 2 + + + 4, 22 + + + 722, 434 + + + 3 + + + Setup + + + TabSetup + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ConfigTabs + + + 3 + + + 52, 18 + + + 278, 0 + + + 0, 0, 0, 0 + + + 0, 0 + + + 730, 460 + + + 62 + + + ConfigTabs + + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + THR_FS_VALUE + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 0 + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 1 + + + THR_MAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 2 + + + label6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 3 + + + THR_MIN + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 4 + + + label7 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 5 + + + TRIM_THROTTLE + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 6 + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 7 + + + 405, 217 + + + 195, 108 + + + 0 + + + Throttle 0-100% + + + groupBox3 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + TabAP + + + 0 + 111, 82 @@ -384,29 +2724,125 @@ 7 - - 405, 217 + + ARSPD_RATIO - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + ARSPD_FBW_MAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 3 + + + ARSPD_FBW_MIN + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 4 + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 5 + + + TRIM_ARSPD_CM + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 6 + + + label4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 7 + + + 406, 325 + + 195, 108 - - 0 + + 1 - - Throttle 0-100% + + Airspeed m/s - - groupBox3 + + groupBox1 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 0 + + 1 111, 82 @@ -600,29 +3036,101 @@ 7 - - 406, 325 + + LIM_PITCH_MIN - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 0 + + + label39 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 1 + + + LIM_PITCH_MAX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 2 + + + label38 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 3 + + + LIM_ROLL_CD + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 4 + + + label37 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 5 + + + 205, 325 + + 195, 108 - - 1 + + 2 - - Airspeed m/s + + Navigation Angles - - groupBox1 + + groupBox2 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 1 + + 2 111, 59 @@ -768,29 +3276,77 @@ 5 - - 205, 325 + + XTRK_ANGLE_CD - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox15 + + + 0 + + + label79 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox15 + + + 1 + + + XTRK_GAIN_SC + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox15 + + + 2 + + + label80 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox15 + + + 3 + + + 4, 325 + + 195, 108 - - 2 + + 3 - - Navigation Angles + + Xtrack Pids - - groupBox2 + + groupBox15 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 2 + + 3 111, 36 @@ -888,29 +3444,101 @@ 3 - - 4, 325 + + KFF_PTCH2THR - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox16 + + + 0 + + + label83 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox16 + + + 1 + + + KFF_RDDRMIX + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox16 + + + 2 + + + label78 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox16 + + + 3 + + + KFF_PTCHCOMP + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox16 + + + 4 + + + label81 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox16 + + + 5 + + + 205, 217 + + 195, 108 - - 3 + + 4 - - Xtrack Pids + + Other Mix's - - groupBox15 + + groupBox16 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 3 + + 4 111, 13 @@ -1056,29 +3684,125 @@ 5 - - 205, 217 + + ENRGY2THR_IMAX - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 0 + + + label73 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 1 + + + ENRGY2THR_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 2 + + + label74 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 3 + + + ENRGY2THR_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 4 + + + label75 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 5 + + + ENRGY2THR_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 6 + + + label76 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox14 + + + 7 + + + 4, 217 + + 195, 108 - - 4 + + 5 - - Other Mix's + + Energy/Alt Pid - - groupBox16 + + groupBox14 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 4 + + 5 111, 82 @@ -1272,29 +3996,125 @@ 7 - - 4, 217 + + ALT2PTCH_IMAX - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 0 + + + label69 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 1 + + + ALT2PTCH_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 2 + + + label70 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 3 + + + ALT2PTCH_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 4 + + + label71 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 5 + + + ALT2PTCH_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 6 + + + label72 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox13 + + + 7 + + + 406, 109 + + 195, 108 - - 5 + + 6 - - Energy/Alt Pid + + Nav Pitch Alt Pid - - groupBox14 + + groupBox13 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 5 + + 6 111, 82 @@ -1488,29 +4308,125 @@ 7 - - 406, 109 + + ARSP2PTCH_IMAX - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 0 + + + label65 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 1 + + + ARSP2PTCH_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 2 + + + label66 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 3 + + + ARSP2PTCH_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 4 + + + label67 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 5 + + + ARSP2PTCH_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 6 + + + label68 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox12 + + + 7 + + + 205, 109 + + 195, 108 - - 6 + + 7 - - Nav Pitch Alt Pid + + Nav Pitch AS Pid - - groupBox13 + + groupBox12 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 6 + + 7 111, 82 @@ -1704,29 +4620,125 @@ 7 - - 205, 109 + + HDNG2RLL_IMAX - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 0 + + + label61 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 1 + + + HDNG2RLL_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 2 + + + label62 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 3 + + + HDNG2RLL_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 4 + + + label63 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 5 + + + HDNG2RLL_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 6 + + + label64 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox11 + + + 7 + + + 4, 109 + + 195, 108 - - 7 + + 8 - - Nav Pitch AS Pid + + Nav Roll Pid - - groupBox12 + + groupBox11 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 7 + + 8 111, 82 @@ -1920,29 +4932,125 @@ 7 - - 4, 109 + + YW2SRV_IMAX - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 0 + + + label57 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 1 + + + YW2SRV_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 2 + + + label58 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 3 + + + YW2SRV_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 4 + + + label59 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 5 + + + YW2SRV_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 6 + + + label60 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox10 + + + 7 + + + 406, 1 + + 195, 108 - - 8 + + 9 - - Nav Roll Pid + + Servo Yaw Pid - - groupBox11 + + groupBox10 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 8 + + 9 111, 82 @@ -2136,29 +5244,125 @@ 7 - - 406, 1 + + PTCH2SRV_IMAX - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 0 + + + label53 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 1 + + + PTCH2SRV_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 2 + + + label54 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 3 + + + PTCH2SRV_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 4 + + + label55 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 5 + + + PTCH2SRV_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 6 + + + label56 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox9 + + + 7 + + + 205, 1 + + 195, 108 - - 9 + + 10 - - Servo Yaw Pid + + Servo Pitch Pid - - groupBox10 + + groupBox9 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 9 + + 10 111, 82 @@ -2352,29 +5556,125 @@ 7 - - 205, 1 + + RLL2SRV_IMAX - + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 0 + + + label49 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 1 + + + RLL2SRV_D + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 2 + + + label50 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 3 + + + RLL2SRV_I + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 4 + + + label51 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 5 + + + RLL2SRV_P + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 6 + + + label52 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox8 + + + 7 + + + 4, 1 + + 195, 108 - - 10 + + 11 - - Servo Pitch Pid + + Servo Roll Pid - - groupBox9 + + groupBox8 - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + TabAP - - 10 + + 11 111, 82 @@ -2568,234 +5868,6 @@ 7 - - 4, 1 - - - 195, 108 - - - 11 - - - Servo Roll Pid - - - groupBox8 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAP - - - 11 - - - 4, 22 - - - 0, 0, 0, 0 - - - 722, 434 - - - 0 - - - ArduPlane - - - TabAP - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ConfigTabs - - - 0 - - - 358, 336 - - - 53, 23 - - - 20 - - - Ch6 Opt - - - myLabel2 - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc - - - TabAC - - - 0 - - - CH6_NONE - - - CH6_STABILIZE_KP - - - CH6_STABILIZE_KI - - - CH6_YAW_KP - - - CH6_RATE_KP - - - CH6_RATE_KI - - - CH6_YAW_RATE_KP - - - CH6_THROTTLE_KP - - - CH6_TOP_BOTTOM_RATIO - - - CH6_RELAY - - - CH6_TRAVERSE_SPEED - - - CH6_NAV_P - - - CH6_LOITER_P - - - CH6_HELI_EXTERNAL_GYRO - - - CH6_THR_HOLD_KP - - - CH6_Z_GAIN - - - CH6_DAMP - - - CH6_OPTFLOW_KP - - - CH6_OPTFLOW_KI - - - CH6_OPTFLOW_KD - - - CH6_NAV_I - - - 417, 336 - - - 112, 21 - - - 19 - - - TUNE - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 1 - - - 358, 309 - - - 53, 23 - - - 18 - - - Ch7 Opt - - - myLabel1 - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc - - - TabAC - - - 2 - - - Do Nothing - - - - - - - - - Simple Mode - - - RTL - - - - - - - - - Save WP - - - 417, 309 - - - 112, 21 - - - 17 - - - CH7_OPT - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 3 - 80, 60 @@ -2988,57 +6060,6 @@ 7 - - 6, 260 - - - 170, 110 - - - 16 - - - Throttle Rate - - - groupBox5 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 4 - - - True - - - 3, 240 - - - 154, 17 - - - 13 - - - Lock Pitch and Roll Values - - - CHK_lockrollpitch - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 5 - 80, 60 @@ -3279,30 +6300,6 @@ 9 - - 534, 126 - - - 170, 131 - - - 0 - - - Nav WP - - - groupBox4 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 6 - 80, 13 @@ -3351,30 +6348,6 @@ 1 - - 358, 260 - - - 170, 43 - - - 2 - - - Crosstrack Correction - - - groupBox6 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 7 - 80, 63 @@ -3519,30 +6492,6 @@ 5 - - 182, 260 - - - 170, 110 - - - 3 - - - Altitude Hold - - - groupBox7 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 8 - 80, 61 @@ -3687,30 +6636,6 @@ 5 - - 531, 6 - - - 170, 95 - - - 6 - - - Loiter - - - groupBox19 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 9 - 80, 63 @@ -3855,30 +6780,6 @@ 5 - - 358, 6 - - - 170, 95 - - - 7 - - - Stabilize Yaw - - - groupBox20 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 10 - 80, 88 @@ -4071,30 +6972,6 @@ 7 - - 182, 6 - - - 170, 114 - - - 8 - - - Stabilize Pitch - - - groupBox21 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 11 - 80, 63 @@ -4239,30 +7116,6 @@ 5 - - 6, 6 - - - 170, 95 - - - 9 - - - Stabilize Roll - - - groupBox22 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 12 - 80, 60 @@ -4455,30 +7308,6 @@ 7 - - 358, 126 - - - 170, 108 - - - 10 - - - Rate Yaw - - - groupBox23 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 13 - 80, 60 @@ -4671,30 +7500,6 @@ 7 - - 182, 126 - - - 170, 108 - - - 11 - - - Rate Pitch - - - groupBox24 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 14 - 80, 60 @@ -4887,57 +7692,6 @@ 7 - - 6, 126 - - - 170, 108 - - - 12 - - - Rate Roll - - - groupBox25 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - TabAC - - - 15 - - - 4, 22 - - - 3, 3, 3, 3 - - - 722, 434 - - - 1 - - - ArduCopter - - - TabAC - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ConfigTabs - - - 1 - NoControl @@ -5013,6 +7767,9 @@ 2 + + 17, 17 + NoControl @@ -5028,9 +7785,6 @@ GDI+ (old type) - - 17, 17 - OpenGL = Disabled GDI+ = Enabled @@ -6095,87 +8849,6 @@ GDI+ = Enabled 42 - - 4, 22 - - - 3, 3, 3, 3 - - - 722, 434 - - - 2 - - - Planner - - - TabPlanner - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ConfigTabs - - - 2 - - - 4, 22 - - - 722, 434 - - - 3 - - - Setup - - - TabSetup - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ConfigTabs - - - 3 - - - 52, 18 - - - 278, 0 - - - 0, 0, 0, 0 - - - 0, 0 - - - 730, 460 - - - 62 - - - ConfigTabs - - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - 0, 0 @@ -6329,6 +9002,9 @@ GDI+ = Enabled 5 + + 17, 17 + Bottom, Left diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index 94e42f21fe..b2ae277080 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -1,28 +1,24 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; +using System.Reflection; using System.Windows.Forms; -using System.Text.RegularExpressions; using System.IO.Ports; using System.IO; -using System.Runtime.InteropServices; using System.Xml; using System.Net; +using log4net; namespace ArdupilotMega.GCSViews { partial class Firmware : MyUserControl { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.Control | Keys.C)) { - OpenFileDialog fd = new OpenFileDialog(); - fd.Filter = "Firmware (*.hex)|*.hex"; + var fd = new OpenFileDialog {Filter = "Firmware (*.hex)|*.hex"}; fd.ShowDialog(); if (File.Exists(fd.FileName)) { @@ -69,7 +65,7 @@ namespace ArdupilotMega.GCSViews internal void Firmware_Load(object sender, EventArgs e) { - Console.WriteLine("FW load"); + log.Info("FW load"); string url = ""; string url2560 = ""; @@ -141,11 +137,14 @@ namespace ArdupilotMega.GCSViews } } - List list = new List(); } - catch (Exception ex) { MessageBox.Show("Failed to get Firmware List : " + ex.Message); } - Console.WriteLine("FW load done"); + catch (Exception ex) + { + MessageBox.Show("Failed to get Firmware List : " + ex.Message); + } + log.Info("FW load done"); + } void updateDisplayName(software temp) @@ -192,7 +191,7 @@ namespace ArdupilotMega.GCSViews } else { - Console.WriteLine("No Home " + temp.name + " " + temp.url); + log.Info("No Home " + temp.name + " " + temp.url); } } @@ -354,7 +353,7 @@ namespace ArdupilotMega.GCSViews - Console.WriteLine("Detected a " + board); + log.Info("Detected a " + board); string baseurl = ""; if (board == "2560") @@ -375,7 +374,7 @@ namespace ArdupilotMega.GCSViews return; } - Console.WriteLine("Using " + baseurl); + log.Info("Using " + baseurl); // Create a request using a URL that can receive a post. WebRequest request = WebRequest.Create(baseurl); @@ -387,7 +386,7 @@ namespace ArdupilotMega.GCSViews // Get the response. WebResponse response = request.GetResponse(); // Display the status. - Console.WriteLine(((HttpWebResponse)response).StatusDescription); + log.Info(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. dataStream = response.GetResponseStream(); @@ -425,7 +424,7 @@ namespace ArdupilotMega.GCSViews progress.Value = 100; this.Refresh(); - Console.WriteLine("Downloaded"); + log.Info("Downloaded"); } catch (Exception ex) { lbl_status.Text = "Failed download"; MessageBox.Show("Failed to download new firmware : " + ex.ToString()); return; } @@ -443,9 +442,18 @@ namespace ArdupilotMega.GCSViews sr = new StreamReader(filename); FLASH = readIntelHEXv2(sr); sr.Close(); - Console.WriteLine("\n\nSize: {0}\n\n", FLASH.Length); + log.InfoFormat("\n\nSize: {0}\n\n", FLASH.Length); + } + catch (Exception ex) + { + if (sr != null) + { + sr.Dispose(); + } + lbl_status.Text = "Failed read HEX"; + MessageBox.Show("Failed to read firmware.hex : " + ex.Message); + return; } - catch (Exception ex) { if (sr != null) { sr.Dispose(); } lbl_status.Text = "Failed read HEX"; MessageBox.Show("Failed to read firmware.hex : " + ex.Message); return; } ArduinoComms port = new ArduinoSTK(); if (board == "1280") @@ -460,8 +468,10 @@ namespace ArdupilotMega.GCSViews } else if (board == "2560" || board == "2560-2") { - port = new ArduinoSTKv2(); - port.BaudRate = 115200; + port = new ArduinoSTKv2 + { + BaudRate = 115200 + }; } port.DataBits = 8; port.StopBits = StopBits.One; @@ -478,7 +488,7 @@ namespace ArdupilotMega.GCSViews if (port.connectAP()) { - Console.WriteLine("starting"); + log.Info("starting"); lbl_status.Text = "Uploading " + FLASH.Length + " bytes to APM"; progress.Value = 0; this.Refresh(); @@ -486,7 +496,7 @@ namespace ArdupilotMega.GCSViews // this is enough to make ap_var reset //port.upload(new byte[256], 0, 2, 0); - port.Progress += new ProgressEventHandler(port_Progress); + port.Progress += port_Progress; if (!port.uploadflash(FLASH, 0, FLASH.Length, 0)) { @@ -500,7 +510,7 @@ namespace ArdupilotMega.GCSViews progress.Value = 100; - Console.WriteLine("Uploaded"); + log.Info("Uploaded"); this.Refresh(); @@ -518,7 +528,7 @@ namespace ArdupilotMega.GCSViews progress.Value = (int)((start / (float)FLASH.Length) * 100); progress.Refresh(); port.setaddress(start); - Console.WriteLine("Downloading " + length + " at " + start); + log.Info("Downloading " + length + " at " + start); port.downloadflash(length).CopyTo(flashverify, start); start += length; } @@ -575,14 +585,19 @@ namespace ArdupilotMega.GCSViews progress.Value = 100; lbl_status.Text = "Done"; } - catch (Exception ex) { lbl_status.Text = "Failed upload"; MessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); } + catch (Exception ex) + { + lbl_status.Text = "Failed upload"; + MessageBox.Show("Check port settings or Port in use? " + ex); + port.Close(); + } flashing = false; MainV2.givecomport = false; } void port_Progress(int progress,string status) { - Console.WriteLine("Progress {0} ", progress); + log.InfoFormat("Progress {0} ", progress); this.progress.Value = progress; this.progress.Refresh(); } @@ -607,7 +622,7 @@ namespace ArdupilotMega.GCSViews int length = Convert.ToInt32(line.Substring(1, 2), 16); int address = Convert.ToInt32(line.Substring(3, 4), 16); int option = Convert.ToInt32(line.Substring(7, 2), 16); - Console.WriteLine("len {0} add {1} opt {2}", length, address, option); + log.InfoFormat("len {0} add {1} opt {2}", length, address, option); if (option == 0) { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs index b125db82f4..839114ccca 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs @@ -55,7 +55,7 @@ this.zg1 = new ZedGraph.ZedGraphControl(); this.lbl_winddir = new ArdupilotMega.MyLabel(); this.lbl_windvel = new ArdupilotMega.MyLabel(); - this.gMapControl1 = new myGMAP(); + this.gMapControl1 = new ArdupilotMega.myGMAP(); this.panel1 = new System.Windows.Forms.Panel(); this.TXT_lat = new ArdupilotMega.MyLabel(); this.Zoomlevel = new System.Windows.Forms.NumericUpDown(); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs index 00b2a2387e..a2498585e3 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs @@ -75,12 +75,14 @@ namespace ArdupilotMega.GCSViews public static GMapControl mymap = null; - PointLatLngAlt GuidedModeWP = new PointLatLngAlt(); + public static PointLatLngAlt GuidedModeWP = new PointLatLngAlt(); AviWriter aviwriter; public SplitContainer MainHcopy = null; + public static FlightData instance; + protected override void Dispose(bool disposing) { threadrun = 0; @@ -94,6 +96,8 @@ namespace ArdupilotMega.GCSViews { InitializeComponent(); + instance = this; + mymap = gMapControl1; myhud = hud1; MainHcopy = MainH; @@ -1013,11 +1017,27 @@ namespace ArdupilotMega.GCSViews if (MainV2.comPort.logreadmode) { MainV2.comPort.logreadmode = false; + ZedGraphTimer.Stop(); } else { BUT_clear_track_Click(sender, e); MainV2.comPort.logreadmode = true; + list1.Clear(); + list2.Clear(); + list3.Clear(); + list4.Clear(); + list5.Clear(); + list6.Clear(); + list7.Clear(); + list8.Clear(); + list9.Clear(); + list10.Clear(); + tickStart = Environment.TickCount; + + zg1.GraphPane.XAxis.Scale.Min = 0; + zg1.GraphPane.XAxis.Scale.Max = 1; + ZedGraphTimer.Start(); } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx index c5638dfb2d..896d5a711c 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx @@ -1391,7 +1391,7 @@ gMapControl1 - GMap.NET.WindowsForms.GMapControl, GMap.NET.WindowsForms, Version=1.5.5.5, Culture=neutral, PublicKeyToken=b85b9027b614afef + ArdupilotMega.myGMAP, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc splitContainer1.Panel2 diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index ff41e9046f..d6d4d55d5a 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -18,6 +18,7 @@ using System.Resources; using System.Reflection; using System.ComponentModel; using System.Threading; +using log4net; using SharpKml.Base; using SharpKml.Dom; @@ -27,6 +28,7 @@ namespace ArdupilotMega.GCSViews { partial class FlightPlanner : MyUserControl { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); int selectedrow = 0; bool quickadd = false; bool isonline = true; @@ -598,7 +600,7 @@ namespace ArdupilotMega.GCSViews void Commands_DataError(object sender, DataGridViewDataErrorEventArgs e) { - Console.WriteLine(e.Exception.ToString() + " " + e.Context + " col " + e.ColumnIndex); + log.Info(e.Exception.ToString() + " " + e.Context + " col " + e.ColumnIndex); e.Cancel = false; e.ThrowException = false; //throw new NotImplementedException(); @@ -700,7 +702,7 @@ namespace ArdupilotMega.GCSViews { try { - Console.WriteLine(Element.ToString() + " " + Element.Parent); + log.Info(Element.ToString() + " " + Element.Parent); } catch { } @@ -924,7 +926,7 @@ namespace ArdupilotMega.GCSViews drawnpolygons.Markers.Add(m); drawnpolygons.Markers.Add(mBorders); } - catch (Exception ex) { Console.WriteLine(ex.ToString()); } + catch (Exception ex) { log.Info(ex.ToString()); } } /// @@ -1052,7 +1054,7 @@ namespace ArdupilotMega.GCSViews System.Diagnostics.Debug.WriteLine(temp - System.Diagnostics.Stopwatch.GetTimestamp()); } } - catch (Exception e) { Console.WriteLine("writekml - bad wp data " + e.ToString()); } + catch (Exception e) { log.Info("writekml - bad wp data " + e.ToString()); } } if (usable > 0) @@ -1128,7 +1130,7 @@ namespace ArdupilotMega.GCSViews } catch (Exception ex) { - Console.WriteLine(ex.ToString()); + log.Info(ex.ToString()); } System.Diagnostics.Debug.WriteLine(DateTime.Now); @@ -1213,18 +1215,18 @@ namespace ArdupilotMega.GCSViews param = port.param; - Console.WriteLine("Getting WP #"); + log.Info("Getting WP #"); int cmdcount = port.getWPCount(); for (ushort a = 0; a < cmdcount; a++) { - Console.WriteLine("Getting WP" + a); + log.Info("Getting WP" + a); cmds.Add(port.getWP(a)); } port.setWPACK(); - Console.WriteLine("Done"); + log.Info("Done"); } catch (Exception ex) { error = 1; MessageBox.Show("Error : " + ex.ToString()); } try @@ -1237,7 +1239,7 @@ namespace ArdupilotMega.GCSViews { processToScreen(cmds); } - catch (Exception exx) { Console.WriteLine(exx.ToString()); } + catch (Exception exx) { log.Info(exx.ToString()); } } MainV2.givecomport = false; @@ -1248,7 +1250,7 @@ namespace ArdupilotMega.GCSViews }); } - catch (Exception exx) { Console.WriteLine(exx.ToString()); } + catch (Exception exx) { log.Info(exx.ToString()); } }); t12.IsBackground = true; t12.Name = "Read wps"; @@ -2523,7 +2525,7 @@ namespace ArdupilotMega.GCSViews double x = bottomleft.Lat - Math.Abs(fulllatdiff); double y = bottomleft.Lng - Math.Abs(fulllngdiff); - Console.WriteLine("{0} < {1} {2} < {3}", x, (topright.Lat), y, (topright.Lng)); + log.InfoFormat("{0} < {1} {2} < {3}", x, (topright.Lat), y, (topright.Lng)); while (x < (topright.Lat + Math.Abs(fulllatdiff)) && y < (topright.Lng + Math.Abs(fulllngdiff))) { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Help.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Help.cs index fa712b5f5c..35b05584ef 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Help.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Help.cs @@ -24,7 +24,7 @@ namespace ArdupilotMega.GCSViews public void BUT_updatecheck_Click(object sender, EventArgs e) { - MainV2.doupdate(); + MainV2.DoUpdate(); } private void CHK_showconsole_CheckedChanged(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs index b805771ee8..988580f1b9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs @@ -9,6 +9,7 @@ using System.IO.Ports; using System.IO; using System.Xml; // config file using System.Runtime.InteropServices; // dll imports +using log4net; using ZedGraph; // Graphs using ArdupilotMega; using ArdupilotMega.Mavlink; @@ -21,6 +22,7 @@ namespace ArdupilotMega.GCSViews { public partial class Simulation : MyUserControl { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); MAVLink comPort = MainV2.comPort; UdpClient XplanesSEND; UdpClient MavLink; @@ -570,7 +572,6 @@ namespace ArdupilotMega.GCSViews // re-request servo data if (!(lastdata.AddSeconds(8) > DateTime.Now)) { - Console.WriteLine("REQ streams - sim"); try { if (CHK_quad.Checked && !RAD_aerosimrc.Checked)// || chkSensor.Checked && RAD_JSBSim.Checked) @@ -610,12 +611,6 @@ namespace ArdupilotMega.GCSViews { Byte[] receiveBytes = MavLink.Receive(ref RemoteIpEndPoint); - Console.WriteLine("sending " + receiveBytes[5]); - - if (receiveBytes[5] == 39) - { - Console.WriteLine("wp no " + receiveBytes[9]); // ?? - } comPort.BaseStream.Write(receiveBytes, 0, receiveBytes.Length); } @@ -633,7 +628,7 @@ namespace ArdupilotMega.GCSViews processArduPilot(); } } - catch (Exception ex) { Console.WriteLine("SIM Main loop exception " + ex.ToString()); } + catch (Exception ex) { log.Info("SIM Main loop exception " + ex.ToString()); } if (hzcounttime.Second != DateTime.Now.Second) { @@ -689,7 +684,7 @@ namespace ArdupilotMega.GCSViews JSBSimSEND.Client.Send(System.Text.Encoding.ASCII.GetBytes("resume\r\n")); } - catch { Console.WriteLine("JSB console fail"); } + catch { log.Info("JSB console fail"); } } private void SetupUDPXplanes() @@ -1348,7 +1343,7 @@ namespace ArdupilotMega.GCSViews quad.update(ref m, lastfdmdata); } - catch (Exception e) { Console.WriteLine("Quad hill error " + e.ToString()); } + catch (Exception e) { log.Info("Quad hill error " + e.ToString()); } byte[] FlightGear = new byte[8 * 11];// StructureToByteArray(fg); @@ -1385,7 +1380,7 @@ namespace ArdupilotMega.GCSViews { XplanesSEND.Send(FlightGear, FlightGear.Length); } - catch (Exception) { Console.WriteLine("Socket Write failed, FG closed?"); } + catch (Exception) { log.Info("Socket Write failed, FG closed?"); } updateScreenDisplay(lastfdmdata.latitude, lastfdmdata.longitude, lastfdmdata.altitude * .3048, lastfdmdata.phi, lastfdmdata.theta, lastfdmdata.psi, lastfdmdata.psi, m[0], m[1], m[2], m[3]); @@ -1491,7 +1486,7 @@ namespace ArdupilotMega.GCSViews } } } - catch (Exception e) { Console.WriteLine("Error updateing screen stuff " + e.ToString()); } + catch (Exception e) { log.Info("Error updateing screen stuff " + e.ToString()); } packetssent++; @@ -1580,7 +1575,7 @@ namespace ArdupilotMega.GCSViews { XplanesSEND.Send(FlightGear, FlightGear.Length); } - catch (Exception) { Console.WriteLine("Socket Write failed, FG closed?"); } + catch (Exception) { log.Info("Socket Write failed, FG closed?"); } } @@ -1661,7 +1656,7 @@ namespace ArdupilotMega.GCSViews XplanesSEND.Send(Xplane, Xplane.Length); } - catch (Exception e) { Console.WriteLine("Xplanes udp send error " + e.Message); } + catch (Exception e) { log.Info("Xplanes udp send error " + e.Message); } } } diff --git a/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs b/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs index 7b998af76d..16414cbbb5 100644 --- a/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs +++ b/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; +using log4net; using YLScsDrawing.Drawing3d; using ArdupilotMega.HIL; @@ -101,6 +103,7 @@ namespace ArdupilotMega.HIL public class QuadCopter : Aircraft { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); QuadCopter self; int framecount = 0; diff --git a/Tools/ArdupilotMegaPlanner/HUD.cs b/Tools/ArdupilotMegaPlanner/HUD.cs index 299db6ed42..df2536e459 100644 --- a/Tools/ArdupilotMegaPlanner/HUD.cs +++ b/Tools/ArdupilotMegaPlanner/HUD.cs @@ -11,7 +11,7 @@ using System.Drawing.Imaging; using System.Threading; using System.Drawing.Drawing2D; - +using log4net; using OpenTK; using OpenTK.Graphics.OpenGL; using OpenTK.Graphics; @@ -24,6 +24,8 @@ 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(); @@ -189,10 +191,10 @@ namespace hud { GraphicsMode test = this.GraphicsMode; - Console.WriteLine(test.ToString()); - Console.WriteLine("Vendor: " + GL.GetString(StringName.Vendor)); - Console.WriteLine("Version: " + GL.GetString(StringName.Version)); - Console.WriteLine("Device: " + GL.GetString(StringName.Renderer)); + 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]; @@ -212,7 +214,7 @@ namespace hud GL.Enable(EnableCap.Blend); } - catch (Exception ex) { Console.WriteLine("HUD opengl onload " + ex.ToString()); } + catch (Exception ex) { log.Info("HUD opengl onload " + ex.ToString()); } try { @@ -266,7 +268,7 @@ namespace hud if (inOnPaint) { - Console.WriteLine("Was in onpaint Hud th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread); + log.Info("Was in onpaint Hud th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread); return; } @@ -295,7 +297,7 @@ namespace hud } } - catch (Exception ex) { Console.WriteLine(ex.ToString()); } + catch (Exception ex) { log.Info(ex.ToString()); } inOnPaint = false; @@ -1323,7 +1325,7 @@ namespace hud } catch (Exception ex) { - Console.WriteLine("hud error "+ex.ToString()); + log.Info("hud error "+ex.ToString()); } } @@ -1531,7 +1533,7 @@ namespace hud base.OnHandleCreated(e); } } - catch (Exception ex) { Console.WriteLine(ex.ToString()); opengl = false; } // macs fail here + catch (Exception ex) { log.Info(ex.ToString()); opengl = false; } // macs fail here } protected override void OnHandleDestroyed(EventArgs e) @@ -1543,7 +1545,7 @@ namespace hud base.OnHandleDestroyed(e); } } - catch (Exception ex) { Console.WriteLine(ex.ToString()); opengl = false; } + catch (Exception ex) { log.Info(ex.ToString()); opengl = false; } } protected override void OnResize(EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/Joystick.cs b/Tools/ArdupilotMegaPlanner/Joystick.cs index 189de315f4..40ea6ce81d 100644 --- a/Tools/ArdupilotMegaPlanner/Joystick.cs +++ b/Tools/ArdupilotMegaPlanner/Joystick.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; +using log4net; using Microsoft.DirectX.DirectInput; using System.Reflection; @@ -10,6 +11,7 @@ namespace ArdupilotMega { public class Joystick { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); Device joystick; JoystickState state; public bool enabled = false; @@ -148,12 +150,12 @@ namespace ArdupilotMega { //Console.WriteLine("Name: " + property.Name + ", Value: " + property.GetValue(obj, null)); - Console.WriteLine("test name {0} old {1} new {2} ", property.Name, values[property.Name], int.Parse(property.GetValue(nextstate, null).ToString())); - Console.WriteLine("{0} {1}", (int)values[property.Name], (int.Parse(property.GetValue(nextstate, null).ToString()) + threshold)); + log.InfoFormat("test name {0} old {1} new {2} ", property.Name, values[property.Name], int.Parse(property.GetValue(nextstate, null).ToString())); + log.InfoFormat("{0} {1}", (int)values[property.Name], (int.Parse(property.GetValue(nextstate, null).ToString()) + threshold)); if ((int)values[property.Name] > (int.Parse(property.GetValue(nextstate, null).ToString()) + threshold) || (int)values[property.Name] < (int.Parse(property.GetValue(nextstate, null).ToString()) - threshold)) { - Console.WriteLine("{0}", property.Name); + log.Info(property.Name); joystick.Unacquire(); return (joystickaxis)Enum.Parse(typeof(joystickaxis), property.Name); } @@ -337,7 +339,7 @@ namespace ArdupilotMega //Console.WriteLine("{0} {1} {2} {3}", MainV2.cs.rcoverridech1, MainV2.cs.rcoverridech2, MainV2.cs.rcoverridech3, MainV2.cs.rcoverridech4); } - catch (Exception ex) { Console.WriteLine("Joystick thread error "+ex.ToString()); } // so we cant fall out + catch (Exception ex) { log.Info("Joystick thread error "+ex.ToString()); } // so we cant fall out } } @@ -484,7 +486,7 @@ namespace ArdupilotMega state = joystick.CurrentJoystickState; ushort ans = pickchannel(channel, JoyChannels[channel].axis, JoyChannels[channel].reverse, JoyChannels[channel].expo); - Console.WriteLine("{0} = {1} = {2}",channel,ans, state.X); + log.DebugFormat("{0} = {1} = {2}",channel,ans, state.X); return ans; } diff --git a/Tools/ArdupilotMegaPlanner/LangUtility.cs b/Tools/ArdupilotMegaPlanner/LangUtility.cs new file mode 100644 index 0000000000..9fa34a9f7f --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/LangUtility.cs @@ -0,0 +1,64 @@ +//this file contains some simple extension methods + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.ComponentModel; +using System.Windows.Forms; + +namespace ArdupilotMega +{ + static class CultureInfoEx + { + public static CultureInfo GetCultureInfo(string name) + { + try { return new CultureInfo(name); } + catch (Exception) { return null; } + } + + public static bool IsChildOf(this CultureInfo cX, CultureInfo cY) + { + + if (cX == null || cY == null) + return false; + + CultureInfo c = cX; + while (!c.Equals(CultureInfo.InvariantCulture)) + { + if (c.Equals(cY)) + return true; + c = c.Parent; + } + return false; + } + } + + static class ComponentResourceManagerEx + { + public static void ApplyResource(this ComponentResourceManager rm, Control ctrl) + { + rm.ApplyResources(ctrl, ctrl.Name); + foreach (Control subctrl in ctrl.Controls) + ApplyResource(rm, subctrl); + + if (ctrl.ContextMenu != null) + ApplyResource(rm, ctrl.ContextMenu); + + + if (ctrl is DataGridView) + { + foreach (DataGridViewColumn col in (ctrl as DataGridView).Columns) + rm.ApplyResources(col, col.Name); + } + } + + public static void ApplyResource(this ComponentResourceManager rm, Menu menu) + { + rm.ApplyResources(menu, menu.Name); + foreach (MenuItem submenu in menu.MenuItems) + ApplyResource(rm, submenu); + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/Log.cs b/Tools/ArdupilotMegaPlanner/Log.cs index 6d75642413..17f5c72f74 100644 --- a/Tools/ArdupilotMegaPlanner/Log.cs +++ b/Tools/ArdupilotMegaPlanner/Log.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Reflection; using System.Text; using System.Windows.Forms; using System.IO.Ports; @@ -15,16 +16,17 @@ using Core.Geometry; using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Checksums; using ICSharpCode.SharpZipLib.Core; +using log4net; namespace ArdupilotMega { public partial class Log : Form { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); ICommsSerial comPort; int logcount = 0; serialstatus status = serialstatus.Connecting; - byte[] buffer = new byte[4000]; StreamWriter sw; int currentlog = 0; bool threadrun = true; @@ -72,14 +74,15 @@ namespace ArdupilotMega comPort.toggleDTR(); //comPort.Open(); } - catch (Exception) + catch (Exception ex) { + log.Error("Error opening comport", ex); MessageBox.Show("Error opening comport"); } - System.Threading.Thread t11 = new System.Threading.Thread(delegate() + var t11 = new System.Threading.Thread(delegate() { - DateTime start = DateTime.Now; + var start = DateTime.Now; threadrun = true; @@ -89,7 +92,9 @@ namespace ArdupilotMega { comPort.Write("\n\n\n\n"); // more in "connecting" } - catch { } + catch + { + } while (threadrun) { @@ -105,11 +110,13 @@ namespace ArdupilotMega comPort_DataReceived((object)null, (SerialDataReceivedEventArgs)null); } } - catch (Exception ex) { Console.WriteLine("crash in comport reader " + ex.ToString()); } // cant exit unless told to + catch (Exception ex) + { + log.Error("crash in comport reader " + ex); + } // cant exit unless told to } - Console.WriteLine("Comport thread close"); - }); - t11.Name = "comport reader"; + log.Info("Comport thread close"); + }) {Name = "comport reader"}; t11.Start(); MainV2.threads.Add(t11); @@ -303,7 +310,7 @@ namespace ArdupilotMega } } - Console.WriteLine("exit while"); + log.Info("exit while"); } catch (Exception ex) { MessageBox.Show("Error reading data" + ex.ToString()); } } @@ -532,7 +539,7 @@ namespace ArdupilotMega Style style2 = new Style(); Color color = Color.FromArgb(0xff, (stylecode >> 16) & 0xff, (stylecode >> 8) & 0xff, (stylecode >> 0) & 0xff); - Console.WriteLine("colour " + color.ToArgb().ToString("X") + " " + color.ToKnownColor().ToString()); + log.Info("colour " + color.ToArgb().ToString("X") + " " + color.ToKnownColor().ToString()); style2.Add(new LineStyle(color, 4)); diff --git a/Tools/ArdupilotMegaPlanner/LogBrowse.cs b/Tools/ArdupilotMegaPlanner/LogBrowse.cs index ebab445894..df1f7e349c 100644 --- a/Tools/ArdupilotMegaPlanner/LogBrowse.cs +++ b/Tools/ArdupilotMegaPlanner/LogBrowse.cs @@ -3,9 +3,11 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Reflection; using System.Text; using System.Windows.Forms; using System.IO; +using log4net; using ZedGraph; // Graphs using System.Xml; @@ -13,6 +15,7 @@ namespace ArdupilotMega { public partial class LogBrowse : Form { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); int m_iColumnCount = 0; DataTable m_dtCSV = new DataTable(); @@ -180,7 +183,7 @@ namespace ArdupilotMega if (inner.Name.StartsWith("F")) { dataGridView1.Columns[a].HeaderText = inner.ReadString(); - Console.WriteLine(a + " " + dataGridView1.Columns[a].HeaderText); + log.Info(a + " " + dataGridView1.Columns[a].HeaderText); a++; } @@ -194,7 +197,7 @@ namespace ArdupilotMega } } - catch { Console.WriteLine("DGV logbrowse error"); } + catch { log.Info("DGV logbrowse error"); } } public void CreateChart(ZedGraphControl zgc) @@ -308,7 +311,7 @@ namespace ArdupilotMega break; } } - catch { error++; Console.WriteLine("Bad Data : " + type + " " + col + " " + a); if (error >= 500) { MessageBox.Show("There is to much bad data - failing"); break; } } + catch { error++; log.Info("Bad Data : " + type + " " + col + " " + a); if (error >= 500) { MessageBox.Show("There is to much bad data - failing"); break; } } } a++; } diff --git a/Tools/ArdupilotMegaPlanner/MAVLink.cs b/Tools/ArdupilotMegaPlanner/MAVLink.cs index bb707e072c..0256f119ea 100644 --- a/Tools/ArdupilotMegaPlanner/MAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/MAVLink.cs @@ -13,11 +13,13 @@ using System.Threading; using ArdupilotMega.Controls; using ArdupilotMega.Mavlink; using System.ComponentModel; +using log4net; namespace ArdupilotMega { public partial class MAVLink { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public ICommsSerial BaseStream = new SerialPort(); private const double CONNECT_TIMEOUT_SECONDS = 30; @@ -220,7 +222,7 @@ namespace ArdupilotMega // incase we are in setup mode BaseStream.WriteLine("planner\rgcs\r"); - Console.WriteLine(DateTime.Now.Millisecond + " start "); + log.Info(DateTime.Now.Millisecond + " start "); if (lastbad[0] == '!' && lastbad[1] == 'G' || lastbad[0] == 'G' && lastbad[1] == '!') // waiting for gps lock { @@ -255,7 +257,7 @@ namespace ArdupilotMega try { - Console.WriteLine("MAv Data: len " + buffer.Length + " btr " + BaseStream.BytesToRead); + log.Info("MAv Data: len " + buffer.Length + " btr " + BaseStream.BytesToRead); } catch { } @@ -271,7 +273,7 @@ namespace ArdupilotMega sysid = buffer[3]; compid = buffer[4]; recvpacketcount = buffer[2]; - Console.WriteLine("ID sys {0} comp {1} ver{2}", sysid, compid, mavlinkversion); + log.InfoFormat("ID sys {0} comp {1} ver{2}", sysid, compid, mavlinkversion); break; } @@ -311,7 +313,7 @@ namespace ArdupilotMega //frmProgressReporter.Close(); MainV2.givecomport = false; frmProgressReporter.UpdateProgressAndStatus(100, "Done."); - Console.WriteLine("Done open " + sysid + " " + compid); + log.Info("Done open " + sysid + " " + compid); packetslost = 0; } @@ -349,7 +351,7 @@ namespace ArdupilotMega } if (!run) { - Console.WriteLine("Mavlink : NOT VALID PACKET sendPacket() " + indata.GetType().ToString()); + log.Info("Mavlink : NOT VALID PACKET sendPacket() " + indata.GetType().ToString()); } } @@ -484,7 +486,7 @@ namespace ArdupilotMega { if (!param.ContainsKey(paramname)) { - Console.WriteLine("Param doesnt exist " + paramname); + log.Info("Param doesnt exist " + paramname); return false; } @@ -507,7 +509,7 @@ namespace ArdupilotMega generatePacket(MAVLINK_MSG_ID_PARAM_SET, req); - Console.WriteLine("setParam '{0}' = '{1}' sysid {2} compid {3}", paramname, req.param_value, sysid, compid); + log.InfoFormat("setParam '{0}' = '{1}' sysid {2} compid {3}", paramname, req.param_value, sysid, compid); DateTime start = DateTime.Now; int retrys = 3; @@ -518,7 +520,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("setParam Retry " + retrys); + log.Info("setParam Retry " + retrys); generatePacket(MAVLINK_MSG_ID_PARAM_SET, req); start = DateTime.Now; retrys--; @@ -546,7 +548,7 @@ namespace ArdupilotMega if (st != paramname) { - Console.WriteLine("MAVLINK bad param responce - {0} vs {1}", paramname, st); + log.InfoFormat("MAVLINK bad param responce - {0} vs {1}", paramname, st); continue; } @@ -635,7 +637,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("getParamList Retry {0} sys {1} comp {2}", retrys, sysid, compid); + log.InfoFormat("getParamList Retry {0} sys {1} comp {2}", retrys, sysid, compid); generatePacket(MAVLINK_MSG_ID_PARAM_REQUEST_LIST, req); start = DateTime.Now; retrys--; @@ -676,7 +678,7 @@ namespace ArdupilotMega continue; } - Console.WriteLine(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (param_total - 1) + " name: " + paramID); + log.Info(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (param_total - 1) + " name: " + paramID); modifyParamForDisplay(true, paramID, ref par.param_value); param[paramID] = (par.param_value); @@ -753,7 +755,7 @@ namespace ArdupilotMega generatePacket(MAVLINK_MSG_ID_REQUEST_DATA_STREAM, req); System.Threading.Thread.Sleep(20); generatePacket(MAVLINK_MSG_ID_REQUEST_DATA_STREAM, req); - Console.WriteLine("Stopall Done"); + log.Info("Stopall Done"); } catch { } @@ -801,7 +803,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("setWPCurrent Retry " + retrys); + log.Info("setWPCurrent Retry " + retrys); generatePacket(MAVLINK_MSG_ID_MISSION_SET_CURRENT, req); start = DateTime.Now; retrys--; @@ -864,7 +866,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("doAction Retry " + retrys); + log.Info("doAction Retry " + retrys); generatePacket(MAVLINK_MSG_ID_COMMAND_LONG, req); start = DateTime.Now; retrys--; @@ -918,7 +920,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("setWPCurrent Retry " + retrys); + log.Info("setWPCurrent Retry " + retrys); generatePacket(MAVLINK_MSG_ID_WAYPOINT_SET_CURRENT, req); start = DateTime.Now; retrys--; @@ -976,7 +978,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("doAction Retry " + retrys); + log.Info("doAction Retry " + retrys); generatePacket(MAVLINK_MSG_ID_ACTION, req); start = DateTime.Now; retrys--; @@ -1092,7 +1094,7 @@ namespace ArdupilotMega return; } - Console.WriteLine("Request stream {0} at {1} hz : currently {2}", Enum.Parse(typeof(MAV_DATA_STREAM), id.ToString()), hzrate, pps); + log.InfoFormat("Request stream {0} at {1} hz : currently {2}", Enum.Parse(typeof(MAV_DATA_STREAM), id.ToString()), hzrate, pps); getDatastream(id, hzrate); } @@ -1165,7 +1167,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport); + log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport); generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST_LIST, req); start = DateTime.Now; retrys--; @@ -1187,13 +1189,13 @@ namespace ArdupilotMega var count = buffer.ByteArrayToStructure<__mavlink_mission_count_t>(6); - Console.WriteLine("wpcount: " + count.count); + log.Info("wpcount: " + count.count); MainV2.givecomport = false; return (byte)count.count; // should be ushort, but apm has limited wp count < byte } else { - Console.WriteLine(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_MISSION_COUNT + " " + this.BaseStream.BytesToRead); + log.Info(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_MISSION_COUNT + " " + this.BaseStream.BytesToRead); } } } @@ -1216,7 +1218,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport); + log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport); generatePacket(MAVLINK_MSG_ID_WAYPOINT_REQUEST_LIST, req); start = DateTime.Now; retrys--; @@ -1233,13 +1235,13 @@ namespace ArdupilotMega if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_COUNT) { - Console.WriteLine("wpcount: " + buffer[9]); + log.Info("wpcount: " + buffer[9]); MainV2.givecomport = false; return buffer[9]; // should be ushort, but apm has limited wp count < byte } else { - Console.WriteLine(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_WAYPOINT_COUNT + " " + this.BaseStream.BytesToRead); + log.Info(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_WAYPOINT_COUNT + " " + this.BaseStream.BytesToRead); } } } @@ -1277,7 +1279,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("getWP Retry " + retrys); + log.Info("getWP Retry " + retrys); generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST, req); start = DateTime.Now; retrys--; @@ -1324,7 +1326,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("getWP Retry " + retrys); + log.Info("getWP Retry " + retrys); generatePacket(MAVLINK_MSG_ID_WAYPOINT_REQUEST, req); start = DateTime.Now; retrys--; @@ -1419,13 +1421,13 @@ namespace ArdupilotMega } } */ - Console.WriteLine("getWP {0} {1} {2} {3} {4} opt {5}", loc.id, loc.p1, loc.alt, loc.lat, loc.lng, loc.options); + log.InfoFormat("getWP {0} {1} {2} {3} {4} opt {5}", loc.id, loc.p1, loc.alt, loc.lat, loc.lng, loc.options); break; } else { - Console.WriteLine(DateTime.Now + " PC getwp " + buffer[5]); + log.Info(DateTime.Now + " PC getwp " + buffer[5]); } } } @@ -1529,7 +1531,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("setWPTotal Retry " + retrys); + log.Info("setWPTotal Retry " + retrys); generatePacket(MAVLINK_MSG_ID_MISSION_COUNT, req); start = DateTime.Now; retrys--; @@ -1584,7 +1586,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("setWPTotal Retry " + retrys); + log.Info("setWPTotal Retry " + retrys); generatePacket(MAVLINK_MSG_ID_WAYPOINT_COUNT, req); start = DateTime.Now; retrys--; @@ -1707,7 +1709,7 @@ namespace ArdupilotMega */ req.seq = index; - Console.WriteLine("setWP {6} frame {0} cmd {1} p1 {2} x {3} y {4} z {5}", req.frame, req.command, req.param1, req.x, req.y, req.z, index); + log.InfoFormat("setWP {6} frame {0} cmd {1} p1 {2} x {3} y {4} z {5}", req.frame, req.command, req.param1, req.x, req.y, req.z, index); // request #if MAVLINK10 @@ -1725,7 +1727,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("setWP Retry " + retrys); + log.Info("setWP Retry " + retrys); #if MAVLINK10 generatePacket(MAVLINK_MSG_ID_MISSION_ITEM, req); #else @@ -1749,7 +1751,7 @@ namespace ArdupilotMega var ans = buffer.ByteArrayToStructure<__mavlink_mission_ack_t>(6); - Console.WriteLine("set wp " + index + " ACK 47 : " + buffer[5] + " ans " + Enum.Parse(typeof(MAV_MISSION_RESULT), ans.type.ToString())); + log.Info("set wp " + index + " ACK 47 : " + buffer[5] + " ans " + Enum.Parse(typeof(MAV_MISSION_RESULT), ans.type.ToString())); break; } else if (buffer[5] == MAVLINK_MSG_ID_MISSION_REQUEST) @@ -1761,13 +1763,13 @@ namespace ArdupilotMega if (ans.seq == (index + 1)) { - Console.WriteLine("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]); + log.Info("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]); MainV2.givecomport = false; break; } else { - Console.WriteLine("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component); + log.Info("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component); //break; } } @@ -1778,7 +1780,7 @@ namespace ArdupilotMega #else if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_ACK) { //__mavlink_waypoint_request_t - Console.WriteLine("set wp " + index + " ACK 47 : " + buffer[5]); + log.Info("set wp " + index + " ACK 47 : " + buffer[5]); break; } else if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_REQUEST) @@ -1787,13 +1789,13 @@ namespace ArdupilotMega if (ans.seq == (index + 1)) { - Console.WriteLine("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]); + log.Info("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]); MainV2.givecomport = false; break; } else { - Console.WriteLine("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component); + log.InfoFormat("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component); //break; } } @@ -1914,7 +1916,7 @@ namespace ArdupilotMega { if (readcount > 300) { - Console.WriteLine("MAVLink readpacket No valid mavlink packets"); + log.Info("MAVLink readpacket No valid mavlink packets"); break; } readcount++; @@ -1949,27 +1951,22 @@ namespace ArdupilotMega { MainV2.cs.datetime = DateTime.Now; - int to = 0; + DateTime to = DateTime.Now.AddMilliseconds(BaseStream.ReadTimeout); while (BaseStream.BytesToRead <= 0) { - if (to > BaseStream.ReadTimeout) + if (DateTime.Now > to) { - Console.WriteLine("MAVLINK: wait time out btr {0} len {1}", BaseStream.BytesToRead, length); + log.InfoFormat("MAVLINK: S wait time out btr {0} len {1}", BaseStream.BytesToRead, length); throw new Exception("Timeout"); } System.Threading.Thread.Sleep(1); -// if (!MainV2.instance.InvokeRequired) -// { -// System.Windows.Forms.Application.DoEvents(); // when connecting this is in the main thread -// } - to++; } if (BaseStream.IsOpen) temp[count] = (byte)BaseStream.ReadByte(); } } - catch (Exception e) { Console.WriteLine("MAVLink readpacket read error: " + e.Message); break; } + catch (Exception e) { log.Info("MAVLink readpacket read error: " + e.Message); break; } if (temp[0] != 254 && temp[0] != 'U' || lastbad[0] == 'I' && lastbad[1] == 'M' || lastbad[1] == 'G' || lastbad[1] == 'A') // out of sync "AUTO" "GUIDED" "IMU" { @@ -1996,7 +1993,7 @@ namespace ArdupilotMega { if (sysid != temp[3] || compid != temp[4]) { - Console.WriteLine("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", temp[3], temp[4], sysid, compid); + log.InfoFormat("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", temp[3], temp[4], sysid, compid); return new byte[0]; } } @@ -2009,21 +2006,15 @@ namespace ArdupilotMega } else { - int to = 0; + DateTime to = DateTime.Now.AddMilliseconds(BaseStream.ReadTimeout); + while (BaseStream.BytesToRead < (length - 4)) { - if (to > 1000) + if (DateTime.Now > to) { - Console.WriteLine("MAVLINK: wait time out btr {0} len {1}", BaseStream.BytesToRead, length); + log.InfoFormat("MAVLINK: L wait time out btr {0} len {1}", BaseStream.BytesToRead, length); break; } - System.Threading.Thread.Sleep(1); - if (!MainV2.instance.InvokeRequired) - { - System.Windows.Forms.Application.DoEvents(); // when connecting this is in the main thread - } - to++; - //Console.WriteLine("data " + 0 + " " + length + " aval " + BaseStream.BytesToRead); } if (BaseStream.IsOpen) @@ -2083,7 +2074,7 @@ namespace ArdupilotMega if (temp.Length > 5 && temp[1] != MAVLINK_MESSAGE_LENGTHS[temp[5]]) { - Console.WriteLine("Mavlink Bad Packet (Len Fail) len {0} pkno {1}", temp.Length, temp[5]); + 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"); @@ -2098,7 +2089,7 @@ namespace ArdupilotMega { packetno = temp[5]; } - Console.WriteLine("Mavlink Bad Packet (crc fail) len {0} crc {1} pkno {2}", temp.Length, crc, packetno); + log.InfoFormat("Mavlink Bad Packet (crc fail) len {0} crc {1} pkno {2}", temp.Length, crc, packetno); return new byte[0]; } @@ -2120,7 +2111,7 @@ namespace ArdupilotMega packetslost += temp[2] - recvpacketcount; } - Console.WriteLine("lost {0} pkts {1}", temp[2], (int)packetslost); + log.InfoFormat("lost {0} pkts {1}", temp[2], (int)packetslost); } packetsnotlost++; @@ -2155,7 +2146,7 @@ namespace ArdupilotMega int ind = logdata.IndexOf('\0'); if (ind != -1) logdata = logdata.Substring(0, ind); - Console.WriteLine(DateTime.Now + " " + logdata); + log.Info(DateTime.Now + " " + logdata); if (MainV2.talk != null && MainV2.config["speechenable"] != null && MainV2.config["speechenable"].ToString() == "True") { @@ -2250,7 +2241,7 @@ namespace ArdupilotMega { if (retrys > 0) { - Console.WriteLine("getFencePoint Retry " + retrys + " - giv com " + MainV2.givecomport); + log.Info("getFencePoint Retry " + retrys + " - giv com " + MainV2.givecomport); generatePacket(MAVLINK_MSG_ID_FENCE_FETCH_POINT, req); start = DateTime.Now; retrys--; @@ -2386,7 +2377,7 @@ namespace ArdupilotMega temp[a] = (byte)logplaybackfile.ReadByte(); if (temp[0] != 'U' && temp[0] != 254) { - Console.WriteLine("lost sync byte {0} pos {1}", temp[0], logplaybackfile.BaseStream.Position); + log.InfoFormat("lost sync byte {0} pos {1}", temp[0], logplaybackfile.BaseStream.Position); a = 0; continue; } diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs index 7d23d49e9c..bbd83439a3 100644 --- a/Tools/ArdupilotMegaPlanner/MainV2.cs +++ b/Tools/ArdupilotMegaPlanner/MainV2.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Configuration; using System.Data; using System.Drawing; using System.Linq; @@ -20,11 +21,14 @@ using System.Globalization; using System.Threading; using System.Net.Sockets; using IronPython.Hosting; +using log4net; namespace ArdupilotMega { public partial class MainV2 : Form { + private static readonly ILog log = + LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); [DllImport("user32.dll")] public static extern int FindWindow(string szClass, string szTitle); [DllImport("user32.dll")] @@ -250,7 +254,7 @@ namespace ArdupilotMega string[] devs = new string[0]; - Console.WriteLine("Get Comports"); + log.Debug("Geting Comports"); if (MONO) { @@ -775,7 +779,7 @@ namespace ArdupilotMega if ((buffer[0] == 'A' || buffer[0] == 'P') && (buffer[1] == 'A' || buffer[1] == 'P')) // this is the apvar header { - Console.WriteLine("Valid eeprom contents"); + log.Info("Valid eeprom contents"); } else { @@ -961,11 +965,11 @@ namespace ArdupilotMega break; } } - catch (Exception ee) { Console.WriteLine(ee.Message); } // silent fail on bad entry + catch (Exception ee) { log.Info(ee.Message); } // silent fail on bad entry } } } - catch (Exception ex) { Console.WriteLine("Bad Config File: " + ex.ToString()); } // bad config file + catch (Exception ex) { log.Info("Bad Config File: " + ex.ToString()); } // bad config file } } @@ -1179,7 +1183,7 @@ namespace ArdupilotMega } catch (Exception e) { - Console.WriteLine("Serial Reader fail :" + e.Message); + log.Info("Serial Reader fail :" + e.Message); try { comPort.Close(); @@ -1247,7 +1251,7 @@ namespace ArdupilotMega try { listener = new TcpListener(IPAddress.Any, 56781); - System.Threading.Thread t13 = new System.Threading.Thread(new System.Threading.ThreadStart(listernforclients)) + var t13 = new Thread(listernforclients) { Name = "motion jpg stream", IsBackground = true @@ -1257,10 +1261,11 @@ namespace ArdupilotMega } catch (Exception ex) { + log.Error("Error starting TCP listener thread: ", ex); MessageBox.Show(ex.ToString()); } - System.Threading.Thread t12 = new System.Threading.Thread(new ThreadStart(joysticksend)) + var t12 = new Thread(new ThreadStart(joysticksend)) { IsBackground = true, Priority = ThreadPriority.AboveNormal, @@ -1268,18 +1273,28 @@ namespace ArdupilotMega }; t12.Start(); - System.Threading.Thread t11 = new System.Threading.Thread(new ThreadStart(SerialReader)) + var t11 = new Thread(SerialReader) { IsBackground = true, Name = "Main Serial reader" }; t11.Start(); + if (Debugger.IsAttached) + { + log.Info("Skipping update test as it appears we are debugging"); + } + else + { try { - checkForUpdate(); + CheckForUpdate(); + } + catch (Exception ex) + { + log.Error("Update check failed", ex); + } } - catch { Console.WriteLine("update check failed"); } } public static String ComputeWebSocketHandshakeSecurityHash09(String secWebSocketKey) @@ -1310,7 +1325,7 @@ namespace ArdupilotMega { listener.Start(); } - catch { Console.WriteLine("do you have the planner open already"); return; } // in use + catch { log.Info("do you have the planner open already"); return; } // in use // Enter the listening loop. while (true) { @@ -1318,10 +1333,10 @@ namespace ArdupilotMega // You could also user server.AcceptSocket() here. try { - Console.WriteLine("Listening for client - 1 client at a time"); + log.Info("Listening for client - 1 client at a time"); TcpClient client = listener.AcceptTcpClient(); // Get a stream object for reading and writing - Console.WriteLine("Accepted Client " + client.Client.RemoteEndPoint.ToString()); + log.Info("Accepted Client " + client.Client.RemoteEndPoint.ToString()); //client.SendBufferSize = 100 * 1024; // 100kb //client.LingerState.Enabled = true; //client.NoDelay = true; @@ -1344,7 +1359,7 @@ namespace ArdupilotMega int len = stream.Read(request, 0, request.Length); string head = System.Text.ASCIIEncoding.ASCII.GetString(request, 0, len); - Console.WriteLine(head); + log.Info(head); int index = head.IndexOf('\n'); @@ -1380,7 +1395,7 @@ namespace ArdupilotMega while (client.Connected) { System.Threading.Thread.Sleep(200); - Console.WriteLine(stream.DataAvailable + " " + client.Available); + log.Info(stream.DataAvailable + " " + client.Available); while (client.Available > 0) { @@ -1563,7 +1578,7 @@ namespace ArdupilotMega } stream.Close(); } - catch (Exception ee) { Console.WriteLine("Failed mjpg " + ee.Message); } + catch (Exception ee) { log.Info("Failed mjpg " + ee.Message); } } } @@ -1575,8 +1590,8 @@ namespace ArdupilotMega private void MainV2_Resize(object sender, EventArgs e) { - Console.WriteLine("myview width " + MyView.Width + " height " + MyView.Height); - Console.WriteLine("this width " + this.Width + " height " + this.Height); + log.Info("myview width " + MyView.Width + " height " + MyView.Height); + log.Info("this width " + this.Width + " height " + this.Height); } private void MenuHelp_Click(object sender, EventArgs e) @@ -1598,49 +1613,58 @@ namespace ArdupilotMega temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28); } - static string baseurl = "http://ardupilot-mega.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/"; public static void updatecheck(Label loadinglabel) { + var baseurl = ConfigurationManager.AppSettings["UpdateLocation"]; try { bool update = updatecheck(loadinglabel, baseurl, ""); - System.Diagnostics.Process P = new System.Diagnostics.Process(); + var process = new Process(); + string exePath = Path.GetDirectoryName(Application.ExecutablePath); if (MONO) { - P.StartInfo.FileName = "mono"; - P.StartInfo.Arguments = " \"" + Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "Updater.exe\""; + process.StartInfo.FileName = "mono"; + process.StartInfo.Arguments = " \"" + exePath + Path.DirectorySeparatorChar + "Updater.exe\""; } else { - P.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "Updater.exe"; - P.StartInfo.Arguments = ""; + process.StartInfo.FileName = exePath + Path.DirectorySeparatorChar + "Updater.exe"; + process.StartInfo.Arguments = ""; try { - foreach (string newupdater in Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "Updater.exe*.new")) + foreach (string newupdater in Directory.GetFiles(exePath, "Updater.exe*.new")) { File.Copy(newupdater, newupdater.Remove(newupdater.Length - 4), true); File.Delete(newupdater); } } - catch (Exception) + catch (Exception ex) { + log.Error("Exception during update", ex); } } if (loadinglabel != null) - updatelabel(loadinglabel,"Starting Updater"); - Console.WriteLine("Start " + P.StartInfo.FileName + " with " + P.StartInfo.Arguments); - P.Start(); + UpdateLabel(loadinglabel,"Starting Updater"); + log.Info("Starting new process: " + process.StartInfo.FileName + " with " + process.StartInfo.Arguments); + process.Start(); + log.Info("Quitting existing process"); try { Application.Exit(); } - catch { } + catch + { + } + } + catch (Exception ex) + { + log.Error("Update Failed", ex); + MessageBox.Show("Update Failed " + ex.Message); } - catch (Exception ex) { MessageBox.Show("Update Failed " + ex.Message); } } - private static void updatelabel(Label loadinglabel, string text) + private static void UpdateLabel(Label loadinglabel, string text) { MainV2.instance.Invoke((MethodInvoker)delegate { @@ -1650,59 +1674,64 @@ namespace ArdupilotMega }); } - private static void checkForUpdate() + private static void CheckForUpdate() { + var baseurl = ConfigurationManager.AppSettings["UpdateLocation"]; string path = Path.GetFileNameWithoutExtension(Application.ExecutablePath) + ".exe"; // Create a request using a URL that can receive a post. - WebRequest request = WebRequest.Create(baseurl + path); - request.Timeout = 5000; - Console.Write(baseurl + path + " "); - // Set the Method property of the request to POST. - request.Method = "HEAD"; + string requestUriString = baseurl + path; + log.Debug("Checking for update at: " + requestUriString); + var webRequest = WebRequest.Create(requestUriString); + webRequest.Timeout = 5000; - ((HttpWebRequest)request).IfModifiedSince = File.GetLastWriteTimeUtc(path); + // Set the Method property of the request to POST. + webRequest.Method = "HEAD"; + + ((HttpWebRequest)webRequest).IfModifiedSince = File.GetLastWriteTimeUtc(path); // Get the response. - WebResponse response = request.GetResponse(); + var response = webRequest.GetResponse(); // Display the status. - Console.WriteLine(((HttpWebResponse)response).StatusDescription); + log.Debug("Response status: " + ((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. //dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. - bool getfile = false; + bool shouldGetFile = false; if (File.Exists(path)) { - FileInfo fi = new FileInfo(path); + var fi = new FileInfo(path); - Console.WriteLine(response.Headers[HttpResponseHeader.ETag]); + log.Info(response.Headers[HttpResponseHeader.ETag]); if (fi.Length != response.ContentLength) // && response.Headers[HttpResponseHeader.ETag] != "0") { - StreamWriter sw = new StreamWriter(path + ".etag"); + using (var sw = new StreamWriter(path + ".etag")) + { sw.WriteLine(response.Headers[HttpResponseHeader.ETag]); sw.Close(); - getfile = true; - Console.WriteLine("NEW FILE " + path); + } + shouldGetFile = true; + log.Info("Newer file found: " + path); } } else { - getfile = true; - Console.WriteLine("NEW FILE " + path); + shouldGetFile = true; + log.Info("Newer file found: " + path); // get it } response.Close(); - if (getfile) + if (shouldGetFile) { - DialogResult dr = MessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo); + var dr = MessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { - doupdate(); + DoUpdate(); } else { @@ -1711,32 +1740,41 @@ namespace ArdupilotMega } } - public static void doupdate() + public static void DoUpdate() { - //System.Threading.Thread t12 = new System.Threading.Thread(delegate() + var loading = new Form { - Form loading = new Form(); - loading.Width = 400; - loading.Height = 150; - loading.StartPosition = FormStartPosition.CenterScreen; - loading.TopMost = true; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainV2)); - loading.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + Width = 400, + Height = 150, + StartPosition = FormStartPosition.CenterScreen, + TopMost = true, + MinimizeBox = false, + MaximizeBox = false + }; + var resources = new ComponentResourceManager(typeof(MainV2)); + loading.Icon = ((Icon)(resources.GetObject("$this.Icon"))); - Label loadinglabel = new Label(); - loadinglabel.Location = new System.Drawing.Point(50, 40); - loadinglabel.Name = "load"; - loadinglabel.AutoSize = true; - loadinglabel.Text = "Checking..."; - loadinglabel.Size = new System.Drawing.Size(100, 20); + var loadinglabel = new Label + { + Location = new System.Drawing.Point(50, 40), + Name = "load", + AutoSize = true, + Text = "Checking...", + Size = new System.Drawing.Size(100, 20) + }; loading.Controls.Add(loadinglabel); loading.Show(); - try { MainV2.updatecheck(loadinglabel); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } - + try + { + MainV2.updatecheck(loadinglabel); } + catch (Exception ex) + { + log.Error("Error in updatecheck", ex); + } //); //t12.Name = "Update check thread"; //t12.Start(); @@ -1749,7 +1787,7 @@ namespace ArdupilotMega List files = new List(); // Create a request using a URL that can receive a post. - Console.WriteLine(baseurl); + log.Info(baseurl); WebRequest request = WebRequest.Create(baseurl); request.Timeout = 10000; // Set the Method property of the request to POST. @@ -1759,7 +1797,7 @@ namespace ArdupilotMega // Get the response. WebResponse response = request.GetResponse(); // Display the status. - Console.WriteLine(((HttpWebResponse)response).StatusDescription); + log.Info(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. @@ -1802,7 +1840,7 @@ namespace ArdupilotMega continue; } if (loadinglabel != null) - updatelabel(loadinglabel, "Checking " + file); + UpdateLabel(loadinglabel, "Checking " + file); string path = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + subdir + file; @@ -1818,7 +1856,7 @@ namespace ArdupilotMega // Get the response. response = request.GetResponse(); // Display the status. - Console.WriteLine(((HttpWebResponse)response).StatusDescription); + log.Info(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. //dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. @@ -1829,7 +1867,7 @@ namespace ArdupilotMega { FileInfo fi = new FileInfo(path); - Console.WriteLine(response.Headers[HttpResponseHeader.ETag]); + log.Info(response.Headers[HttpResponseHeader.ETag]); if (fi.Length != response.ContentLength) // && response.Headers[HttpResponseHeader.ETag] != "0") { @@ -1837,13 +1875,13 @@ namespace ArdupilotMega sw.WriteLine(response.Headers[HttpResponseHeader.ETag]); sw.Close(); getfile = true; - Console.WriteLine("NEW FILE " + file); + log.Info("NEW FILE " + file); } } else { getfile = true; - Console.WriteLine("NEW FILE " + file); + log.Info("NEW FILE " + file); // get it } @@ -1866,7 +1904,7 @@ namespace ArdupilotMega } } if (loadinglabel != null) - updatelabel(loadinglabel, "Getting " + file); + UpdateLabel(loadinglabel, "Getting " + file); // from head long bytes = response.ContentLength; @@ -1878,7 +1916,7 @@ namespace ArdupilotMega // Get the response. response = request.GetResponse(); // Display the status. - Console.WriteLine(((HttpWebResponse)response).StatusDescription); + log.Info(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. dataStream = response.GetResponseStream(); @@ -1899,12 +1937,12 @@ namespace ArdupilotMega if (dt.Second != DateTime.Now.Second) { if (loadinglabel != null) - updatelabel(loadinglabel, "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes"); + UpdateLabel(loadinglabel, "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes"); dt = DateTime.Now; } } catch { } - Console.WriteLine(file + " " + bytes); + log.Info(file + " " + bytes); int len = dataStream.Read(buf1, 0, 1024); if (len == 0) break; diff --git a/Tools/ArdupilotMegaPlanner/Mavlink/MavlinkUtil.cs b/Tools/ArdupilotMegaPlanner/Mavlink/MavlinkUtil.cs index 0be0d7c635..6d52ec3f3e 100644 --- a/Tools/ArdupilotMegaPlanner/Mavlink/MavlinkUtil.cs +++ b/Tools/ArdupilotMegaPlanner/Mavlink/MavlinkUtil.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; +using log4net; namespace ArdupilotMega.Mavlink { @@ -11,6 +12,8 @@ namespace ArdupilotMega.Mavlink /// public static class MavlinkUtil { + private static readonly ILog log = + LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); /// /// Create a new mavlink packet object from a byte array as recieved over mavlink /// Endianess will be detetected using packet inspection @@ -55,7 +58,7 @@ namespace ArdupilotMega.Mavlink } catch (Exception ex) { - Console.WriteLine("ByteArrayToStructure FAIL: error " + ex); + log.Error("ByteArrayToStructure FAIL", ex); } obj = Marshal.PtrToStructure(i, obj.GetType()); @@ -105,7 +108,10 @@ namespace ArdupilotMega.Mavlink // copy byte array to ptr Marshal.Copy(temparray, startoffset, i, len); } - catch (Exception ex) { Console.WriteLine("ByteArrayToStructure FAIL: error " + ex.ToString()); } + catch (Exception ex) + { + log.Error("ByteArrayToStructure FAIL", ex); + } obj = Marshal.PtrToStructure(i, obj.GetType()); diff --git a/Tools/ArdupilotMegaPlanner/Program.cs b/Tools/ArdupilotMegaPlanner/Program.cs index 334e01a41f..a5e6e44931 100644 --- a/Tools/ArdupilotMegaPlanner/Program.cs +++ b/Tools/ArdupilotMegaPlanner/Program.cs @@ -5,12 +5,15 @@ using System.Net; using System.IO; using System.Text; using System.Threading; +using log4net; +using log4net.Config; namespace ArdupilotMega { static class Program { + private static readonly ILog log = LogManager.GetLogger("Program"); /// /// The main entry point for the application. @@ -21,23 +24,29 @@ namespace ArdupilotMega //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); - Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); + Application.ThreadException += Application_ThreadException; - Application.Idle += new EventHandler(Application_Idle); + Application.Idle += Application_Idle; //MessageBox.Show("NOTE: This version may break advanced mission scripting"); //Common.linearRegression(); Application.EnableVisualStyles(); + XmlConfigurator.Configure(); + log.Info("******************* Logging Configured *******************"); Application.SetCompatibleTextRenderingDefault(false); try { - System.Threading.Thread.CurrentThread.Name = "Base Thread"; + Thread.CurrentThread.Name = "Base Thread"; Application.Run(new MainV2()); } - catch (Exception ex) { Console.WriteLine(ex.ToString()); } + catch (Exception ex) + { + log.Fatal("Fatal app exception",ex); + Console.WriteLine(ex.ToString()); + } } static void Application_Idle(object sender, EventArgs e) @@ -111,7 +120,10 @@ namespace ArdupilotMega dataStream.Close(); response.Close(); } - catch { MessageBox.Show("Error sending Error report!! Youre most likerly are not on the internet"); } + catch + { + MessageBox.Show("Error sending Error report!! Youre most likerly are not on the internet"); + } } } } diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index 8d587ae932..30ef544ee3 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.0.0.0")] -[assembly: AssemblyFileVersion("1.1.42")] +[assembly: AssemblyFileVersion("1.1.43")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Properties/Resources.Designer.cs b/Tools/ArdupilotMegaPlanner/Properties/Resources.Designer.cs index d218a1ae09..3b135b9e1e 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/Resources.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Properties/Resources.Designer.cs @@ -228,6 +228,21 @@ namespace ArdupilotMega.Properties { } } + /// + /// Looks up a localized string similar to == MAVLink Parameters == (this is a copy fo the wiki page FYI) + /// + ///This is a list of all the user-modifiable MAVLink parameters and what they do. You can modify them via the MAVLink parameters window in any compatible GCS, such as the Mission Planner, HK GCS or !QGroundControl. + /// + ///It includes both fixed wing (APM) and rotary wing (!ArduCopter) parameters. Some may only be relevant for one platform or another. + /// + ///|| *EEPROM variable name* || *Min* || *Max* || *Default* || *Multiplier* || *Enabled (0 = no, 1 = yes)* [rest of string was truncated]";. + /// + public static string MAVParam { + get { + return ResourceManager.GetString("MAVParam", resourceCulture); + } + } + public static System.Drawing.Bitmap octo { get { object obj = ResourceManager.GetObject("octo", resourceCulture); diff --git a/Tools/ArdupilotMegaPlanner/Properties/Resources.resx b/Tools/ArdupilotMegaPlanner/Properties/Resources.resx index bfe114553b..8601c8c688 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/Resources.resx +++ b/Tools/ArdupilotMegaPlanner/Properties/Resources.resx @@ -1222,8 +1222,11 @@ ..\Resources\iconWarning48.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\y6.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\MAVParam.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs index 2148da0e73..b0bb0a8a93 100644 --- a/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs +++ b/Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs @@ -49,8 +49,6 @@ namespace ArdupilotMega { ArduinoSTK comPort = new ArduinoSTK(); - string version = ""; - uploader.Uploader uploader = new uploader.Uploader(); try @@ -186,244 +184,9 @@ namespace ArdupilotMega catch { } } - private void BUT_getcurrent_Click(object sender, EventArgs e) - { - SerialPort comPort = new SerialPort(); - - try { - - comPort.PortName = MainV2.comPort.BaseStream.PortName; - comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate; - - comPort.ReadTimeout = 4000; - - comPort.Open(); - - - } - catch { MessageBox.Show("Invalid ComPort or in use"); return; } - - lbl_status.Text = "Connecting"; - - if (doConnect(comPort)) - { - comPort.DiscardInBuffer(); - - lbl_status.Text = "Doing Command ATI & RTI"; - - ATI.Text = doCommand(comPort, "ATI1").Trim(); - - RTI.Text = doCommand(comPort, "RTI1").Trim(); - - RSSI.Text = doCommand(comPort, "ATI7").Trim(); - - lbl_status.Text = "Doing Command ATI5"; - - string answer = doCommand(comPort, "ATI5"); - - string[] items = answer.Split('\n'); - - foreach (string item in items) - { - if (item.StartsWith("S")) - { - string[] values = item.Split(':', '='); - - if (values.Length == 3) - { - Control[] controls = this.Controls.Find(values[0].Trim(), false); - - if (controls.Length > 0) - { - if (controls[0].GetType() == typeof(CheckBox)) - { - ((CheckBox)controls[0]).Checked = values[2].Trim() == "1"; - } - else - { - controls[0].Text = values[2].Trim(); - } - } - } - } - } - - // remote - foreach (Control ctl in this.Controls) - { - if (ctl.Name.StartsWith("RS") && ctl.Name != "RSSI") - ctl.ResetText(); - } - - - comPort.DiscardInBuffer(); - - lbl_status.Text = "Doing Command RTI5"; - - answer = doCommand(comPort, "RTI5"); - - items = answer.Split('\n'); - - foreach (string item in items) - { - if (item.StartsWith("S")) - { - string[] values = item.Split(':', '='); - - if (values.Length == 3) - { - Control[] controls = this.Controls.Find("R" + values[0].Trim(), false); - - if (controls[0].GetType() == typeof(CheckBox)) - { - ((CheckBox)controls[0]).Checked = values[2].Trim() == "1"; - } - else if (controls[0].GetType() == typeof(TextBox)) - { - ((TextBox)controls[0]).Text = values[2].Trim(); - } - else if (controls[0].GetType() == typeof(ComboBox)) - { - ((ComboBox)controls[0]).SelectedText = values[2].Trim(); - } - } - else - { - Console.WriteLine("Odd config line :" + item); - } - } - } - - // off hook - doCommand(comPort, "ATO"); - - lbl_status.Text = "Done"; - } - else - { - - // off hook - doCommand(comPort, "ATO"); - - lbl_status.Text = "Fail"; - MessageBox.Show("Failed to enter command mode"); - } - - comPort.Close(); - } - - string Serial_ReadLine(SerialPort comPort) - { - StringBuilder sb = new StringBuilder(); - DateTime Deadline = DateTime.Now.AddMilliseconds(comPort.ReadTimeout); - - while (DateTime.Now < Deadline) - { - if (comPort.BytesToRead > 0) - { - byte data = (byte)comPort.ReadByte(); - sb.Append((char)data); - if (data == '\n') - break; - } - } - - return sb.ToString(); - } - - string doCommand(SerialPort comPort, string cmd, int level = 0) - { - if (!comPort.IsOpen) - return ""; - - comPort.ReadTimeout = 1000; - // setup to known state - comPort.Write("\r\n"); - // alow some time to gather thoughts - Sleep(100); - // ignore all existing data - comPort.DiscardInBuffer(); - lbl_status.Text = "Doing Command "+cmd; - Console.WriteLine("Doing Command "+cmd); - // write command - comPort.Write(cmd + "\r\n"); - // read echoed line or existing data - string temp; - try - { - temp = Serial_ReadLine(comPort); - } - catch { temp = comPort.ReadExisting(); } - Console.WriteLine("cmd "+cmd + " echo "+ temp); - // delay for command - Sleep(500); - // get responce - string ans = ""; - while (comPort.BytesToRead > 0) - { - try - { - ans = ans + Serial_ReadLine(comPort) +"\n"; - } - catch { ans = ans + comPort.ReadExisting() + "\n"; } - Sleep(50); - - if (ans.Length > 500) - { - break; - } - } - - Console.WriteLine("responce " +level+ " " + ans); - - // try again - if (ans == "" && level == 0) - return doCommand(comPort, cmd, 1); - - return ans; - } - - bool doConnect(SerialPort comPort) - { - // clear buffer - comPort.DiscardInBuffer(); - // setup a known enviroment - comPort.Write("\r\n"); - // wait - Sleep(1100); - // send config string - comPort.Write("+++"); - // wait - Sleep(1100); - // check for config responce "OK" - Console.WriteLine("Connect btr " + comPort.BytesToRead + " baud " + comPort.BaudRate); - string conn = comPort.ReadExisting(); - Console.WriteLine("Connect first responce "+conn + " " + conn.Length); - if (conn.Contains("OK")) - { - //return true; - } - else - { - // cleanup incase we are already in cmd mode - comPort.Write("\r\n"); - } - - string version = doCommand(comPort, "ATI"); - - Console.Write("Connect Version: " + version.Trim() + "\n"); - - if (version.Contains("on HM-TRP")) - { - return true; - } - - return false; - } - private void BUT_savesettings_Click(object sender, EventArgs e) { - SerialPort comPort = new SerialPort(); + ArdupilotMega.ICommsSerial comPort = new SerialPort(); try { comPort.PortName = MainV2.comPort.BaseStream.PortName; @@ -595,6 +358,242 @@ namespace ArdupilotMega comPort.Close(); } + + private void BUT_getcurrent_Click(object sender, EventArgs e) + { + ArdupilotMega.ICommsSerial comPort = new SerialPort(); + + try + { + comPort.PortName = MainV2.comPort.BaseStream.PortName; + comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate; + + comPort.ReadTimeout = 4000; + + comPort.Open(); + + + } + catch { MessageBox.Show("Invalid ComPort or in use"); return; } + + lbl_status.Text = "Connecting"; + + if (doConnect(comPort)) + { + comPort.DiscardInBuffer(); + + lbl_status.Text = "Doing Command ATI & RTI"; + + ATI.Text = doCommand(comPort, "ATI1").Trim(); + + RTI.Text = doCommand(comPort, "RTI1").Trim(); + + RSSI.Text = doCommand(comPort, "ATI7").Trim(); + + lbl_status.Text = "Doing Command ATI5"; + + string answer = doCommand(comPort, "ATI5"); + + string[] items = answer.Split('\n'); + + foreach (string item in items) + { + if (item.StartsWith("S")) + { + string[] values = item.Split(':', '='); + + if (values.Length == 3) + { + Control[] controls = this.Controls.Find(values[0].Trim(), false); + + if (controls.Length > 0) + { + if (controls[0].GetType() == typeof(CheckBox)) + { + ((CheckBox)controls[0]).Checked = values[2].Trim() == "1"; + } + else + { + controls[0].Text = values[2].Trim(); + } + } + } + } + } + + // remote + foreach (Control ctl in this.Controls) + { + if (ctl.Name.StartsWith("RS") && ctl.Name != "RSSI") + ctl.ResetText(); + } + + + comPort.DiscardInBuffer(); + + lbl_status.Text = "Doing Command RTI5"; + + answer = doCommand(comPort, "RTI5"); + + items = answer.Split('\n'); + + foreach (string item in items) + { + if (item.StartsWith("S")) + { + string[] values = item.Split(':', '='); + + if (values.Length == 3) + { + Control[] controls = this.Controls.Find("R" + values[0].Trim(), false); + + if (controls[0].GetType() == typeof(CheckBox)) + { + ((CheckBox)controls[0]).Checked = values[2].Trim() == "1"; + } + else if (controls[0].GetType() == typeof(TextBox)) + { + ((TextBox)controls[0]).Text = values[2].Trim(); + } + else if (controls[0].GetType() == typeof(ComboBox)) + { + ((ComboBox)controls[0]).SelectedText = values[2].Trim(); + } + } + else + { + Console.WriteLine("Odd config line :" + item); + } + } + } + + // off hook + doCommand(comPort, "ATO"); + + lbl_status.Text = "Done"; + } + else + { + + // off hook + doCommand(comPort, "ATO"); + + lbl_status.Text = "Fail"; + MessageBox.Show("Failed to enter command mode"); + } + + comPort.Close(); + } + + string Serial_ReadLine(ArdupilotMega.ICommsSerial comPort) + { + StringBuilder sb = new StringBuilder(); + DateTime Deadline = DateTime.Now.AddMilliseconds(comPort.ReadTimeout); + + while (DateTime.Now < Deadline) + { + if (comPort.BytesToRead > 0) + { + byte data = (byte)comPort.ReadByte(); + sb.Append((char)data); + if (data == '\n') + break; + } + } + + return sb.ToString(); + } + + string doCommand(ArdupilotMega.ICommsSerial comPort, string cmd, int level = 0) + { + if (!comPort.IsOpen) + return ""; + + comPort.ReadTimeout = 1000; + // setup to known state + comPort.Write("\r\n"); + // alow some time to gather thoughts + Sleep(100); + // ignore all existing data + comPort.DiscardInBuffer(); + lbl_status.Text = "Doing Command " + cmd; + Console.WriteLine("Doing Command " + cmd); + // write command + comPort.Write(cmd + "\r\n"); + // read echoed line or existing data + string temp; + try + { + temp = Serial_ReadLine(comPort); + } + catch { temp = comPort.ReadExisting(); } + Console.WriteLine("cmd " + cmd + " echo " + temp); + // delay for command + Sleep(500); + // get responce + string ans = ""; + while (comPort.BytesToRead > 0) + { + try + { + ans = ans + Serial_ReadLine(comPort) + "\n"; + } + catch { ans = ans + comPort.ReadExisting() + "\n"; } + Sleep(50); + + if (ans.Length > 500) + { + break; + } + } + + Console.WriteLine("responce " + level + " " + ans.Replace('\0',' ')); + + // try again + if (ans == "" && level == 0) + return doCommand(comPort, cmd, 1); + + return ans; + } + + bool doConnect(ArdupilotMega.ICommsSerial comPort) + { + // clear buffer + comPort.DiscardInBuffer(); + // setup a known enviroment + comPort.Write("\r\n"); + // wait + Sleep(1100); + // send config string + comPort.Write("+++"); + // wait + Sleep(1100); + // check for config responce "OK" + Console.WriteLine("Connect btr " + comPort.BytesToRead + " baud " + comPort.BaudRate); + string conn = comPort.ReadExisting(); + Console.WriteLine("Connect first responce " + conn.Replace('\0',' ') + " " + conn.Length); + if (conn.Contains("OK")) + { + //return true; + } + else + { + // cleanup incase we are already in cmd mode + comPort.Write("\r\n"); + } + + string version = doCommand(comPort, "ATI"); + + Console.Write("Connect Version: " + version.Trim() + "\n"); + + if (version.Contains("on HM-TRP")) + { + return true; + } + + return false; + } + private void BUT_syncS2_Click(object sender, EventArgs e) { RS2.Text = S2.Text; diff --git a/Tools/ArdupilotMegaPlanner/Script.cs b/Tools/ArdupilotMegaPlanner/Script.cs index df94c21309..617c49ef31 100644 --- a/Tools/ArdupilotMegaPlanner/Script.cs +++ b/Tools/ArdupilotMegaPlanner/Script.cs @@ -30,11 +30,8 @@ namespace ArdupilotMega scope.SetVariable("cs", MainV2.cs); scope.SetVariable("Script", this); - Console.WriteLine(DateTime.Now.Millisecond); engine.CreateScriptSourceFromString("print 'hello world from python'").Execute(scope); - Console.WriteLine(DateTime.Now.Millisecond); engine.CreateScriptSourceFromString("print cs.roll").Execute(scope); - Console.WriteLine(DateTime.Now.Millisecond); object thisBoxed = MainV2.cs; diff --git a/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs b/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs index 62d2900dd9..babfd7e315 100644 --- a/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/SerialInput.Designer.cs @@ -85,11 +85,10 @@ // // LBL_location // - this.LBL_location.AutoSize = true; this.LBL_location.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LBL_location.Location = new System.Drawing.Point(9, 78); + this.LBL_location.Location = new System.Drawing.Point(3, 64); this.LBL_location.Name = "LBL_location"; - this.LBL_location.Size = new System.Drawing.Size(50, 24); + this.LBL_location.Size = new System.Drawing.Size(365, 59); this.LBL_location.TabIndex = 4; this.LBL_location.Text = "0,0,0"; // diff --git a/Tools/ArdupilotMegaPlanner/SerialInput.cs b/Tools/ArdupilotMegaPlanner/SerialInput.cs index 2d9eeae5a6..ba9c84fbd3 100644 --- a/Tools/ArdupilotMegaPlanner/SerialInput.cs +++ b/Tools/ArdupilotMegaPlanner/SerialInput.cs @@ -87,54 +87,56 @@ namespace ArdupilotMega void mainloop() { - + DateTime nextsend = DateTime.Now; threadrun = true; - int counter = 0; while (threadrun) { try { string line = comPort.ReadLine(); - //string line = string.Format("$GP{0},{1:HHmmss},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},", "GGA", DateTime.Now.ToUniversalTime(), Math.Abs(lat * 100), MainV2.cs.lat < 0 ? "S" : "N", Math.Abs(lng * 100), MainV2.cs.lng < 0 ? "W" : "E", MainV2.cs.gpsstatus, MainV2.cs.satcount, MainV2.cs.gpshdop, MainV2.cs.alt, "M", 0, "M", ""); if (line.StartsWith("$GPGGA")) // { - int c1 = line.IndexOf(',',0)+ 1; - int c2 = line.IndexOf(',', c1) + 1; - int c3 = line.IndexOf(',', c2) + 1; - int c4 = line.IndexOf(',', c3 ) + 1; - int c5 = line.IndexOf(',', c4 ) + 1; - int c6 = line.IndexOf(',', c5 ) + 1; - int c7 = line.IndexOf(',', c6 ) + 1; - int c8 = line.IndexOf(',', c7 ) + 1; - int c9 = line.IndexOf(',', c8 ) + 1; - int c10 = line.IndexOf(',', c9 ) + 1; - int c11 = line.IndexOf(',', c10 ) + 1; - int c12 = line.IndexOf(',', c11) + 1; + string[] items = line.Trim().Split(',','*'); - gotolocation.Lat = double.Parse(line.Substring(c2, c3 - c2 - 1)) / 100.0; + if (items[15] != GetChecksum(line.Trim())) + { + Console.WriteLine("Bad Nmea line " + items[15] + " vs " + GetChecksum(line.Trim())); + continue; + } + + if (items[6] == "0") + { + Console.WriteLine("No Fix"); + continue; + } + + gotolocation.Lat = double.Parse(items[2]) / 100.0; gotolocation.Lat = (int)gotolocation.Lat + ((gotolocation.Lat - (int)gotolocation.Lat) / 0.60); - if (line.Substring(c3, c4 - c3 - 1) == "S") + if (items[3] == "S") gotolocation.Lat *= -1; - gotolocation.Lng = double.Parse(line.Substring(c4, c5 - c4 - 1)) / 100.0; + gotolocation.Lng = double.Parse(items[4]) / 100.0; gotolocation.Lng = (int)gotolocation.Lng + ((gotolocation.Lng - (int)gotolocation.Lng) / 0.60); - if (line.Substring(c5, c6 - c5 - 1) == "W") + if (items[5] == "W") gotolocation.Lng *= -1; gotolocation.Alt = intalt; // double.Parse(line.Substring(c9, c10 - c9 - 1)) + + gotolocation.Tag = "Sats "+ items[7] + " hdop " + items[8] ; + } - if (counter % 10 == 0 && gotolocation.Lat != 0 && gotolocation.Lng != 0 && gotolocation.Alt != 0) // 200 * 10 = 2 sec /// lastgotolocation != gotolocation && + if (DateTime.Now > nextsend && gotolocation.Lat != 0 && gotolocation.Lng != 0 && gotolocation.Alt != 0) // 200 * 10 = 2 sec /// lastgotolocation != gotolocation && { + nextsend = DateTime.Now.AddSeconds(2); Console.WriteLine("Sending follow wp " +DateTime.Now.ToString("h:MM:ss")+" "+ gotolocation.Lat + " " + gotolocation.Lng + " " +gotolocation.Alt); lastgotolocation = new PointLatLngAlt(gotolocation); @@ -159,14 +161,13 @@ namespace ArdupilotMega MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT, (byte)2); + GCSViews.FlightData.GuidedModeWP = new PointLatLngAlt(gotohere); + MainV2.givecomport = false; } catch { MainV2.givecomport = false; } } } - - System.Threading.Thread.Sleep(200); - counter++; } catch { System.Threading.Thread.Sleep(2000); } } @@ -176,7 +177,7 @@ namespace ArdupilotMega { this.BeginInvoke((MethodInvoker)delegate { - LBL_location.Text = gotolocation.Lat + " " + gotolocation.Lng + " " + gotolocation.Alt; + LBL_location.Text = gotolocation.Lat + " " + gotolocation.Lng + " " + gotolocation.Alt +" "+ gotolocation.Tag; } ); @@ -200,7 +201,7 @@ namespace ArdupilotMega break; case '*': // Stop processing before the asterisk - continue; + return Checksum.ToString("X2"); default: // Is this the first value for the checksum? if (Checksum == 0) diff --git a/Tools/ArdupilotMegaPlanner/app.config b/Tools/ArdupilotMegaPlanner/app.config index f524c8fa5c..6368d93fef 100644 --- a/Tools/ArdupilotMegaPlanner/app.config +++ b/Tools/ArdupilotMegaPlanner/app.config @@ -1,7 +1,34 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config index f524c8fa5c..6368d93fef 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config +++ b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.exe.config @@ -1,7 +1,34 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb index 87d6b9dc89..74eff8d1e2 100644 Binary files a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb and b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.pdb differ diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml b/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml index d048c7c0b6..3964602e0a 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml +++ b/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml @@ -19,6 +19,7 @@ Pitch Yaw IN Yaw + Mag Heading WP Dist diff --git a/Tools/ArdupilotMegaPlanner/dataflashlog.xml b/Tools/ArdupilotMegaPlanner/dataflashlog.xml index d048c7c0b6..3964602e0a 100644 --- a/Tools/ArdupilotMegaPlanner/dataflashlog.xml +++ b/Tools/ArdupilotMegaPlanner/dataflashlog.xml @@ -19,6 +19,7 @@ Pitch Yaw IN Yaw + Mag Heading WP Dist diff --git a/Tools/ArdupilotMegaPlanner/georefimage.cs b/Tools/ArdupilotMegaPlanner/georefimage.cs index a23100b607..bc3429ba27 100644 --- a/Tools/ArdupilotMegaPlanner/georefimage.cs +++ b/Tools/ArdupilotMegaPlanner/georefimage.cs @@ -1,22 +1,19 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; +using System.Reflection; using System.IO; using System.Windows.Forms; using com.drew.imaging.jpg; using com.drew.metadata; - +using log4net; using SharpKml.Base; using SharpKml.Dom; -using SharpKml.Dom.GX; namespace ArdupilotMega { - class georefimage : Form + public class Georefimage : Form { + private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private OpenFileDialog openFileDialog1; private MyButton BUT_browselog; private MyButton BUT_browsedir; @@ -31,7 +28,7 @@ namespace ArdupilotMega int latpos = 5, lngpos = 4, altpos = 7; - internal georefimage() { + internal Georefimage() { InitializeComponent(); } @@ -51,7 +48,7 @@ namespace ArdupilotMega } catch (JpegProcessingException e) { - Console.WriteLine(e.Message); + log.InfoFormat(e.Message); return dtaken; } @@ -61,7 +58,7 @@ namespace ArdupilotMega if (lcDirectory.ContainsTag(0x9003)) { dtaken = lcDirectory.GetDate(0x9003); - Console.WriteLine("does " + lcDirectory.GetTagName(0x9003) + " " + dtaken); + log.InfoFormat("does " + lcDirectory.GetTagName(0x9003) + " " + dtaken); break; } @@ -96,6 +93,51 @@ namespace ArdupilotMega { List list = new List(); + if (fn.ToLower().EndsWith("tlog")) + { + MAVLink mine = new MAVLink(); + mine.logplaybackfile = new BinaryReader(File.Open(fn, FileMode.Open, FileAccess.Read, FileShare.Read)); + mine.logreadmode = true; + + mine.packets.Initialize(); // clear + + CurrentState cs = new CurrentState(); + + string[] oldvalues = {""}; + + while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length) + { + + byte[] packet = mine.readPacket(); + + cs.datetime = mine.lastlogread; + + cs.UpdateCurrentSettings(null, true, mine); + + // line "GPS: 82686250, 1, 8, -34.1406480, 118.5441900, 0.0000, 309.1900, 315.9500, 0.0000, 279.1200" string + + + string[] vals = new string[] { "GPS", (new DateTime(cs.datetime.Year,cs.datetime.Month,cs.datetime.Day,0,0,0) - cs.datetime).TotalMilliseconds.ToString(), "1", + "8",cs.lat.ToString(),cs.lng.ToString(),"0.0",cs.alt.ToString(),cs.alt.ToString(),"0.0",cs.groundcourse.ToString()}; + + if (oldvalues.Length > 2 && oldvalues[latpos] == vals[latpos] + && oldvalues[lngpos] == vals[lngpos] + && oldvalues[altpos] == vals[altpos]) + continue; + + oldvalues = vals; + + list.Add(vals); + // 4 5 7 + Console.Write((mine.logplaybackfile.BaseStream.Position * 100 / mine.logplaybackfile.BaseStream.Length) + " \r"); + + } + + mine.logplaybackfile.Close(); + + return list; + } + StreamReader sr = new StreamReader(fn); string lasttime = "0"; @@ -172,7 +214,7 @@ namespace ArdupilotMega localmax = crap; } - Console.WriteLine("min " + localmin + " max " + localmax); + log.InfoFormat("min " + localmin + " max " + localmax); TXT_outputlog.AppendText("Log min " + localmin + " max " + localmax + "\r\n"); } @@ -220,7 +262,7 @@ namespace ArdupilotMega sw.WriteLine(Path.GetFileNameWithoutExtension(file) + "\t" + crap.ToString("yyyy:MM:dd HH:mm:ss") + "\t" + arr[lngpos] + "\t" + arr[latpos] + "\t" + arr[altpos]); sw.Flush(); sw2.Flush(); - Console.WriteLine(Path.GetFileNameWithoutExtension(file) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos] + " "); + log.InfoFormat(Path.GetFileNameWithoutExtension(file) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos] + " "); break; } //Console.WriteLine(crap); @@ -359,7 +401,7 @@ namespace ArdupilotMega this.Controls.Add(this.TXT_logfile); this.Controls.Add(this.BUT_browsedir); this.Controls.Add(this.BUT_browselog); - this.Name = "georefimage"; + this.Name = "Georefimage"; this.ResumeLayout(false); this.PerformLayout(); @@ -367,7 +409,7 @@ namespace ArdupilotMega private void BUT_browselog_Click(object sender, EventArgs e) { - openFileDialog1.Filter = "Logs|*.log"; + openFileDialog1.Filter = "Logs|*.log;*.tlog"; openFileDialog1.ShowDialog(); if (File.Exists(openFileDialog1.FileName)) diff --git a/Tools/ArdupilotMegaPlanner/temp.Designer.cs b/Tools/ArdupilotMegaPlanner/temp.Designer.cs index d09cc97373..4e844073f1 100644 --- a/Tools/ArdupilotMegaPlanner/temp.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/temp.Designer.cs @@ -46,6 +46,7 @@ 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.SuspendLayout(); // // button1 @@ -215,7 +216,7 @@ // // BUT_follow_me // - this.BUT_follow_me.Location = new System.Drawing.Point(525, 164); + this.BUT_follow_me.Location = new System.Drawing.Point(527, 164); this.BUT_follow_me.Name = "BUT_follow_me"; this.BUT_follow_me.Size = new System.Drawing.Size(75, 23); this.BUT_follow_me.TabIndex = 17; @@ -223,11 +224,22 @@ this.BUT_follow_me.UseVisualStyleBackColor = true; this.BUT_follow_me.Click += new System.EventHandler(this.BUT_follow_me_Click); // + // BUT_ant_track + // + this.BUT_ant_track.Location = new System.Drawing.Point(446, 164); + this.BUT_ant_track.Name = "BUT_ant_track"; + this.BUT_ant_track.Size = new System.Drawing.Size(75, 23); + this.BUT_ant_track.TabIndex = 18; + this.BUT_ant_track.Text = "Antenna Tracker"; + this.BUT_ant_track.UseVisualStyleBackColor = true; + this.BUT_ant_track.Click += new System.EventHandler(this.BUT_ant_track_Click); + // // temp // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(731, 281); + this.Controls.Add(this.BUT_ant_track); this.Controls.Add(this.BUT_follow_me); this.Controls.Add(this.BUT_georefimage); this.Controls.Add(this.BUT_lang_edit); @@ -274,6 +286,7 @@ private MyButton BUT_lang_edit; private MyButton BUT_georefimage; private MyButton BUT_follow_me; + private MyButton BUT_ant_track; //private SharpVectors.Renderers.Forms.SvgPictureBox svgPictureBox1; } diff --git a/Tools/ArdupilotMegaPlanner/temp.cs b/Tools/ArdupilotMegaPlanner/temp.cs index 394ab8b1d5..8994baf70e 100644 --- a/Tools/ArdupilotMegaPlanner/temp.cs +++ b/Tools/ArdupilotMegaPlanner/temp.cs @@ -13,11 +13,14 @@ using System.Net; using GMap.NET.WindowsForms; using GMap.NET.CacheProviders; +using log4net; namespace ArdupilotMega { public partial class temp : Form { + private static readonly ILog log = + LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public temp() { InitializeComponent(); @@ -159,7 +162,7 @@ namespace ArdupilotMega int start = 0; int end = 1024*4; - Console.WriteLine(start + " to " + end); + log.Info(start + " to " + end); port.upload(EEPROM, (short)start, (short)(end - start), (short)start); if (port.keepalive()) @@ -230,7 +233,7 @@ namespace ArdupilotMega int start = 0; int end = 1024*4; - Console.WriteLine(start + " to " + end); + log.Info(start + " to " + end); port.upload(EEPROM, (short)start, (short)(end - start), (short)start); if (port.keepalive()) @@ -295,11 +298,11 @@ namespace ArdupilotMega int start = 0; short length = 0x100; - Console.WriteLine(start + " to " + FLASH.Length); + log.Info(start + " to " + FLASH.Length); while (start < FLASH.Length) { - Console.WriteLine("Doing " + length + " at " + start); + log.Info("Doing " + length + " at " + start); port.setaddress(start); port.downloadflash(length).CopyTo(FLASH, start); start += length; @@ -335,7 +338,7 @@ namespace ArdupilotMega sw.Close(); - Console.WriteLine("Downloaded"); + log.Info("Downloaded"); } else { @@ -397,7 +400,7 @@ namespace ArdupilotMega if (port.connectAP()) { - Console.WriteLine("starting"); + log.Info("starting"); port.uploadflash(FLASH, 0, FLASH.Length, 0); @@ -405,7 +408,7 @@ namespace ArdupilotMega - Console.WriteLine("Uploaded"); + log.Info("Uploaded"); } @@ -442,7 +445,7 @@ namespace ArdupilotMega int length = Convert.ToInt32(match.Groups[1].Value.ToString(), 16); int address = Convert.ToInt32(match.Groups[2].Value.ToString(), 16); int option = Convert.ToInt32(match.Groups[3].Value.ToString(), 16); - Console.WriteLine("len {0} add {1} opt {2}", length, address, option); + log.InfoFormat("len {0} add {1} opt {2}", length, address, option); if (option == 0) { string data = match.Groups[4].Value.ToString(); @@ -484,7 +487,7 @@ namespace ArdupilotMega int length = Convert.ToInt32(line.Substring(1, 2), 16); int address = Convert.ToInt32(line.Substring(3, 4), 16); int option = Convert.ToInt32(line.Substring(7, 2), 16); - Console.WriteLine("len {0} add {1} opt {2}", length, address, option); + log.InfoFormat("len {0} add {1} opt {2}", length, address, option); if (option == 0) { @@ -535,12 +538,12 @@ namespace ArdupilotMega { port.PortName = ArdupilotMega.MainV2.comportname; - Console.WriteLine("Open Port"); + log.Info("Open Port"); port.Open(); - Console.WriteLine("Connect AP"); + log.Info("Connect AP"); if (port.connectAP()) { - Console.WriteLine("Download AP"); + log.Info("Download AP"); byte[] EEPROM = new byte[1024*4]; for (int a = 0; a < 4 * 1024; a += 0x100) @@ -548,7 +551,7 @@ namespace ArdupilotMega port.setaddress(a); port.download(0x100).CopyTo(EEPROM,a); } - Console.WriteLine("Verify State"); + log.Info("Verify State"); if (port.keepalive()) { StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"EEPROM.bin"); @@ -586,12 +589,12 @@ namespace ArdupilotMega { port.PortName = ArdupilotMega.MainV2.comportname; - Console.WriteLine("Open Port"); + log.Info("Open Port"); port.Open(); - Console.WriteLine("Connect AP"); + log.Info("Connect AP"); if (port.connectAP()) { - Console.WriteLine("Download AP"); + log.Info("Download AP"); byte[] EEPROM = new byte[1024 * 4]; for (int a = 0; a < 4 * 1024; a += 0x100) @@ -599,7 +602,7 @@ namespace ArdupilotMega port.setaddress(a); port.download(0x100).CopyTo(EEPROM, a); } - Console.WriteLine("Verify State"); + log.Info("Verify State"); if (port.keepalive()) { StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"EEPROM1280.bin"); @@ -607,7 +610,7 @@ namespace ArdupilotMega bw.Write(EEPROM, 0, EEPROM.Length); bw.Close(); - Console.WriteLine("Download AP"); + log.Info("Download AP"); byte[] FLASH = new byte[1024 * 128]; for (int a = 0; a < FLASH.Length; a += 0x100) @@ -650,12 +653,12 @@ namespace ArdupilotMega { port.PortName = ArdupilotMega.MainV2.comportname; - Console.WriteLine("Open Port"); + log.Info("Open Port"); port.Open(); - Console.WriteLine("Connect AP"); + log.Info("Connect AP"); if (port.connectAP()) { - Console.WriteLine("Download AP"); + log.Info("Download AP"); byte[] EEPROM = new byte[1024 * 4]; for (int a = 0; a < EEPROM.Length; a += 0x100) @@ -663,7 +666,7 @@ namespace ArdupilotMega port.setaddress(a); port.download(0x100).CopyTo(EEPROM, a); } - Console.WriteLine("Verify State"); + log.Info("Verify State"); if (port.keepalive()) { StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"EEPROM2560.bin"); @@ -671,7 +674,7 @@ namespace ArdupilotMega bw.Write(EEPROM, 0, EEPROM.Length); bw.Close(); - Console.WriteLine("Download AP"); + log.Info("Download AP"); byte[] FLASH = new byte[1024 * 256]; for (int a = 0; a < FLASH.Length; a += 0x100) @@ -733,7 +736,7 @@ namespace ArdupilotMega if (port.connectAP()) { - Console.WriteLine("starting"); + log.Info("starting"); port.uploadflash(FLASH, 0, FLASH.Length, 0); @@ -741,7 +744,7 @@ namespace ArdupilotMega port.upload(EEPROM, 0, (short)EEPROM.Length, 0); - Console.WriteLine("Uploaded"); + log.Info("Uploaded"); } @@ -800,7 +803,7 @@ namespace ArdupilotMega foreach (string file in files) { - Console.WriteLine(DateTime.Now.Millisecond + " Doing "+ file); + log.Info(DateTime.Now.Millisecond + " Doing "+ file); Regex reg = new Regex(@"Z([0-9]+)\\([0-9]+)\\([0-9]+)"); Match mat = reg.Match(file); @@ -820,7 +823,7 @@ namespace ArdupilotMega Img.Save(tile,System.Drawing.Imaging.ImageFormat.Jpeg); tile.Seek(0, SeekOrigin.Begin); - Console.WriteLine(pnt.X + " " + pnt.Y); + log.Info(pnt.X + " " + pnt.Y); Application.DoEvents(); @@ -860,7 +863,7 @@ namespace ArdupilotMega GMap.NET.CacheProviders.SQLitePureImageCache.VacuumDb(MainMap.CacheLocation + @"\TileDBv3\en\Data.gmdb"); - Console.WriteLine("Removed {0} images",removed); + log.InfoFormat("Removed {0} images", removed); } private void BUT_lang_edit_Click(object sender, EventArgs e) { @@ -869,7 +872,7 @@ namespace ArdupilotMega private void BUT_georefimage_Click(object sender, EventArgs e) { - new georefimage().Show(); + new Georefimage().Show(); } private void BUT_follow_me_Click(object sender, EventArgs e) @@ -878,5 +881,10 @@ namespace ArdupilotMega MainV2.fixtheme((Form)si); si.Show(); } + + private void BUT_ant_track_Click(object sender, EventArgs e) + { + new Antenna.Tracker().Show(); + } } }