diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index 4db94cd354..c685556074 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -183,6 +183,12 @@ + + Form + + + Camera.cs + @@ -350,6 +356,9 @@ AGauge.cs Designer + + Camera.cs + Configuration.cs diff --git a/Tools/ArdupilotMegaPlanner/Camera.Designer.cs b/Tools/ArdupilotMegaPlanner/Camera.Designer.cs new file mode 100644 index 0000000000..4382be0831 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Camera.Designer.cs @@ -0,0 +1,421 @@ +namespace ArdupilotMega +{ + partial class Camera + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.num_agl = new System.Windows.Forms.NumericUpDown(); + this.num_megapixel = new System.Windows.Forms.NumericUpDown(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.num_focallength = new System.Windows.Forms.NumericUpDown(); + this.label4 = new System.Windows.Forms.Label(); + this.num_focalmultip = new System.Windows.Forms.NumericUpDown(); + this.TXT_fovH = new System.Windows.Forms.TextBox(); + this.TXT_fovV = new System.Windows.Forms.TextBox(); + this.TXT_fovD = new System.Windows.Forms.TextBox(); + this.TXT_fovAD = new System.Windows.Forms.TextBox(); + this.TXT_fovAV = new System.Windows.Forms.TextBox(); + this.TXT_fovAH = new System.Windows.Forms.TextBox(); + this.TXT_cmpixel = new System.Windows.Forms.TextBox(); + this.TXT_imgwidth = new System.Windows.Forms.TextBox(); + this.TXT_imgheight = new System.Windows.Forms.TextBox(); + this.label1 = 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.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.num_agl)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_megapixel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_focallength)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_focalmultip)).BeginInit(); + this.SuspendLayout(); + // + // num_agl + // + this.num_agl.Location = new System.Drawing.Point(12, 12); + 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(120, 20); + this.num_agl.TabIndex = 1; + this.num_agl.Value = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.num_agl.ValueChanged += new System.EventHandler(this.num_agl_ValueChanged); + // + // num_megapixel + // + this.num_megapixel.DecimalPlaces = 1; + this.num_megapixel.Increment = new decimal(new int[] { + 5, + 0, + 0, + 65536}); + this.num_megapixel.Location = new System.Drawing.Point(13, 38); + this.num_megapixel.Name = "num_megapixel"; + this.num_megapixel.Size = new System.Drawing.Size(120, 20); + this.num_megapixel.TabIndex = 2; + this.num_megapixel.Value = new decimal(new int[] { + 8, + 0, + 0, + 0}); + this.num_megapixel.ValueChanged += new System.EventHandler(this.num_megapixel_ValueChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(140, 19); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(72, 13); + this.label2.TabIndex = 4; + this.label2.Text = "Height m (agl)"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(140, 45); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(95, 13); + this.label3.TabIndex = 5; + this.label3.Text = "MegaPixel Camera"; + // + // num_focallength + // + this.num_focallength.DecimalPlaces = 1; + this.num_focallength.Increment = new decimal(new int[] { + 5, + 0, + 0, + 65536}); + this.num_focallength.Location = new System.Drawing.Point(245, 12); + this.num_focallength.Maximum = new decimal(new int[] { + 180, + 0, + 0, + 0}); + this.num_focallength.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.num_focallength.Name = "num_focallength"; + this.num_focallength.Size = new System.Drawing.Size(120, 20); + this.num_focallength.TabIndex = 6; + this.num_focallength.Value = new decimal(new int[] { + 35, + 0, + 0, + 0}); + this.num_focallength.ValueChanged += new System.EventHandler(this.num_focallength_ValueChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(242, 72); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(99, 13); + this.label4.TabIndex = 8; + this.label4.Text = "2 x tan-1( l / (2 x f) )"; + // + // num_focalmultip + // + this.num_focalmultip.DecimalPlaces = 1; + this.num_focalmultip.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.num_focalmultip.Location = new System.Drawing.Point(245, 38); + this.num_focalmultip.Maximum = new decimal(new int[] { + 5, + 0, + 0, + 0}); + this.num_focalmultip.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.num_focalmultip.Name = "num_focalmultip"; + this.num_focalmultip.Size = new System.Drawing.Size(120, 20); + this.num_focalmultip.TabIndex = 9; + this.num_focalmultip.Value = new decimal(new int[] { + 15, + 0, + 0, + 65536}); + this.num_focalmultip.ValueChanged += new System.EventHandler(this.num_focalmultip_ValueChanged); + // + // TXT_fovH + // + this.TXT_fovH.Location = new System.Drawing.Point(72, 138); + 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(72, 165); + this.TXT_fovV.Name = "TXT_fovV"; + this.TXT_fovV.Size = new System.Drawing.Size(100, 20); + this.TXT_fovV.TabIndex = 11; + // + // TXT_fovD + // + this.TXT_fovD.Location = new System.Drawing.Point(72, 192); + this.TXT_fovD.Name = "TXT_fovD"; + this.TXT_fovD.Size = new System.Drawing.Size(100, 20); + this.TXT_fovD.TabIndex = 12; + // + // TXT_fovAD + // + this.TXT_fovAD.Location = new System.Drawing.Point(286, 192); + this.TXT_fovAD.Name = "TXT_fovAD"; + this.TXT_fovAD.Size = new System.Drawing.Size(100, 20); + this.TXT_fovAD.TabIndex = 15; + // + // TXT_fovAV + // + this.TXT_fovAV.Location = new System.Drawing.Point(286, 165); + 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(286, 138); + 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(176, 218); + 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(93, 244); + this.TXT_imgwidth.Name = "TXT_imgwidth"; + this.TXT_imgwidth.Size = new System.Drawing.Size(100, 20); + this.TXT_imgwidth.TabIndex = 17; + // + // TXT_imgheight + // + this.TXT_imgheight.Location = new System.Drawing.Point(255, 244); + this.TXT_imgheight.Name = "TXT_imgheight"; + this.TXT_imgheight.Size = new System.Drawing.Size(100, 20); + this.TXT_imgheight.TabIndex = 18; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(371, 19); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(69, 13); + this.label1.TabIndex = 19; + this.label1.Text = "Focal Length"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(371, 45); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(88, 13); + this.label5.TabIndex = 20; + this.label5.Text = "Frame Muli factor"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(9, 145); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(36, 13); + this.label6.TabIndex = 21; + this.label6.Text = "Dist H"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(235, 145); + 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(236, 172); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(44, 13); + this.label8.TabIndex = 23; + this.label8.Text = "Angle V"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(235, 199); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(45, 13); + this.label9.TabIndex = 24; + this.label9.Text = "Angle D"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(10, 172); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(35, 13); + this.label10.TabIndex = 25; + this.label10.Text = "Dist V"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(10, 199); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(36, 13); + this.label11.TabIndex = 26; + this.label11.Text = "Dist D"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(125, 225); + 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(37, 251); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(39, 13); + this.label13.TabIndex = 28; + this.label13.Text = "Pixel X"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(199, 253); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(39, 13); + this.label14.TabIndex = 29; + this.label14.Text = "Pixel Y"; + // + // Camera + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(473, 275); + this.Controls.Add(this.label14); + this.Controls.Add(this.label13); + this.Controls.Add(this.label12); + this.Controls.Add(this.label11); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label1); + this.Controls.Add(this.TXT_imgheight); + this.Controls.Add(this.TXT_imgwidth); + this.Controls.Add(this.TXT_cmpixel); + this.Controls.Add(this.TXT_fovAD); + this.Controls.Add(this.TXT_fovAV); + this.Controls.Add(this.TXT_fovAH); + this.Controls.Add(this.TXT_fovD); + this.Controls.Add(this.TXT_fovV); + this.Controls.Add(this.TXT_fovH); + this.Controls.Add(this.num_focalmultip); + this.Controls.Add(this.label4); + this.Controls.Add(this.num_focallength); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.num_megapixel); + this.Controls.Add(this.num_agl); + this.Name = "Camera"; + this.Text = "Camera"; + ((System.ComponentModel.ISupportInitialize)(this.num_agl)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_megapixel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_focallength)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.num_focalmultip)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.NumericUpDown num_agl; + private System.Windows.Forms.NumericUpDown num_megapixel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.NumericUpDown num_focallength; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.NumericUpDown num_focalmultip; + private System.Windows.Forms.TextBox TXT_fovH; + private System.Windows.Forms.TextBox TXT_fovV; + private System.Windows.Forms.TextBox TXT_fovD; + private System.Windows.Forms.TextBox TXT_fovAD; + private System.Windows.Forms.TextBox TXT_fovAV; + private System.Windows.Forms.TextBox TXT_fovAH; + private System.Windows.Forms.TextBox TXT_cmpixel; + private System.Windows.Forms.TextBox TXT_imgwidth; + private System.Windows.Forms.TextBox TXT_imgheight; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label14; + } +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Camera.cs b/Tools/ArdupilotMegaPlanner/Camera.cs new file mode 100644 index 0000000000..afbb9d1fa0 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Camera.cs @@ -0,0 +1,139 @@ +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 +{ + public partial class Camera : Form + { + float mm_2_feet = 1 / 304.8f; + float feet_2_mm = 304.8f; + const float rad2deg = (float)(180 / Math.PI); + const float deg2rad = (float)(1.0 / rad2deg); + + public Camera() + { + InitializeComponent(); + } + + private void numericUpDown1_ValueChanged(object sender, EventArgs e) + { + doCalc(); + } + + void doCalc() + { + + var film_width = 36.0f; + var film_height = 27.0f; + var film_diag = 0.0f; + + var flen = (float)num_focallength.Value; + var flen_mult = (float)num_focalmultip.Value; + var subj_dist = (float)num_agl.Value; + + //if (isNaN(flen_mult) || flen_mult<=0) + { + //f.flen_mult = 1; + //flen_mult = 1; + } + + // convert distance to mm + /* + if (f.units.value.search(/feet/i) != -1) + { + //user input in feet + subj_dist = subj_dist * feet_2_mm; + } + else */ + { + //user input in m + subj_dist = subj_dist * 1000; + } + + //Account for focal length multiplier (actually, a film/sensor size multiplier) + film_width = film_width / flen_mult; + film_height = film_height / flen_mult; + film_diag = (int)(Math.Sqrt((film_width * film_width) + (film_height * film_height))); + + var half_fov_h = (Math.Atan(film_width / (2 * flen))); + var fov_h = 2 * (subj_dist * Math.Tan(half_fov_h)); + + var half_fov_v = (Math.Atan(film_height / (2 * flen))); + var fov_v = 2 * (subj_dist * Math.Tan(half_fov_v)); + + var half_fov_d = (Math.Atan(film_diag / (2 * flen))); + var fov_d = 2 * (subj_dist * Math.Tan(half_fov_d)); + + //convert answer (currently in mm) back to feet + fov_h = fov_h * mm_2_feet; + fov_v = fov_v * mm_2_feet; + fov_d = fov_d * mm_2_feet; + /* + if (f.units.value.search(/feet/i) != -1) + { + f.fov_h.value = feet_inches(fov_h); + f.fov_v.value = feet_inches(fov_v); + f.fov_d.value = feet_inches(fov_d); + } + else */ + { + TXT_fovH.Text = meters(fov_h); + TXT_fovV.Text = meters(fov_v); + TXT_fovD.Text = meters(fov_d); + + TXT_fovAH.Text = (half_fov_h * 2 * rad2deg).ToString("0.00"); + TXT_fovAV.Text = (half_fov_v * 2 * rad2deg).ToString("0.00"); + TXT_fovAD.Text = (half_fov_d * 2 * rad2deg).ToString("0.00"); + + float test1 = (float)Math.Sqrt((float)num_megapixel.Value * 1000000 * (film_height / film_width)); + + TXT_imgwidth.Text = test1.ToString("0"); + TXT_imgheight.Text = (((float)num_megapixel.Value * 1000000) / test1).ToString("0"); + + + TXT_cmpixel.Text = (((fov_h * feet_2_mm) / 10.0) / test1).ToString("0.000 cm"); + } + } + + + //Takes a distance in feet and converts to string representation in meters/cm + string meters(double aNumber) + { + //if (isNaN(aNumber)) + //return aNumber; + + var mm = aNumber * feet_2_mm; + + var m = Math.Floor(mm / 1000); + var cm = (mm / 10) % 100; + + return m + "m " + cm.ToString("0.00") + "cm"; + } + + private void num_agl_ValueChanged(object sender, EventArgs e) + { + doCalc(); + } + + private void num_megapixel_ValueChanged(object sender, EventArgs e) + { + doCalc(); + } + + private void num_focallength_ValueChanged(object sender, EventArgs e) + { + doCalc(); + } + + private void num_focalmultip_ValueChanged(object sender, EventArgs e) + { + doCalc(); + } + } +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Camera.resx b/Tools/ArdupilotMegaPlanner/Camera.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Camera.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs index 924463c992..79df55f2e2 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs @@ -289,8 +289,6 @@ namespace ArdupilotMega.GCSViews internal void processToScreen() { - - Params.Rows.Clear(); // process hashdefines and update display @@ -343,7 +341,7 @@ namespace ArdupilotMega.GCSViews { try { - toolTip1.SetToolTip(ctl, tooltips[value].ToString()); + toolTip1.SetToolTip(ctl, ((paramsettings)tooltips[value]).desc); } catch { } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index e7d970530f..067b30f823 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -563,7 +563,7 @@ namespace ArdupilotMega.GCSViews this.Refresh(); Console.WriteLine("Downloaded"); } - catch (Exception ex) { lbl_status.Text = "Failed download"; MessageBox.Show("Failed to download new firmware : " + ex.Message); return; } + catch (Exception ex) { lbl_status.Text = "Failed download"; MessageBox.Show("Failed to download new firmware : " + ex.ToString()); return; } UploadFlash(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"firmware.hex", board); } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs index 39e165613e..bddd7f9853 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs @@ -50,6 +50,11 @@ this.BUT_playlog = new ArdupilotMega.MyButton(); this.BUT_loadtelem = new ArdupilotMega.MyButton(); this.tableMap = new System.Windows.Forms.TableLayoutPanel(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.zg1 = new ZedGraph.ZedGraphControl(); + this.lbl_winddir = new ArdupilotMega.MyLabel(); + this.lbl_windvel = new ArdupilotMega.MyLabel(); + this.gMapControl1 = new GMap.NET.WindowsForms.GMapControl(); this.panel1 = new System.Windows.Forms.Panel(); this.TXT_lat = new ArdupilotMega.MyLabel(); this.Zoomlevel = new System.Windows.Forms.NumericUpDown(); @@ -58,11 +63,6 @@ this.TXT_alt = new ArdupilotMega.MyLabel(); this.CHK_autopan = new System.Windows.Forms.CheckBox(); this.CB_tuning = new System.Windows.Forms.CheckBox(); - this.panel2 = new System.Windows.Forms.Panel(); - this.lbl_windvel = new ArdupilotMega.MyLabel(); - this.lbl_winddir = new ArdupilotMega.MyLabel(); - this.gMapControl1 = new GMap.NET.WindowsForms.GMapControl(); - this.zg1 = new ZedGraph.ZedGraphControl(); this.dataGridViewImageColumn1 = new System.Windows.Forms.DataGridViewImageColumn(); this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn(); this.ZedGraphTimer = new System.Windows.Forms.Timer(this.components); @@ -84,9 +84,11 @@ ((System.ComponentModel.ISupportInitialize)(this.NUM_playbackspeed)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tracklog)).BeginInit(); this.tableMap.SuspendLayout(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Zoomlevel)).BeginInit(); - this.panel2.SuspendLayout(); this.SuspendLayout(); // // contextMenuStrip1 @@ -1042,10 +1044,80 @@ // tableMap // resources.ApplyResources(this.tableMap, "tableMap"); + this.tableMap.Controls.Add(this.splitContainer1, 0, 0); this.tableMap.Controls.Add(this.panel1, 0, 1); - this.tableMap.Controls.Add(this.panel2, 0, 0); this.tableMap.Name = "tableMap"; // + // splitContainer1 + // + resources.ApplyResources(this.splitContainer1, "splitContainer1"); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.zg1); + this.splitContainer1.Panel1Collapsed = true; + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.lbl_winddir); + this.splitContainer1.Panel2.Controls.Add(this.lbl_windvel); + this.splitContainer1.Panel2.Controls.Add(this.gMapControl1); + // + // zg1 + // + resources.ApplyResources(this.zg1, "zg1"); + this.zg1.Name = "zg1"; + this.zg1.ScrollGrace = 0D; + this.zg1.ScrollMaxX = 0D; + this.zg1.ScrollMaxY = 0D; + this.zg1.ScrollMaxY2 = 0D; + this.zg1.ScrollMinX = 0D; + this.zg1.ScrollMinY = 0D; + this.zg1.ScrollMinY2 = 0D; + this.zg1.DoubleClick += new System.EventHandler(this.zg1_DoubleClick); + // + // lbl_winddir + // + this.lbl_winddir.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource1, "wind_dir", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "Dir: 0")); + resources.ApplyResources(this.lbl_winddir, "lbl_winddir"); + this.lbl_winddir.Name = "lbl_winddir"; + this.lbl_winddir.resize = true; + this.toolTip1.SetToolTip(this.lbl_winddir, resources.GetString("lbl_winddir.ToolTip")); + // + // lbl_windvel + // + this.lbl_windvel.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource1, "wind_vel", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "Vel: 0")); + resources.ApplyResources(this.lbl_windvel, "lbl_windvel"); + this.lbl_windvel.Name = "lbl_windvel"; + this.lbl_windvel.resize = true; + this.toolTip1.SetToolTip(this.lbl_windvel, resources.GetString("lbl_windvel.ToolTip")); + // + // gMapControl1 + // + this.gMapControl1.BackColor = System.Drawing.Color.Transparent; + this.gMapControl1.Bearing = 0F; + this.gMapControl1.CanDragMap = true; + this.gMapControl1.ContextMenuStrip = this.contextMenuStrip1; + resources.ApplyResources(this.gMapControl1, "gMapControl1"); + this.gMapControl1.GrayScaleMode = false; + this.gMapControl1.LevelsKeepInMemmory = 5; + this.gMapControl1.MarkersEnabled = true; + this.gMapControl1.MaxZoom = 2; + this.gMapControl1.MinZoom = 2; + this.gMapControl1.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter; + this.gMapControl1.Name = "gMapControl1"; + this.gMapControl1.NegativeMode = false; + this.gMapControl1.PolygonsEnabled = true; + this.gMapControl1.RetryLoadTile = 0; + this.gMapControl1.RoutesEnabled = true; + this.gMapControl1.ShowTileGridLines = false; + this.gMapControl1.streamjpg = ((System.IO.MemoryStream)(resources.GetObject("gMapControl1.streamjpg"))); + this.gMapControl1.Zoom = 0D; + this.gMapControl1.Click += new System.EventHandler(this.gMapControl1_Click); + this.gMapControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gMapControl1_MouseDown); + this.gMapControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.gMapControl1_MouseMove); + // // panel1 // this.panel1.Controls.Add(this.TXT_lat); @@ -1130,69 +1202,6 @@ this.CB_tuning.UseVisualStyleBackColor = true; this.CB_tuning.CheckedChanged += new System.EventHandler(this.CB_tuning_CheckedChanged); // - // panel2 - // - this.panel2.Controls.Add(this.lbl_windvel); - this.panel2.Controls.Add(this.lbl_winddir); - this.panel2.Controls.Add(this.gMapControl1); - this.panel2.Controls.Add(this.zg1); - resources.ApplyResources(this.panel2, "panel2"); - this.panel2.Name = "panel2"; - // - // lbl_windvel - // - this.lbl_windvel.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource1, "wind_vel", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "Vel: 0")); - resources.ApplyResources(this.lbl_windvel, "lbl_windvel"); - this.lbl_windvel.Name = "lbl_windvel"; - this.lbl_windvel.resize = true; - this.toolTip1.SetToolTip(this.lbl_windvel, resources.GetString("lbl_windvel.ToolTip")); - // - // lbl_winddir - // - this.lbl_winddir.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource1, "wind_dir", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "Dir: 0")); - resources.ApplyResources(this.lbl_winddir, "lbl_winddir"); - this.lbl_winddir.Name = "lbl_winddir"; - this.lbl_winddir.resize = true; - this.toolTip1.SetToolTip(this.lbl_winddir, resources.GetString("lbl_winddir.ToolTip")); - // - // gMapControl1 - // - this.gMapControl1.BackColor = System.Drawing.Color.Transparent; - this.gMapControl1.Bearing = 0F; - this.gMapControl1.CanDragMap = true; - this.gMapControl1.ContextMenuStrip = this.contextMenuStrip1; - resources.ApplyResources(this.gMapControl1, "gMapControl1"); - this.gMapControl1.GrayScaleMode = false; - this.gMapControl1.LevelsKeepInMemmory = 5; - this.gMapControl1.MarkersEnabled = true; - this.gMapControl1.MaxZoom = 2; - this.gMapControl1.MinZoom = 2; - this.gMapControl1.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter; - this.gMapControl1.Name = "gMapControl1"; - this.gMapControl1.NegativeMode = false; - this.gMapControl1.PolygonsEnabled = true; - this.gMapControl1.RetryLoadTile = 0; - this.gMapControl1.RoutesEnabled = true; - this.gMapControl1.ShowTileGridLines = false; - this.gMapControl1.streamjpg = ((System.IO.MemoryStream)(resources.GetObject("gMapControl1.streamjpg"))); - this.gMapControl1.Zoom = 0D; - this.gMapControl1.Click += new System.EventHandler(this.gMapControl1_Click); - this.gMapControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gMapControl1_MouseDown); - this.gMapControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.gMapControl1_MouseMove); - // - // zg1 - // - resources.ApplyResources(this.zg1, "zg1"); - this.zg1.Name = "zg1"; - this.zg1.ScrollGrace = 0D; - this.zg1.ScrollMaxX = 0D; - this.zg1.ScrollMaxY = 0D; - this.zg1.ScrollMaxY2 = 0D; - this.zg1.ScrollMinX = 0D; - this.zg1.ScrollMinY = 0D; - this.zg1.ScrollMinY2 = 0D; - this.zg1.DoubleClick += new System.EventHandler(this.zg1_DoubleClick); - // // dataGridViewImageColumn1 // dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; @@ -1254,10 +1263,12 @@ ((System.ComponentModel.ISupportInitialize)(this.NUM_playbackspeed)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tracklog)).EndInit(); this.tableMap.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.Zoomlevel)).EndInit(); - this.panel2.ResumeLayout(false); this.ResumeLayout(false); } @@ -1294,7 +1305,6 @@ private ArdupilotMega.MyLabel TXT_long; private ArdupilotMega.MyLabel TXT_alt; private System.Windows.Forms.CheckBox CHK_autopan; - private System.Windows.Forms.Panel panel2; private GMap.NET.WindowsForms.GMapControl gMapControl1; private ZedGraph.ZedGraphControl zg1; private System.Windows.Forms.TabControl tabControl1; @@ -1320,5 +1330,6 @@ private System.Windows.Forms.ToolStripMenuItem stopRecordToolStripMenuItem; private MyLabel lbl_logpercent; private System.Windows.Forms.ToolStripMenuItem pointCameraHereToolStripMenuItem; + private System.Windows.Forms.SplitContainer splitContainer1; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs index 705de52256..af2806bda9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs @@ -31,18 +31,33 @@ namespace ArdupilotMega.GCSViews RollingPointPairList list3 = new RollingPointPairList(1200); RollingPointPairList list4 = new RollingPointPairList(1200); RollingPointPairList list5 = new RollingPointPairList(1200); + RollingPointPairList list6 = new RollingPointPairList(1200); + RollingPointPairList list7 = new RollingPointPairList(1200); + RollingPointPairList list8 = new RollingPointPairList(1200); + RollingPointPairList list9 = new RollingPointPairList(1200); + RollingPointPairList list10 = new RollingPointPairList(1200); System.Reflection.PropertyInfo list1item = null; System.Reflection.PropertyInfo list2item = null; System.Reflection.PropertyInfo list3item = null; System.Reflection.PropertyInfo list4item = null; System.Reflection.PropertyInfo list5item = null; + System.Reflection.PropertyInfo list6item = null; + System.Reflection.PropertyInfo list7item = null; + System.Reflection.PropertyInfo list8item = null; + System.Reflection.PropertyInfo list9item = null; + System.Reflection.PropertyInfo list10item = null; CurveItem list1curve; CurveItem list2curve; CurveItem list3curve; CurveItem list4curve; CurveItem list5curve; + CurveItem list6curve; + CurveItem list7curve; + CurveItem list8curve; + CurveItem list9curve; + CurveItem list10curve; bool huddropout = false; bool huddropoutresize = false; @@ -77,10 +92,22 @@ namespace ArdupilotMega.GCSViews Control.CheckForIllegalCrossThreadCalls = false; // so can update display from another thread // setup default tuning graph - chk_box_CheckedChanged((object)(new CheckBox() { Name = "roll", Checked = true }), new EventArgs()); - chk_box_CheckedChanged((object)(new CheckBox() { Name = "pitch", Checked = true }), new EventArgs()); - chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_roll", Checked = true }), new EventArgs()); - chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_pitch", Checked = true }), new EventArgs()); + if (MainV2.config["Tuning_Graph_Selected"] != null) + { + string line = MainV2.config["Tuning_Graph_Selected"].ToString(); + string[] lines = line.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); + foreach (string option in lines) + { + chk_box_CheckedChanged((object)(new CheckBox() { Name = option, Checked = true }), new EventArgs()); + } + } + else + { + chk_box_CheckedChanged((object)(new CheckBox() { Name = "roll", Checked = true }), new EventArgs()); + chk_box_CheckedChanged((object)(new CheckBox() { Name = "pitch", Checked = true }), new EventArgs()); + chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_roll", Checked = true }), new EventArgs()); + chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_pitch", Checked = true }), new EventArgs()); + } List list = new List(); @@ -314,6 +341,16 @@ namespace ArdupilotMega.GCSViews list4.Add(time, (float)list4item.GetValue((object)MainV2.cs, null)); if (list5item != null) list5.Add(time, (float)list5item.GetValue((object)MainV2.cs, null)); + if (list6item != null) + list6.Add(time, (float)list6item.GetValue((object)MainV2.cs, null)); + if (list7item != null) + list7.Add(time, (float)list7item.GetValue((object)MainV2.cs, null)); + if (list8item != null) + list8.Add(time, (float)list8item.GetValue((object)MainV2.cs, null)); + if (list9item != null) + list9.Add(time, (float)list9item.GetValue((object)MainV2.cs, null)); + if (list10item != null) + list10.Add(time, (float)list10item.GetValue((object)MainV2.cs, null)); } if (tracklast.AddSeconds(1) < DateTime.Now) @@ -681,14 +718,14 @@ namespace ArdupilotMega.GCSViews { if (CB_tuning.Checked) { - gMapControl1.Visible = false; + splitContainer1.Panel1Collapsed = false; ZedGraphTimer.Enabled = true; ZedGraphTimer.Start(); zg1.Visible = true; } else { - gMapControl1.Visible = true; + splitContainer1.Panel1Collapsed = true; ZedGraphTimer.Enabled = false; ZedGraphTimer.Stop(); zg1.Visible = false; @@ -1203,6 +1240,8 @@ namespace ArdupilotMega.GCSViews return; } } + + } private void zg1_DoubleClick(object sender, EventArgs e) @@ -1210,7 +1249,7 @@ namespace ArdupilotMega.GCSViews Form selectform = new Form() { Name = "select", - Width = 650, + Width = 750, Height = 250, Text = "Graph This" }; @@ -1218,6 +1257,19 @@ namespace ArdupilotMega.GCSViews int x = 10; int y = 10; + { + CheckBox chk_box = new CheckBox(); + chk_box.Text = "Logarithmic"; + chk_box.Name = "Logarithmic"; + chk_box.Location = new Point(x, y); + chk_box.Size = new System.Drawing.Size(100, 20); + chk_box.CheckedChanged += new EventHandler(chk_log_CheckedChanged); + + selectform.Controls.Add(chk_box); + } + + y += 20; + object thisBoxed = MainV2.cs; Type test = thisBoxed.GetType(); @@ -1249,6 +1301,16 @@ namespace ArdupilotMega.GCSViews chk_box.Checked = true; if (list5item != null && list5item.Name == field.Name) chk_box.Checked = true; + if (list6item != null && list6item.Name == field.Name) + chk_box.Checked = true; + if (list7item != null && list7item.Name == field.Name) + chk_box.Checked = true; + if (list8item != null && list8item.Name == field.Name) + chk_box.Checked = true; + if (list9item != null && list9item.Name == field.Name) + chk_box.Checked = true; + if (list10item != null && list10item.Name == field.Name) + chk_box.Checked = true; chk_box.Text = field.Name; chk_box.Name = field.Name; @@ -1273,6 +1335,18 @@ namespace ArdupilotMega.GCSViews selectform.Show(); } + void chk_log_CheckedChanged(object sender, EventArgs e) + { + if (((CheckBox)sender).Checked) + { + zg1.GraphPane.YAxis.Type = AxisType.Log; + } + else + { + zg1.GraphPane.YAxis.Type = AxisType.Linear; + } + } + void chk_box_CheckedChanged(object sender, EventArgs e) { if (((CheckBox)sender).Checked) @@ -1302,12 +1376,55 @@ namespace ArdupilotMega.GCSViews setupPropertyInfo(ref list5item, ((CheckBox)sender).Name, MainV2.cs); list5curve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name, list5, Color.Yellow, SymbolType.None); } + else if (list6item == null) + { + setupPropertyInfo(ref list6item, ((CheckBox)sender).Name, MainV2.cs); + list6curve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name, list6, Color.Magenta, SymbolType.None); + } + else if (list7item == null) + { + setupPropertyInfo(ref list7item, ((CheckBox)sender).Name, MainV2.cs); + list7curve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name, list7, Color.Purple, SymbolType.None); + } + else if (list8item == null) + { + setupPropertyInfo(ref list8item, ((CheckBox)sender).Name, MainV2.cs); + list8curve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name, list8, Color.LimeGreen, SymbolType.None); + } + else if (list9item == null) + { + setupPropertyInfo(ref list9item, ((CheckBox)sender).Name, MainV2.cs); + list9curve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name, list9, Color.Cyan, SymbolType.None); + } + else if (list10item == null) + { + setupPropertyInfo(ref list10item, ((CheckBox)sender).Name, MainV2.cs); + list10curve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name, list10, Color.Violet, SymbolType.None); + } else { - MessageBox.Show("Max 5 at a time."); + MessageBox.Show("Max 10 at a time."); ((CheckBox)sender).Checked = false; } MainV2.fixtheme(this); + + string selected = ""; + try + { + selected = selected + zg1.GraphPane.CurveList[0].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[1].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[2].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[3].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[4].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[5].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[6].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[7].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[8].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[9].Label.Text + "|"; + selected = selected + zg1.GraphPane.CurveList[10].Label.Text + "|"; + } + catch { } + MainV2.config["Tuning_Graph_Selected"] = selected; } else { @@ -1336,6 +1453,31 @@ namespace ArdupilotMega.GCSViews { list5item = null; zg1.GraphPane.CurveList.Remove(list5curve); + } + if (list6item != null && list6item.Name == ((CheckBox)sender).Name) + { + list6item = null; + zg1.GraphPane.CurveList.Remove(list6curve); + } + if (list7item != null && list7item.Name == ((CheckBox)sender).Name) + { + list7item = null; + zg1.GraphPane.CurveList.Remove(list7curve); + } + if (list8item != null && list8item.Name == ((CheckBox)sender).Name) + { + list8item = null; + zg1.GraphPane.CurveList.Remove(list8curve); + } + if (list9item != null && list9item.Name == ((CheckBox)sender).Name) + { + list9item = null; + zg1.GraphPane.CurveList.Remove(list9curve); + } + if (list10item != null && list10item.Name == ((CheckBox)sender).Name) + { + list10item = null; + zg1.GraphPane.CurveList.Remove(list10curve); } } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx index d44ff71539..845fa8bfd8 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx @@ -134,7 +134,7 @@ Point Camera Here - 175, 70 + 175, 48 contextMenuStrip1 @@ -1083,290 +1083,68 @@ 360 + + Single + 1 - - Bottom, Left - - - NoControl - - - 10, 10 - - - 84, 13 - - - 13 - - - 0 - - - TXT_lat - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 0 - - - Bottom, Left - - - 438, 7 - - - 76, 20 - - - 69 - - - Change Zoom Level - - - Zoomlevel - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 1 - - - Bottom, Left - - - NoControl - - - 401, 10 - - - 34, 13 - - - 70 - - - Zoom - - - label1 - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 2 - - - Bottom, Left - - - NoControl - - - 100, 10 - - - 84, 13 - - - 14 - - - 0 - - - TXT_long - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 3 - - - Bottom, Left - - - NoControl - - - 190, 10 - - - 64, 13 - - - 15 - - - 0 - - - TXT_alt - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 4 - - - Bottom, Left - - - True - - - NoControl - - - 325, 10 - - - 70, 17 - - - 68 - - - Auto Pan - - - Makes the map autopan based on current location - - - CHK_autopan - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 5 - - - Bottom, Left - - - True - - - NoControl - - - 260, 9 - - - 59, 17 - - - 62 - - - Tuning - - - Show the tunning graph, chowing target attitudes vs actual - - - CB_tuning - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 6 - - + Fill - - 0, 429 + + 4, 4 - - 0, 0, 0, 0 + + Horizontal - - 585, 30 + + Fill - + + 0, 0 + + + 4, 4, 4, 4 + + + 577, 210 + + + 67 + + + False + + + zg1 + + + ZedGraph.ZedGraphControl, ZedGraph, Version=5.1.2.878, Culture=neutral, PublicKeyToken=02a83cbd123fcd60 + + + splitContainer1.Panel1 + + 0 - - panel1 + + splitContainer1.Panel1 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tableMap + + splitContainer1 - - 0 - - - NoControl - - - 7, 21 - - - 34, 13 - - - 69 - - - Vel: 0 - - - Estimated Wind Velocity - - - lbl_windvel - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel2 - - + 0 NoControl - 7, 8 + 4, 7 32, 13 @@ -1387,9 +1165,39 @@ ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - panel2 + splitContainer1.Panel2 + 0 + + + NoControl + + + 4, 20 + + + 34, 13 + + + 69 + + + Vel: 0 + + + Estimated Wind Velocity + + + lbl_windvel + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + splitContainer1.Panel2 + + 1 @@ -1402,7 +1210,7 @@ 0, 0, 0, 0 - 585, 429 + 577, 420 @@ -1559,66 +1367,288 @@ GMap.NET.WindowsForms.GMapControl, GMap.NET.WindowsForms, Version=1.5.5.5, Culture=neutral, PublicKeyToken=b85b9027b614afef - panel2 + splitContainer1.Panel2 2 - - Fill + + splitContainer1.Panel2 - - 0, 0 + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 4, 4, 4, 4 + + splitContainer1 - - 585, 429 - - - 67 - - - False - - - zg1 - - - ZedGraph.ZedGraphControl, ZedGraph, Version=5.1.2.878, Culture=neutral, PublicKeyToken=02a83cbd123fcd60 - - - panel2 - - - 3 - - - Fill - - - 0, 0 - - - 0, 0, 0, 0 - - - 585, 429 - - + 1 - - panel2 + + 577, 420 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 210 - + + 76 + + + splitContainer1 + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tableMap - + + 0 + + + Bottom, Left + + + NoControl + + + 10, 11 + + + 84, 13 + + + 13 + + + 0 + + + TXT_lat + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 0 + + + Bottom, Left + + + 438, 8 + + + 76, 20 + + + 69 + + + Change Zoom Level + + + Zoomlevel + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 1 + + + Bottom, Left + + + NoControl + + + 401, 11 + + + 34, 13 + + + 70 + + + Zoom + + + label1 + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 2 + + + Bottom, Left + + + NoControl + + + 100, 11 + + + 84, 13 + + + 14 + + + 0 + + + TXT_long + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 3 + + + Bottom, Left + + + NoControl + + + 190, 11 + + + 64, 13 + + + 15 + + + 0 + + + TXT_alt + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 4 + + + Bottom, Left + + + True + + + NoControl + + + 325, 11 + + + 70, 17 + + + 68 + + + Auto Pan + + + Makes the map autopan based on current location + + + CHK_autopan + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 5 + + + Bottom, Left + + + True + + + NoControl + + + 260, 10 + + + 59, 17 + + + 62 + + + Tuning + + + Show the tunning graph, chowing target attitudes vs actual + + + CB_tuning + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 6 + + + Fill + + + 1, 428 + + + 0, 0, 0, 0 + + + 583, 30 + + + 0 + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableMap + + 1 @@ -1649,7 +1679,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="panel1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="panel2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Percent,100,Absolute,30" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="splitContainer1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="panel1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Percent,100,Absolute,30,Absolute,20" /></TableLayoutSettings> MainH.Panel2 diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index f74f23eb8d..31a3bae5b3 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -277,7 +277,7 @@ namespace ArdupilotMega.GCSViews cell = Commands.Rows[selectedrow].Cells[1] as DataGridViewTextBoxCell; cell.Value = 0; } - if (Commands.Columns[Param2.Index].HeaderText.Equals(cmdParamNames[MAVLink.MAV_CMD.WAYPOINT][1]/*"Alt"*/)) + if (alt != -1 && Commands.Columns[Param2.Index].HeaderText.Equals(cmdParamNames[MAVLink.MAV_CMD.WAYPOINT][1]/*"Alt"*/)) { cell = Commands.Rows[selectedrow].Cells[2] as DataGridViewTextBoxCell; @@ -1719,7 +1719,7 @@ namespace ArdupilotMega.GCSViews } else { - callMeDrag(CurentRectMarker.InnerMarker.Tag.ToString(), currentMarker.Position.Lat, currentMarker.Position.Lng, 0); + callMeDrag(CurentRectMarker.InnerMarker.Tag.ToString(), currentMarker.Position.Lat, currentMarker.Position.Lng, -1); } CurentRectMarker = null; } diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs index 666c25b342..bb8034b729 100644 --- a/Tools/ArdupilotMegaPlanner/MainV2.cs +++ b/Tools/ArdupilotMegaPlanner/MainV2.cs @@ -66,10 +66,10 @@ namespace ArdupilotMega GCSViews.FlightData FlightData; GCSViews.FlightPlanner FlightPlanner; - //GCSViews.Configuration Configuration; + GCSViews.Configuration Configuration; GCSViews.Simulation Simulation; GCSViews.Firmware Firmware; - //GCSViews.Terminal Terminal; + GCSViews.Terminal Terminal; public MainV2() { @@ -221,6 +221,22 @@ namespace ArdupilotMega splash.Close(); } + internal void ScreenShot() + { + Rectangle bounds = Screen.GetBounds(Point.Empty); + using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) + { + using (Graphics g = Graphics.FromImage(bitmap)) + { + g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size); + } + string name = "ss" + DateTime.Now.ToString("hhmmss") + ".jpg"; + bitmap.Save(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + name, System.Drawing.Imaging.ImageFormat.Jpeg); + MessageBox.Show("Screenshot saved to " + name); + } + + } + private void CMB_serialport_Click(object sender, EventArgs e) { string oldport = CMB_serialport.Text; @@ -456,7 +472,19 @@ namespace ArdupilotMega GCSViews.Terminal.threadrun = false; - UserControl temp = new GCSViews.Configuration(); + // dispose of old else memory leak + if (Configuration != null) + { + try + { + Configuration.Dispose(); + } + catch { } + } + + Configuration = new GCSViews.Configuration(); + + UserControl temp = Configuration; temp.SuspendLayout(); @@ -633,6 +661,8 @@ namespace ArdupilotMega cs.firmware = APMFirmware; + config[CMB_serialport.Text + "_BAUD"] = CMB_baudrate.Text; + if (config["loadwpsonconnect"] != null && bool.Parse(config["loadwpsonconnect"].ToString()) == true) { MenuFlightPlanner_Click(null, null); @@ -697,6 +727,9 @@ namespace ArdupilotMega try { comPort.BaseStream.PortName = CMB_serialport.Text; + + if (config[CMB_serialport.Text + "_BAUD"] != null) + CMB_baudrate.Text = config[CMB_serialport.Text + "_BAUD"].ToString(); } catch { } } @@ -1557,6 +1590,11 @@ namespace ArdupilotMega frm.Show(); return true; } + if (keyData == (Keys.Control | Keys.S)) + { + ScreenShot(); + return true; + } if (keyData == (Keys.Control | Keys.G)) // test { Form frm = new SerialOutput(); diff --git a/Tools/ArdupilotMegaPlanner/MavlinkLog.cs b/Tools/ArdupilotMegaPlanner/MavlinkLog.cs index beffb588df..7be69fa57d 100644 --- a/Tools/ArdupilotMegaPlanner/MavlinkLog.cs +++ b/Tools/ArdupilotMegaPlanner/MavlinkLog.cs @@ -137,7 +137,7 @@ namespace ArdupilotMega flyto.Duration = (cs.datetime - lasttime).TotalMilliseconds / 1000.0; flyto.Mode = FlyToMode.Smooth; - Camera cam = new Camera(); + SharpKml.Dom.Camera cam = new SharpKml.Dom.Camera(); cam.AltitudeMode = SharpKml.Dom.AltitudeMode.Absolute; cam.Latitude = cs.lat; cam.Longitude = cs.lng; diff --git a/Tools/ArdupilotMegaPlanner/Program.cs b/Tools/ArdupilotMegaPlanner/Program.cs index f45c622cca..148f07202c 100644 --- a/Tools/ArdupilotMegaPlanner/Program.cs +++ b/Tools/ArdupilotMegaPlanner/Program.cs @@ -24,6 +24,7 @@ namespace ArdupilotMega Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + //Application.Run(new Camera()); Application.Run(new MainV2()); } diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index 1a89d7783d..f5bdf0e072 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.0.85")] +[assembly: AssemblyFileVersion("1.0.86")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj b/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj index 90999833b9..8b7bd960df 100644 --- a/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj +++ b/Tools/ArdupilotMegaPlanner/Updater/Updater.csproj @@ -53,7 +53,7 @@ - true + false mykey.pfx diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application index 95e40b4996..83424ad35a 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application +++ b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application @@ -11,7 +11,7 @@ - 3zgu5RT0ve/+QDoK+mKvNj+a14k= + FgyYFBDKA+EmX+ZazsEdbI/ME7o= diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/FlightData.resx b/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/FlightData.resx index d44ff71539..845fa8bfd8 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/FlightData.resx +++ b/Tools/ArdupilotMegaPlanner/bin/Release/GCSViews/FlightData.resx @@ -134,7 +134,7 @@ Point Camera Here - 175, 70 + 175, 48 contextMenuStrip1 @@ -1083,290 +1083,68 @@ 360 + + Single + 1 - - Bottom, Left - - - NoControl - - - 10, 10 - - - 84, 13 - - - 13 - - - 0 - - - TXT_lat - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 0 - - - Bottom, Left - - - 438, 7 - - - 76, 20 - - - 69 - - - Change Zoom Level - - - Zoomlevel - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 1 - - - Bottom, Left - - - NoControl - - - 401, 10 - - - 34, 13 - - - 70 - - - Zoom - - - label1 - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 2 - - - Bottom, Left - - - NoControl - - - 100, 10 - - - 84, 13 - - - 14 - - - 0 - - - TXT_long - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 3 - - - Bottom, Left - - - NoControl - - - 190, 10 - - - 64, 13 - - - 15 - - - 0 - - - TXT_alt - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel1 - - - 4 - - - Bottom, Left - - - True - - - NoControl - - - 325, 10 - - - 70, 17 - - - 68 - - - Auto Pan - - - Makes the map autopan based on current location - - - CHK_autopan - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 5 - - - Bottom, Left - - - True - - - NoControl - - - 260, 9 - - - 59, 17 - - - 62 - - - Tuning - - - Show the tunning graph, chowing target attitudes vs actual - - - CB_tuning - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 6 - - + Fill - - 0, 429 + + 4, 4 - - 0, 0, 0, 0 + + Horizontal - - 585, 30 + + Fill - + + 0, 0 + + + 4, 4, 4, 4 + + + 577, 210 + + + 67 + + + False + + + zg1 + + + ZedGraph.ZedGraphControl, ZedGraph, Version=5.1.2.878, Culture=neutral, PublicKeyToken=02a83cbd123fcd60 + + + splitContainer1.Panel1 + + 0 - - panel1 + + splitContainer1.Panel1 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tableMap + + splitContainer1 - - 0 - - - NoControl - - - 7, 21 - - - 34, 13 - - - 69 - - - Vel: 0 - - - Estimated Wind Velocity - - - lbl_windvel - - - ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - - - panel2 - - + 0 NoControl - 7, 8 + 4, 7 32, 13 @@ -1387,9 +1165,39 @@ ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c - panel2 + splitContainer1.Panel2 + 0 + + + NoControl + + + 4, 20 + + + 34, 13 + + + 69 + + + Vel: 0 + + + Estimated Wind Velocity + + + lbl_windvel + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + splitContainer1.Panel2 + + 1 @@ -1402,7 +1210,7 @@ 0, 0, 0, 0 - 585, 429 + 577, 420 @@ -1559,66 +1367,288 @@ GMap.NET.WindowsForms.GMapControl, GMap.NET.WindowsForms, Version=1.5.5.5, Culture=neutral, PublicKeyToken=b85b9027b614afef - panel2 + splitContainer1.Panel2 2 - - Fill + + splitContainer1.Panel2 - - 0, 0 + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 4, 4, 4, 4 + + splitContainer1 - - 585, 429 - - - 67 - - - False - - - zg1 - - - ZedGraph.ZedGraphControl, ZedGraph, Version=5.1.2.878, Culture=neutral, PublicKeyToken=02a83cbd123fcd60 - - - panel2 - - - 3 - - - Fill - - - 0, 0 - - - 0, 0, 0, 0 - - - 585, 429 - - + 1 - - panel2 + + 577, 420 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 210 - + + 76 + + + splitContainer1 + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tableMap - + + 0 + + + Bottom, Left + + + NoControl + + + 10, 11 + + + 84, 13 + + + 13 + + + 0 + + + TXT_lat + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 0 + + + Bottom, Left + + + 438, 8 + + + 76, 20 + + + 69 + + + Change Zoom Level + + + Zoomlevel + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 1 + + + Bottom, Left + + + NoControl + + + 401, 11 + + + 34, 13 + + + 70 + + + Zoom + + + label1 + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 2 + + + Bottom, Left + + + NoControl + + + 100, 11 + + + 84, 13 + + + 14 + + + 0 + + + TXT_long + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 3 + + + Bottom, Left + + + NoControl + + + 190, 11 + + + 64, 13 + + + 15 + + + 0 + + + TXT_alt + + + ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff91852278f5092c + + + panel1 + + + 4 + + + Bottom, Left + + + True + + + NoControl + + + 325, 11 + + + 70, 17 + + + 68 + + + Auto Pan + + + Makes the map autopan based on current location + + + CHK_autopan + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 5 + + + Bottom, Left + + + True + + + NoControl + + + 260, 10 + + + 59, 17 + + + 62 + + + Tuning + + + Show the tunning graph, chowing target attitudes vs actual + + + CB_tuning + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 6 + + + Fill + + + 1, 428 + + + 0, 0, 0, 0 + + + 583, 30 + + + 0 + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableMap + + 1 @@ -1649,7 +1679,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="panel1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="panel2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Percent,100,Absolute,30" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="splitContainer1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="panel1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Percent,100,Absolute,30,Absolute,20" /></TableLayoutSettings> MainH.Panel2