From 0c7bd8885edbb749d4a9ec236245e5f10d221f25 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Fri, 20 Jan 2012 12:07:23 +0800 Subject: [PATCH] APM Planner 1.1.23 firmware setup mod + extra cygwin dll zipped --- .../ArdupilotMegaPlanner/ArdupilotMega.csproj | 9 ++ .../Controls/XorPlus.Designer.cs | 112 ++++++++++++++++ .../ArdupilotMegaPlanner/Controls/XorPlus.cs | 48 +++++++ .../Controls/XorPlus.resx | 120 ++++++++++++++++++ .../ArdupilotMegaPlanner/GCSViews/Firmware.cs | 45 ++++++- .../GCSViews/FlightPlanner.cs | 7 +- Tools/ArdupilotMegaPlanner/Setup/Setup.resx | 78 ++++++------ 7 files changed, 372 insertions(+), 47 deletions(-) create mode 100644 Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs create mode 100644 Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs create mode 100644 Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index 0b97741b3f..93dc01bf8d 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -247,6 +247,12 @@ ImageLabel.cs + + Form + + + XorPlus.cs + Form @@ -420,6 +426,9 @@ ImageLabel.cs + + XorPlus.cs + Configuration.cs diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs new file mode 100644 index 0000000000..2a14e1fe1f --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.Designer.cs @@ -0,0 +1,112 @@ +namespace ArdupilotMega +{ + partial class XorPlus + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label16 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.pictureBoxQuadX = new System.Windows.Forms.PictureBox(); + this.pictureBoxQuad = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit(); + this.SuspendLayout(); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label16.Location = new System.Drawing.Point(108, 211); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(192, 26); + this.label16.TabIndex = 11; + this.label16.Text = "NOTE: images are for presentation only\r\nwill work with hexa\'s etc"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label15.Location = new System.Drawing.Point(151, 2); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(102, 13); + this.label15.TabIndex = 10; + this.label15.Text = "Frame Setup (+ or x)"; + // + // pictureBoxQuadX + // + this.pictureBoxQuadX.Cursor = System.Windows.Forms.Cursors.Hand; + this.pictureBoxQuadX.Image = global::ArdupilotMega.Properties.Resources.quadx; + this.pictureBoxQuadX.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBoxQuadX.Location = new System.Drawing.Point(210, 18); + this.pictureBoxQuadX.Name = "pictureBoxQuadX"; + this.pictureBoxQuadX.Size = new System.Drawing.Size(190, 190); + this.pictureBoxQuadX.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBoxQuadX.TabIndex = 9; + this.pictureBoxQuadX.TabStop = false; + this.pictureBoxQuadX.Click += new System.EventHandler(this.pictureBoxQuadX_Click); + // + // pictureBoxQuad + // + this.pictureBoxQuad.Cursor = System.Windows.Forms.Cursors.Hand; + this.pictureBoxQuad.Image = global::ArdupilotMega.Properties.Resources.quad; + this.pictureBoxQuad.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBoxQuad.Location = new System.Drawing.Point(3, 18); + this.pictureBoxQuad.Name = "pictureBoxQuad"; + this.pictureBoxQuad.Size = new System.Drawing.Size(190, 190); + this.pictureBoxQuad.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBoxQuad.TabIndex = 8; + this.pictureBoxQuad.TabStop = false; + this.pictureBoxQuad.Click += new System.EventHandler(this.pictureBoxQuad_Click); + // + // XorPlus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(404, 242); + this.Controls.Add(this.label16); + this.Controls.Add(this.label15); + this.Controls.Add(this.pictureBoxQuadX); + this.Controls.Add(this.pictureBoxQuad); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "XorPlus"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Frame Type"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.PictureBox pictureBoxQuadX; + private System.Windows.Forms.PictureBox pictureBoxQuad; + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs new file mode 100644 index 0000000000..98808fe432 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ArdupilotMega +{ + public partial class XorPlus : Form + { + public new event EventHandler Click; + + /// + /// either X or + + /// + public string frame = ""; + + public XorPlus() + { + InitializeComponent(); + } + + private void pictureBoxQuad_Click(object sender, EventArgs e) + { + frame = "+"; + if (Click != null) + { + Click(sender, new EventArgs()); + } + + this.Close(); + } + + private void pictureBoxQuadX_Click(object sender, EventArgs e) + { + frame = "X"; + if (Click != null) + { + Click(sender, new EventArgs()); + } + + this.Close(); + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/XorPlus.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/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index 388acb3c2c..7f61c9d4d0 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -410,7 +410,8 @@ namespace ArdupilotMega.GCSViews void findfirmware(string findwhat) { List items = new List(); - + + // build list foreach (software temp in softwares) { if (temp.url.ToLower().Contains(findwhat.ToLower())) @@ -419,12 +420,13 @@ namespace ArdupilotMega.GCSViews } } + // none found if (items.Count == 0) { MessageBox.Show("The requested firmware was not found."); return; } - else if (items.Count == 1) + else if (items.Count == 1) // 1 found so accept it { DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[0].name + "?", "Continue", MessageBoxButtons.YesNo); if (dr == System.Windows.Forms.DialogResult.Yes) @@ -433,18 +435,47 @@ namespace ArdupilotMega.GCSViews } return; } - else if (items.Count >= 2) + else if (items.Count == 2) { + XorPlus select = new XorPlus(); + MainV2.fixtheme(select); + select.ShowDialog(); + int a = 0; + + if (select.frame == "") + { + return; + } + foreach (software temp in items) { - DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[0].name + "?", "Continue", MessageBoxButtons.YesNo); - if (dr == System.Windows.Forms.DialogResult.Yes) + if (select.frame == "+" && temp.name.Contains("Plus")) { - update(items[0]); - return; + DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo); + if (dr == System.Windows.Forms.DialogResult.Yes) + { + update(items[a]); + return; + } } + else if (select.frame == "X" && temp.name.Contains("X")) + { + DialogResult dr = MessageBox.Show("Are you sure you want to upload " + items[a].name + "?", "Continue", MessageBoxButtons.YesNo); + if (dr == System.Windows.Forms.DialogResult.Yes) + { + update(items[a]); + return; + } + } + + a++; } } + else + { + MessageBox.Show("Something has gone wrong, to many firmware choices"); + return; + } } private void pictureBoxAPM_Click(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index e5881f7a69..aa129168c1 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -475,7 +475,7 @@ namespace ArdupilotMega.GCSViews // map center center = new GMapMarkerCross(MainMap.Position); - //top.Markers.Add(center); + top.Markers.Add(center); MainMap.Zoom = 3; @@ -939,9 +939,11 @@ namespace ArdupilotMega.GCSViews /// private void writeKML() { + // quickadd is for when loading wps from eeprom or file, to prevent slow, loading times if (quickadd) return; + // this is to share the current mission with the data tab pointlist = new List(); System.Diagnostics.Debug.WriteLine(DateTime.Now); @@ -952,6 +954,7 @@ namespace ArdupilotMega.GCSViews objects.Markers.Clear(); } + // process and add home to the list string home; if (TXT_homealt.Text != "" && TXT_homelat.Text != "" && TXT_homelng.Text != "") { @@ -967,6 +970,7 @@ namespace ArdupilotMega.GCSViews home = ""; } + // setup for centerpoint calc etc. double avglat = 0; double avglong = 0; double maxlat = -180; @@ -986,6 +990,7 @@ namespace ArdupilotMega.GCSViews int usable = 0; + // number rows System.Threading.Thread t1 = new System.Threading.Thread(delegate() { // thread for updateing row numbers diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.resx b/Tools/ArdupilotMegaPlanner/Setup/Setup.resx index 4e49f35f37..dc88bef1bc 100644 --- a/Tools/ArdupilotMegaPlanner/Setup/Setup.resx +++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.resx @@ -256,7 +256,7 @@ 3 - 21, 340 + 21, 349 409, 42 @@ -286,7 +286,7 @@ NoControl - 287, 158 + 287, 154 66, 17 @@ -316,7 +316,7 @@ NoControl - 315, 310 + 315, 306 66, 17 @@ -346,7 +346,7 @@ NoControl - 71, 158 + 71, 154 66, 17 @@ -514,7 +514,7 @@ 9 - 143, 61 + 143, 57 47, 211 @@ -535,7 +535,7 @@ 10 - 359, 61 + 359, 57 47, 211 @@ -556,7 +556,7 @@ 11 - 21, 304 + 21, 300 288, 23 @@ -1563,33 +1563,6 @@ 2 - - Zoom - - - NoControl - - - 78, 271 - - - 75, 75 - - - 29 - - - pictureBox2 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabHardware - - - 3 - True @@ -1618,7 +1591,7 @@ tabHardware - 4 + 3 NoControl @@ -1645,7 +1618,7 @@ tabHardware - 5 + 4 383, 57 @@ -1669,7 +1642,7 @@ tabHardware - 6 + 5 NoControl @@ -1696,7 +1669,7 @@ tabHardware - 7 + 6 NoControl @@ -1723,7 +1696,7 @@ tabHardware - 8 + 7 NoControl @@ -1750,6 +1723,33 @@ tabHardware + 8 + + + Zoom + + + NoControl + + + 78, 271 + + + 75, 75 + + + 29 + + + pictureBox2 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabHardware + + 9