From a5bd3c67c68b3c2e771dbee284d11822404887f9 Mon Sep 17 00:00:00 2001 From: Michael Oborne <mich146@hotmail.com> Date: Thu, 30 Aug 2012 20:51:29 +0800 Subject: [PATCH] Mission Planner 1.2.10 add useritems to HUD change hdop scale fix posible follow me bug (, vs .) fix posible friendly params bug (, vs .) tweak flightdata log playback timming fix gridv2 bug. if no waypoint had been done, the grid wold fail tweak some mission upload potential issues add ability to get param list from a log (from startup) add ability to get the first wp list in a log, if wps where received in that log. tweak video capture library timing --- Tools/ArdupilotMegaPlanner/Controls/HUD.cs | 37 +- .../Controls/QuickView.Designer.cs | 12 +- .../Controls/QuickView.cs | 13 +- Tools/ArdupilotMegaPlanner/CurrentState.cs | 2 +- Tools/ArdupilotMegaPlanner/FollowMe.cs | 5 +- .../ConfigurationView/ConfigFriendlyParams.cs | 2 +- .../GCSViews/FlightData.Designer.cs | 20 +- .../GCSViews/FlightData.cs | 179 ++++++++- .../GCSViews/FlightData.resx | 136 ++++--- .../GCSViews/FlightPlanner.cs | 11 +- Tools/ArdupilotMegaPlanner/MainV2.cs | 49 +-- Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs | 10 +- .../MavlinkLog.Designer.cs | 20 + Tools/ArdupilotMegaPlanner/MavlinkLog.cs | 144 +++++++ Tools/ArdupilotMegaPlanner/MavlinkLog.resx | 94 ++++- Tools/ArdupilotMegaPlanner/Msi/installer.wxs | 350 +++++++++--------- .../Properties/AssemblyInfo.cs | 2 +- .../ArdupilotMegaPlanner/Utilities/Capture.cs | 55 ++- .../Utilities/CaptureMJPEG.cs | 3 + Tools/ArdupilotMegaPlanner/temp.cs | 4 +- 20 files changed, 827 insertions(+), 321 deletions(-) diff --git a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs index 66b860065..33f1ae38e 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs @@ -7,7 +7,7 @@ using System.Text; using System.Windows.Forms; using System.IO; using System.Drawing.Imaging; - +using System.Collections; using System.Threading; using System.Drawing.Drawing2D; @@ -88,6 +88,7 @@ namespace ArdupilotMega.Controls float _airspeed = 0; float _targetspeed = 0; float _batterylevel = 0; + float _current = 0; float _batteryremaining = 0; float _gpsfix = 0; float _gpshdop = 0; @@ -128,6 +129,8 @@ namespace ArdupilotMega.Controls [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] public float batteryremaining { get { return _batteryremaining; } set { if (_batteryremaining != value) { _batteryremaining = value; this.Invalidate(); } } } [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] + public float current { get { return _current; } set { if (_current != value) { _current = value; this.Invalidate(); } } } + [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] public float gpsfix { get { return _gpsfix; } set { if (_gpsfix != value) { _gpsfix = value; this.Invalidate(); } } } [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] public float gpshdop { get { return _gpshdop; } set { if (_gpshdop != value) { _gpshdop = value; this.Invalidate(); } } } @@ -155,6 +158,17 @@ namespace ArdupilotMega.Controls [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")] public int status { get; set; } + + public struct Custom + { + //public Point Position; + //public float FontSize; + public string Header; + public System.Reflection.PropertyInfo Item; + public float GetValue { get { return (float)Item.GetValue((object)MainV2.cs, null); } } + } + + public Hashtable CustomItems = new Hashtable(); int statuslast = 0; DateTime armedtimer = DateTime.MinValue; @@ -353,8 +367,8 @@ namespace ArdupilotMega.Controls { countdate = DateTime.Now; Console.WriteLine("HUD " + count + " hz drawtime " + (huddrawtime / count) + " gl " + opengl); - if ((huddrawtime / count) > 1000) - opengl = false; + // if ((huddrawtime / count) > 1000) + // opengl = false; count = 0; huddrawtime = 0; @@ -1373,7 +1387,7 @@ namespace ArdupilotMega.Controls drawstring(graphicsObject, "Bat", font, fontsize + 2, whiteBrush, fontsize, this.Height - 30 - fontoffset); drawstring(graphicsObject, _batterylevel.ToString("0.00v"), font, fontsize + 2, whiteBrush, fontsize * 4, this.Height - 30 - fontoffset); - drawstring(graphicsObject, _batteryremaining.ToString("0%"), font, fontsize + 2, whiteBrush, fontsize * 9, this.Height - 30 - fontoffset); + drawstring(graphicsObject, _current.ToString("0 A"), font, fontsize + 2, whiteBrush, fontsize * 9, this.Height - 30 - fontoffset); } // gps @@ -1402,6 +1416,21 @@ namespace ArdupilotMega.Controls if (isNaN) drawstring(graphicsObject, "NaN Error " + DateTime.Now, font, this.Height / 30 + 10, Brushes.Red, 50, 50); + // custom user items + graphicsObject.ResetTransform(); + int height = this.Height - 30 - fontoffset - fontsize - 8; + foreach (string key in CustomItems.Keys) + { + try + { + Custom item = (Custom)CustomItems[key]; + drawstring(graphicsObject, item.Header + item.GetValue.ToString("0.##"), font, fontsize + 2, whiteBrush, this.Width / 8, height); + height -= fontsize+5; + } + catch { } + + } + if (!opengl) { diff --git a/Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs index 63a734a0c..38991fb95 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs @@ -36,22 +36,24 @@ // // labelWithPseudoOpacity1 // + this.labelWithPseudoOpacity1.AutoSize = true; this.labelWithPseudoOpacity1.Dock = System.Windows.Forms.DockStyle.Fill; this.labelWithPseudoOpacity1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelWithPseudoOpacity1.Location = new System.Drawing.Point(3, 0); this.labelWithPseudoOpacity1.Name = "labelWithPseudoOpacity1"; - this.labelWithPseudoOpacity1.Size = new System.Drawing.Size(161, 55); + this.labelWithPseudoOpacity1.Size = new System.Drawing.Size(161, 50); this.labelWithPseudoOpacity1.TabIndex = 0; this.labelWithPseudoOpacity1.Text = "Altitude:"; this.labelWithPseudoOpacity1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // labelWithPseudoOpacity2 // + this.labelWithPseudoOpacity2.AutoSize = true; this.labelWithPseudoOpacity2.Dock = System.Windows.Forms.DockStyle.Fill; this.labelWithPseudoOpacity2.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelWithPseudoOpacity2.Location = new System.Drawing.Point(170, 0); this.labelWithPseudoOpacity2.Name = "labelWithPseudoOpacity2"; - this.labelWithPseudoOpacity2.Size = new System.Drawing.Size(162, 55); + this.labelWithPseudoOpacity2.Size = new System.Drawing.Size(162, 50); this.labelWithPseudoOpacity2.TabIndex = 1; this.labelWithPseudoOpacity2.Text = "0.0"; this.labelWithPseudoOpacity2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -68,7 +70,7 @@ this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(335, 55); + this.tableLayoutPanel1.Size = new System.Drawing.Size(335, 50); this.tableLayoutPanel1.TabIndex = 2; // // QuickView @@ -76,9 +78,11 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.tableLayoutPanel1); + this.MinimumSize = new System.Drawing.Size(100, 27); this.Name = "QuickView"; - this.Size = new System.Drawing.Size(335, 55); + this.Size = new System.Drawing.Size(335, 50); this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } diff --git a/Tools/ArdupilotMegaPlanner/Controls/QuickView.cs b/Tools/ArdupilotMegaPlanner/Controls/QuickView.cs index 4d7d89fd0..78295aae7 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/QuickView.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/QuickView.cs @@ -12,11 +12,11 @@ namespace ArdupilotMega.Controls public partial class QuickView : UserControl { [System.ComponentModel.Browsable(true)] - public string desc { get { return labelWithPseudoOpacity1.Text; } set { labelWithPseudoOpacity1.Text = value; } } + public string desc { get { return labelWithPseudoOpacity1.Text; } set { if (labelWithPseudoOpacity1.Text == value) return; labelWithPseudoOpacity1.Text = value; } } [System.ComponentModel.Browsable(true)] - public string number { get { return labelWithPseudoOpacity2.Text; } set { labelWithPseudoOpacity2.Text = value; } } + public string number { get { return labelWithPseudoOpacity2.Text; } set { if (labelWithPseudoOpacity2.Text == value) return; labelWithPseudoOpacity2.Text = value; } } [System.ComponentModel.Browsable(true)] - public Color numberColor { get { return labelWithPseudoOpacity2.ForeColor; } set { labelWithPseudoOpacity2.ForeColor = value; } } + public Color numberColor { get { return labelWithPseudoOpacity2.ForeColor; } set { if (labelWithPseudoOpacity2.ForeColor == value) return; labelWithPseudoOpacity2.ForeColor = value; } } public QuickView() { @@ -54,5 +54,12 @@ namespace ArdupilotMega.Controls base.OnPaint(e); } + protected override void OnResize(EventArgs e) + { + if (this.Height > 20) + labelWithPseudoOpacity2.Font = new Font(labelWithPseudoOpacity2.Font.FontFamily, this.Height * 0.7f); + + base.OnResize(e); + } } } diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index b2a964f9b..8d921b06a 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -780,7 +780,7 @@ namespace ArdupilotMega gpsstatus = gps.fix_type; // Console.WriteLine("gpsfix {0}",gpsstatus); - gpshdop = (float)Math.Round((double)gps.eph / 10.0,2); + gpshdop = (float)Math.Round((double)gps.eph / 100.0,2); satcount = gps.satellites_visible; diff --git a/Tools/ArdupilotMegaPlanner/FollowMe.cs b/Tools/ArdupilotMegaPlanner/FollowMe.cs index 63e752589..f8f257ae8 100644 --- a/Tools/ArdupilotMegaPlanner/FollowMe.cs +++ b/Tools/ArdupilotMegaPlanner/FollowMe.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; using System.IO.Ports; +using System.Globalization; namespace ArdupilotMega { @@ -113,14 +114,14 @@ namespace ArdupilotMega continue; } - gotolocation.Lat = double.Parse(items[2]) / 100.0; + gotolocation.Lat = double.Parse(items[2], CultureInfo.InvariantCulture) / 100.0; gotolocation.Lat = (int)gotolocation.Lat + ((gotolocation.Lat - (int)gotolocation.Lat) / 0.60); if (items[3] == "S") gotolocation.Lat *= -1; - gotolocation.Lng = double.Parse(items[4]) / 100.0; + gotolocation.Lng = double.Parse(items[4], CultureInfo.InvariantCulture) / 100.0; gotolocation.Lng = (int)gotolocation.Lng + ((gotolocation.Lng - (int)gotolocation.Lng) / 0.60); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs index cf470e792..3e867c616 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs @@ -208,7 +208,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { bool controlAdded = false; - string value = ((float)MainV2.comPort.param[x.Key]).ToString("0.###"); + string value = ((float)MainV2.comPort.param[x.Key]).ToString("0.###", CultureInfo.InvariantCulture); string description = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Description); string displayName = x.Value + " (" + x.Key + ")"; string units = _parameterMetaDataRepository.GetParameterMetaData(x.Key, ParameterMetaDataConstants.Units); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs index d47d04106..244ce4bca 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.Designer.cs @@ -24,6 +24,7 @@ this.setMJPEGSourceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setAspectRatioToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayBatteryInfoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.userItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabQuick = new System.Windows.Forms.TabPage(); @@ -181,10 +182,12 @@ this.hud1.batterylevel = 0F; this.hud1.batteryremaining = 0F; this.hud1.ContextMenuStrip = this.contextMenuStrip2; + this.hud1.current = 0F; this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("airspeed", this.bindingSource1, "airspeed", true)); this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("alt", this.bindingSource1, "alt", true)); this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batterylevel", this.bindingSource1, "battery_voltage", true)); this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batteryremaining", this.bindingSource1, "battery_remaining", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("current", this.bindingSource1, "current", true)); this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("datetime", this.bindingSource1, "datetime", true)); this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("disttowp", this.bindingSource1, "wp_dist", true)); this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpsfix", this.bindingSource1, "gpsstatus", true)); @@ -244,7 +247,8 @@ this.stopRecordToolStripMenuItem, this.setMJPEGSourceToolStripMenuItem, this.setAspectRatioToolStripMenuItem, - this.displayBatteryInfoToolStripMenuItem}); + this.displayBatteryInfoToolStripMenuItem, + this.userItemsToolStripMenuItem}); this.contextMenuStrip2.Name = "contextMenuStrip2"; resources.ApplyResources(this.contextMenuStrip2, "contextMenuStrip2"); // @@ -278,6 +282,12 @@ resources.ApplyResources(this.displayBatteryInfoToolStripMenuItem, "displayBatteryInfoToolStripMenuItem"); this.displayBatteryInfoToolStripMenuItem.Click += new System.EventHandler(this.displayBatteryInfoToolStripMenuItem_Click); // + // userItemsToolStripMenuItem + // + this.userItemsToolStripMenuItem.Name = "userItemsToolStripMenuItem"; + resources.ApplyResources(this.userItemsToolStripMenuItem, "userItemsToolStripMenuItem"); + this.userItemsToolStripMenuItem.Click += new System.EventHandler(this.hud_UserItem); + // // bindingSource1 // this.bindingSource1.DataSource = typeof(ArdupilotMega.CurrentState); @@ -306,12 +316,14 @@ this.tabQuick.Controls.Add(this.quickView1); this.tabQuick.Name = "tabQuick"; this.tabQuick.UseVisualStyleBackColor = true; + this.tabQuick.Resize += new System.EventHandler(this.tabQuick_Resize); // // quickView6 // this.quickView6.DataBindings.Add(new System.Windows.Forms.Binding("number", this.bindingSource1, "DistToMAV", true)); this.quickView6.desc = "DistToMAV"; resources.ApplyResources(this.quickView6, "quickView6"); + this.quickView6.MinimumSize = new System.Drawing.Size(100, 27); this.quickView6.Name = "quickView6"; this.quickView6.number = "0.0"; this.quickView6.numberColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(252))))); @@ -322,6 +334,7 @@ this.quickView5.DataBindings.Add(new System.Windows.Forms.Binding("number", this.bindingSource1, "verticalspeed", true)); this.quickView5.desc = "verticalspeed"; resources.ApplyResources(this.quickView5, "quickView5"); + this.quickView5.MinimumSize = new System.Drawing.Size(100, 27); this.quickView5.Name = "quickView5"; this.quickView5.number = "0.0"; this.quickView5.numberColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(254)))), ((int)(((byte)(86))))); @@ -332,6 +345,7 @@ this.quickView4.DataBindings.Add(new System.Windows.Forms.Binding("number", this.bindingSource1, "yaw", true)); this.quickView4.desc = "yaw"; resources.ApplyResources(this.quickView4, "quickView4"); + this.quickView4.MinimumSize = new System.Drawing.Size(100, 27); this.quickView4.Name = "quickView4"; this.quickView4.number = "0.0"; this.quickView4.numberColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(83))))); @@ -342,6 +356,7 @@ this.quickView3.DataBindings.Add(new System.Windows.Forms.Binding("number", this.bindingSource1, "wp_dist", true)); this.quickView3.desc = "wp_dist"; resources.ApplyResources(this.quickView3, "quickView3"); + this.quickView3.MinimumSize = new System.Drawing.Size(100, 27); this.quickView3.Name = "quickView3"; this.quickView3.number = "0.0"; this.quickView3.numberColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(96)))), ((int)(((byte)(91))))); @@ -352,6 +367,7 @@ this.quickView2.DataBindings.Add(new System.Windows.Forms.Binding("number", this.bindingSource1, "groundspeed", true)); this.quickView2.desc = "groundspeed"; resources.ApplyResources(this.quickView2, "quickView2"); + this.quickView2.MinimumSize = new System.Drawing.Size(100, 27); this.quickView2.Name = "quickView2"; this.quickView2.number = "0.0"; this.quickView2.numberColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(132)))), ((int)(((byte)(46))))); @@ -362,6 +378,7 @@ this.quickView1.DataBindings.Add(new System.Windows.Forms.Binding("number", this.bindingSource1, "alt", true)); this.quickView1.desc = "alt"; resources.ApplyResources(this.quickView1, "quickView1"); + this.quickView1.MinimumSize = new System.Drawing.Size(100, 27); this.quickView1.Name = "quickView1"; this.quickView1.number = "0.0"; this.quickView1.numberColor = System.Drawing.Color.FromArgb(((int)(((byte)(209)))), ((int)(((byte)(151)))), ((int)(((byte)(248))))); @@ -1367,5 +1384,6 @@ private Controls.QuickView quickView5; private System.Windows.Forms.ToolStripMenuItem flyToHereAltToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem flightPlannerToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem userItemsToolStripMenuItem; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs index 95a5d309a..300bea53d 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs @@ -312,6 +312,12 @@ namespace ArdupilotMega.GCSViews DateTime waypoints = DateTime.Now.AddSeconds(0); + DateTime updatescreen = DateTime.Now; + + DateTime tsreal = DateTime.Now; + double taketime = 0; + double timeerror = 0; + //comPort.stopall(true); while (threadrun == 1) @@ -370,8 +376,6 @@ namespace ArdupilotMega.GCSViews { if (threadrun == 0) { return; } - updatePlayPauseButton(true); - if (comPort.BaseStream.IsOpen) { MainV2.comPort.logreadmode = false; @@ -379,6 +383,18 @@ namespace ArdupilotMega.GCSViews MainV2.comPort.logplaybackfile = null; } + + //Console.WriteLine(DateTime.Now.Millisecond); + + if (updatescreen.AddMilliseconds(300) < DateTime.Now) + { + updatePlayPauseButton(true); + updateLogPlayPosition(); + updatescreen = DateTime.Now; + } + + //Console.WriteLine(DateTime.Now.Millisecond + " done "); + DateTime logplayback = MainV2.comPort.lastlogread; try { @@ -386,23 +402,45 @@ namespace ArdupilotMega.GCSViews } catch { } - updateLogPlayPosition(); - - int act = (int)(MainV2.comPort.lastlogread - logplayback).TotalMilliseconds; + double act = (MainV2.comPort.lastlogread - logplayback).TotalMilliseconds; if (act > 9999 || act < 0) act = 0; - int ts = 0; + double ts = 0; if (LogPlayBackSpeed == 0) LogPlayBackSpeed = 0.01; try { - ts = (int) Math.Min((act / LogPlayBackSpeed),1000); + ts = Math.Min((act / LogPlayBackSpeed),1000); } catch { } - if (ts > 0) - System.Threading.Thread.Sleep(ts); + + double timetook = (DateTime.Now - tsreal).TotalMilliseconds; + if (timetook != 0) + { + //Console.WriteLine("took: " + timetook + "=" + taketime + " " + (taketime - timetook) + " " + ts); + //Console.WriteLine(MainV2.comPort.lastlogread.Second + " " + DateTime.Now.Second + " " + (MainV2.comPort.lastlogread.Second - DateTime.Now.Second)); + //if ((taketime - timetook) < 0) + { + timeerror += (taketime - timetook); + if (ts != 0) + { + ts += timeerror; + timeerror = 0; + } + } + if (ts > 1000) + ts = 1000; + } + + taketime = ts; + tsreal = DateTime.Now; + + if (ts > 0 && ts < 1000) + System.Threading.Thread.Sleep((int)ts); + + if (threadrun == 0) { return; } @@ -415,6 +453,8 @@ namespace ArdupilotMega.GCSViews tunning = DateTime.Now; } + + if (MainV2.comPort.logplaybackfile != null && MainV2.comPort.logplaybackfile.BaseStream.Position == MainV2.comPort.logplaybackfile.BaseStream.Length) { MainV2.comPort.logreadmode = false; @@ -437,9 +477,9 @@ namespace ArdupilotMega.GCSViews try { - //Console.WriteLine(DateTime.Now.Millisecond); + // Console.WriteLine(DateTime.Now.Millisecond); updateBindingSource(); - //Console.WriteLine(DateTime.Now.Millisecond + " done "); + // Console.WriteLine(DateTime.Now.Millisecond + " done "); if (ArdupilotMega.Controls.OpenGLtest.instance != null) { @@ -700,7 +740,7 @@ namespace ArdupilotMega.GCSViews try { gMapControl1.Position = currentloc; - hud1.Refresh(); + //hud1.Refresh(); } catch { } }); @@ -1548,6 +1588,17 @@ namespace ArdupilotMega.GCSViews // temp.Dispose(); // tabStatus.Controls.Remove(temp); } + + if (tabControl1.SelectedTab == tabQuick) + { + int height = tabQuick.Height / 6; + quickView1.Size = new System.Drawing.Size(tabQuick.Width, height); + quickView2.Size = new System.Drawing.Size(tabQuick.Width, height); + quickView3.Size = new System.Drawing.Size(tabQuick.Width, height); + quickView4.Size = new System.Drawing.Size(tabQuick.Width, height); + quickView5.Size = new System.Drawing.Size(tabQuick.Width, height); + quickView6.Size = new System.Drawing.Size(tabQuick.Width, height); + } } } @@ -1693,6 +1744,103 @@ namespace ArdupilotMega.GCSViews selectform.Show(); } + private void hud_UserItem(object sender, EventArgs e) + { + + Form selectform = new Form() + { + Name = "select", + Width = 50, + Height = 250, + Text = "Display This" + }; + + int x = 10; + int y = 10; + + object thisBoxed = MainV2.cs; + Type test = thisBoxed.GetType(); + + foreach (var field in test.GetProperties()) + { + // field.Name has the field's name. + object fieldValue; + try + { + fieldValue = field.GetValue(thisBoxed, null); // Get value + } + catch { continue; } + + // Get the TypeCode enumeration. Multiple types get mapped to a common typecode. + TypeCode typeCode = Type.GetTypeCode(fieldValue.GetType()); + + if (!(typeCode == TypeCode.Single)) + continue; + + CheckBox chk_box = new CheckBox(); + + chk_box.Text = field.Name; + chk_box.Name = field.Name; + chk_box.Tag = (sender); + chk_box.Location = new Point(x, y); + chk_box.Size = new System.Drawing.Size(100, 20); + if (hud1.CustomItems.ContainsKey(field.Name)) + { + chk_box.Checked = true; + } + + chk_box.CheckedChanged += chk_box_hud_UserItem_CheckedChanged; + + selectform.Controls.Add(chk_box); + + Application.DoEvents(); + + x += 0; + y += 20; + + if (y > selectform.Height - 50) + { + x += 100; + y = 10; + + selectform.Width = x + 100; + } + } + ThemeManager.ApplyThemeTo(selectform); + selectform.Show(); + } + + void chk_box_hud_UserItem_CheckedChanged(object sender, EventArgs e) + { + if (((CheckBox)sender).Checked) + { + HUD.Custom cust = new HUD.Custom(); + + string prefix = ((CheckBox)sender).Name +": "; + if (MainV2.config["hud1_useritem_" + ((CheckBox)sender).Name] != null) + prefix = (string)MainV2.config["hud1_useritem_" + ((CheckBox)sender).Name]; + + Common.InputBox("Header", "Please enter your item prefix", ref prefix); + + MainV2.config["hud1_useritem_" + ((CheckBox)sender).Name] = prefix; + + cust.Header = prefix; + setupPropertyInfo(ref cust.Item, ((CheckBox)sender).Name, MainV2.cs); + + hud1.CustomItems.Add(((CheckBox)sender).Name, cust); + + hud1.Invalidate(); + } + else + { + if (hud1.CustomItems.ContainsKey(((CheckBox)sender).Name)) + { + hud1.CustomItems.Remove(((CheckBox)sender).Name); + } + hud1.Invalidate(); + } + } + void chk_log_CheckedChanged(object sender, EventArgs e) { if (((CheckBox)sender).Checked) @@ -1974,7 +2122,7 @@ print 'Roll complete' "; - CustomMessageBox.Show("This is Very ALPHA"); + // CustomMessageBox.Show("This is Very ALPHA"); Form scriptedit = new Form(); @@ -2231,5 +2379,10 @@ print 'Roll complete' ctl.Visible = true; } } + + private void tabQuick_Resize(object sender, EventArgs e) + { + tabControl1_SelectedIndexChanged(null, null); + } } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx index 43060ba5b..a47e7e7ae 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx @@ -209,8 +209,14 @@ <data name="displayBatteryInfoToolStripMenuItem.Text" xml:space="preserve"> <value>Display Battery Info</value> </data> + <data name="userItemsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing"> + <value>176, 22</value> + </data> + <data name="userItemsToolStripMenuItem.Text" xml:space="preserve"> + <value>User Items</value> + </data> <data name="contextMenuStrip2.Size" type="System.Drawing.Size, System.Drawing"> - <value>177, 114</value> + <value>177, 158</value> </data> <data name=">>contextMenuStrip2.Name" xml:space="preserve"> <value>contextMenuStrip2</value> @@ -238,7 +244,7 @@ <value>hud1</value> </data> <data name=">>hud1.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>hud1.Parent" xml:space="preserve"> <value>SubMainLeft.Panel1</value> @@ -261,11 +267,14 @@ <data name="tabQuick.AutoScroll" type="System.Boolean, mscorlib"> <value>True</value> </data> + <data name="quickView6.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> + <value>Top</value> + </data> <data name="quickView6.Location" type="System.Drawing.Point, System.Drawing"> - <value>33, 272</value> + <value>3, 278</value> </data> <data name="quickView6.Size" type="System.Drawing.Size, System.Drawing"> - <value>335, 55</value> + <value>384, 55</value> </data> <data name="quickView6.TabIndex" type="System.Int32, mscorlib"> <value>5</value> @@ -274,7 +283,7 @@ <value>quickView6</value> </data> <data name=">>quickView6.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>quickView6.Parent" xml:space="preserve"> <value>tabQuick</value> @@ -282,11 +291,14 @@ <data name=">>quickView6.ZOrder" xml:space="preserve"> <value>0</value> </data> + <data name="quickView5.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> + <value>Top</value> + </data> <data name="quickView5.Location" type="System.Drawing.Point, System.Drawing"> - <value>33, 224</value> + <value>3, 223</value> </data> <data name="quickView5.Size" type="System.Drawing.Size, System.Drawing"> - <value>335, 55</value> + <value>384, 55</value> </data> <data name="quickView5.TabIndex" type="System.Int32, mscorlib"> <value>4</value> @@ -295,7 +307,7 @@ <value>quickView5</value> </data> <data name=">>quickView5.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>quickView5.Parent" xml:space="preserve"> <value>tabQuick</value> @@ -303,11 +315,14 @@ <data name=">>quickView5.ZOrder" xml:space="preserve"> <value>1</value> </data> + <data name="quickView4.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> + <value>Top</value> + </data> <data name="quickView4.Location" type="System.Drawing.Point, System.Drawing"> - <value>33, 168</value> + <value>3, 168</value> </data> <data name="quickView4.Size" type="System.Drawing.Size, System.Drawing"> - <value>335, 55</value> + <value>384, 55</value> </data> <data name="quickView4.TabIndex" type="System.Int32, mscorlib"> <value>3</value> @@ -316,7 +331,7 @@ <value>quickView4</value> </data> <data name=">>quickView4.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>quickView4.Parent" xml:space="preserve"> <value>tabQuick</value> @@ -324,11 +339,14 @@ <data name=">>quickView4.ZOrder" xml:space="preserve"> <value>2</value> </data> + <data name="quickView3.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> + <value>Top</value> + </data> <data name="quickView3.Location" type="System.Drawing.Point, System.Drawing"> - <value>33, 112</value> + <value>3, 113</value> </data> <data name="quickView3.Size" type="System.Drawing.Size, System.Drawing"> - <value>335, 55</value> + <value>384, 55</value> </data> <data name="quickView3.TabIndex" type="System.Int32, mscorlib"> <value>2</value> @@ -337,7 +355,7 @@ <value>quickView3</value> </data> <data name=">>quickView3.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>quickView3.Parent" xml:space="preserve"> <value>tabQuick</value> @@ -345,11 +363,14 @@ <data name=">>quickView3.ZOrder" xml:space="preserve"> <value>3</value> </data> + <data name="quickView2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> + <value>Top</value> + </data> <data name="quickView2.Location" type="System.Drawing.Point, System.Drawing"> - <value>33, 55</value> + <value>3, 58</value> </data> <data name="quickView2.Size" type="System.Drawing.Size, System.Drawing"> - <value>335, 55</value> + <value>384, 55</value> </data> <data name="quickView2.TabIndex" type="System.Int32, mscorlib"> <value>1</value> @@ -358,7 +379,7 @@ <value>quickView2</value> </data> <data name=">>quickView2.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>quickView2.Parent" xml:space="preserve"> <value>tabQuick</value> @@ -366,11 +387,14 @@ <data name=">>quickView2.ZOrder" xml:space="preserve"> <value>4</value> </data> + <data name="quickView1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> + <value>Top</value> + </data> <data name="quickView1.Location" type="System.Drawing.Point, System.Drawing"> - <value>33, 6</value> + <value>3, 3</value> </data> <data name="quickView1.Size" type="System.Drawing.Size, System.Drawing"> - <value>335, 55</value> + <value>384, 55</value> </data> <data name="quickView1.TabIndex" type="System.Int32, mscorlib"> <value>0</value> @@ -379,7 +403,7 @@ <value>quickView1</value> </data> <data name=">>quickView1.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.QuickView, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>quickView1.Parent" xml:space="preserve"> <value>tabQuick</value> @@ -433,7 +457,7 @@ <value>BUT_script</value> </data> <data name=">>BUT_script.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_script.Parent" xml:space="preserve"> <value>tabActions</value> @@ -466,7 +490,7 @@ <value>BUT_joystick</value> </data> <data name=">>BUT_joystick.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_joystick.Parent" xml:space="preserve"> <value>tabActions</value> @@ -496,7 +520,7 @@ <value>BUT_quickmanual</value> </data> <data name=">>BUT_quickmanual.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickmanual.Parent" xml:space="preserve"> <value>tabActions</value> @@ -526,7 +550,7 @@ <value>BUT_quickrtl</value> </data> <data name=">>BUT_quickrtl.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickrtl.Parent" xml:space="preserve"> <value>tabActions</value> @@ -556,7 +580,7 @@ <value>BUT_quickauto</value> </data> <data name=">>BUT_quickauto.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_quickauto.Parent" xml:space="preserve"> <value>tabActions</value> @@ -610,7 +634,7 @@ <value>BUT_setwp</value> </data> <data name=">>BUT_setwp.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_setwp.Parent" xml:space="preserve"> <value>tabActions</value> @@ -661,7 +685,7 @@ <value>BUT_setmode</value> </data> <data name=">>BUT_setmode.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_setmode.Parent" xml:space="preserve"> <value>tabActions</value> @@ -691,7 +715,7 @@ <value>BUT_clear_track</value> </data> <data name=">>BUT_clear_track.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_clear_track.Parent" xml:space="preserve"> <value>tabActions</value> @@ -742,7 +766,7 @@ <value>BUT_Homealt</value> </data> <data name=">>BUT_Homealt.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_Homealt.Parent" xml:space="preserve"> <value>tabActions</value> @@ -772,7 +796,7 @@ <value>BUT_RAWSensor</value> </data> <data name=">>BUT_RAWSensor.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_RAWSensor.Parent" xml:space="preserve"> <value>tabActions</value> @@ -802,7 +826,7 @@ <value>BUTrestartmission</value> </data> <data name=">>BUTrestartmission.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUTrestartmission.Parent" xml:space="preserve"> <value>tabActions</value> @@ -832,7 +856,7 @@ <value>BUTactiondo</value> </data> <data name=">>BUTactiondo.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUTactiondo.Parent" xml:space="preserve"> <value>tabActions</value> @@ -886,7 +910,7 @@ <value>Gvspeed</value> </data> <data name=">>Gvspeed.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gvspeed.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -916,7 +940,7 @@ <value>Gheading</value> </data> <data name=">>Gheading.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.HSI, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.HSI, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gheading.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -946,7 +970,7 @@ <value>Galt</value> </data> <data name=">>Galt.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Galt.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -979,7 +1003,7 @@ <value>Gspeed</value> </data> <data name=">>Gspeed.Type" xml:space="preserve"> - <value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>Gspeed.Parent" xml:space="preserve"> <value>tabGauges</value> @@ -1063,7 +1087,7 @@ <value>lbl_playbackspeed</value> </data> <data name=">>lbl_playbackspeed.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_playbackspeed.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1090,7 +1114,7 @@ <value>lbl_logpercent</value> </data> <data name=">>lbl_logpercent.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_logpercent.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1117,7 +1141,7 @@ <value>NUM_playbackspeed</value> </data> <data name=">>NUM_playbackspeed.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>NUM_playbackspeed.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1144,7 +1168,7 @@ <value>BUT_log2kml</value> </data> <data name=">>BUT_log2kml.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_log2kml.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1198,7 +1222,7 @@ <value>BUT_playlog</value> </data> <data name=">>BUT_playlog.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_playlog.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1225,7 +1249,7 @@ <value>BUT_loadtelem</value> </data> <data name=">>BUT_loadtelem.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_loadtelem.Parent" xml:space="preserve"> <value>tabTLogs</value> @@ -1411,7 +1435,7 @@ <value>lbl_winddir</value> </data> <data name=">>lbl_winddir.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_winddir.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1441,7 +1465,7 @@ <value>lbl_windvel</value> </data> <data name=">>lbl_windvel.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_windvel.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1474,7 +1498,7 @@ <value>lbl_hdop</value> </data> <data name=">>lbl_hdop.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_hdop.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1507,7 +1531,7 @@ <value>lbl_sats</value> </data> <data name=">>lbl_sats.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>lbl_sats.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1679,7 +1703,7 @@ <value>gMapControl1</value> </data> <data name=">>gMapControl1.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>gMapControl1.Parent" xml:space="preserve"> <value>splitContainer1.Panel2</value> @@ -1742,7 +1766,7 @@ <value>TXT_lat</value> </data> <data name=">>TXT_lat.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_lat.Parent" xml:space="preserve"> <value>panel1</value> @@ -1799,7 +1823,7 @@ <value>label1</value> </data> <data name=">>label1.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>label1.Parent" xml:space="preserve"> <value>panel1</value> @@ -1829,7 +1853,7 @@ <value>TXT_long</value> </data> <data name=">>TXT_long.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_long.Parent" xml:space="preserve"> <value>panel1</value> @@ -1859,7 +1883,7 @@ <value>TXT_alt</value> </data> <data name=">>TXT_alt.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>TXT_alt.Parent" xml:space="preserve"> <value>panel1</value> @@ -2060,7 +2084,7 @@ <value>label6</value> </data> <data name=">>label6.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>label6.Parent" xml:space="preserve"> <value>$this</value> @@ -2134,6 +2158,12 @@ <data name=">>displayBatteryInfoToolStripMenuItem.Type" xml:space="preserve"> <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </data> + <data name=">>userItemsToolStripMenuItem.Name" xml:space="preserve"> + <value>userItemsToolStripMenuItem</value> + </data> + <data name=">>userItemsToolStripMenuItem.Type" xml:space="preserve"> + <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> <data name=">>bindingSource1.Name" xml:space="preserve"> <value>bindingSource1</value> </data> @@ -2168,6 +2198,6 @@ <value>FlightData</value> </data> <data name=">>$this.Type" xml:space="preserve"> - <value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4621.15928, Culture=neutral, PublicKeyToken=null</value> + <value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4623.36046, Culture=neutral, PublicKeyToken=null</value> </data> </root> \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index 9037c4ef1..fc73679c7 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -348,6 +348,8 @@ namespace ArdupilotMega.GCSViews selectedrow = Commands.Rows.Add(); // Commands.CurrentCell = Commands.Rows[selectedrow].Cells[Param1.Index]; + ChangeColumnHeader(MAVLink.MAV_CMD.WAYPOINT.ToString()); + setfromGE(lat, lng, alt); } @@ -1362,7 +1364,9 @@ namespace ArdupilotMega.GCSViews temp.p4 = (float)(double.Parse(Commands.Rows[a].Cells[Param4.Index].Value.ToString())); MAVLink.MAV_MISSION_RESULT ans = port.setWP(temp, (ushort)(a + 1), frame, 0); - if (ans != MAVLink.MAV_MISSION_RESULT.MAV_MISSION_ACCEPTED) + // invalid sequence can only occur if we failed to see a responce from the apm when we sent the request. + // therefore it did see the request and has moved on that step, and so do we. + if (ans != MAVLink.MAV_MISSION_RESULT.MAV_MISSION_ACCEPTED && ans != MAVLink.MAV_MISSION_RESULT.MAV_MISSION_INVALID_SEQUENCE) { throw new Exception("Upload WPs Failed " + Commands.Rows[a].Cells[Command.Index].Value.ToString() + " " + Enum.Parse(typeof(MAVLink.MAV_MISSION_RESULT), ans.ToString())); } @@ -1509,7 +1513,10 @@ namespace ArdupilotMega.GCSViews CHK_holdalt.Checked = Convert.ToBoolean((float)param["ALT_HOLD_RTL"] > 0); log.Info("param ALT_HOLD_RTL " + CHK_holdalt.Checked.ToString()); + } + catch (Exception ex) { log.Error(ex); } + try { DataGridViewTextBoxCell cellhome; cellhome = Commands.Rows[0].Cells[Lat.Index] as DataGridViewTextBoxCell; @@ -1530,7 +1537,7 @@ namespace ArdupilotMega.GCSViews } } } - catch (Exception ex) { log.Info(ex.ToString()); } // if there is no valid home + catch (Exception ex) { log.Error(ex.ToString()); } // if there is no valid home if (Commands.RowCount > 0) { diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs index 5353948cf..73d9b5429 100644 --- a/Tools/ArdupilotMegaPlanner/MainV2.cs +++ b/Tools/ArdupilotMegaPlanner/MainV2.cs @@ -149,6 +149,8 @@ namespace ArdupilotMega public MainV2() { + log.Info("Mainv2 ctor"); + Form splash = new Splash(); splash.Show(); @@ -1010,7 +1012,7 @@ namespace ArdupilotMega /// speech voltage - custom - alt warning - data lost /// heartbeat packet sending /// - /// and cant fall out + /// and can't fall out /// </summary> private void SerialReader() { @@ -1018,10 +1020,7 @@ namespace ArdupilotMega return; serialThread = true; - int minbytes = 10; - - // if (MONO) - // minbytes = 0; + int minbytes = 0; DateTime speechcustomtime = DateTime.Now; @@ -1033,8 +1032,10 @@ namespace ArdupilotMega { Thread.Sleep(5); + // update connect/disconnect button and info stats UpdateConnectIcon(); + // 30 seconds interval speech options if (speechEnable && speechEngine != null && (DateTime.Now - speechcustomtime).TotalSeconds > 30 && MainV2.cs.lat != 0 && (MainV2.comPort.logreadmode || comPort.BaseStream.IsOpen)) { //speechbatteryvolt @@ -1054,6 +1055,7 @@ namespace ArdupilotMega speechcustomtime = DateTime.Now; } + // speech altitude warning. if (speechEnable && speechEngine != null && (MainV2.comPort.logreadmode || comPort.BaseStream.IsOpen)) { float warnalt = float.MaxValue; @@ -1069,17 +1071,20 @@ namespace ArdupilotMega catch { } // silent fail } + // if not connected or busy, sleep and loop if (!comPort.BaseStream.IsOpen || giveComport == true) { System.Threading.Thread.Sleep(100); continue; } + // make sure we attenuate the link quality if we dont see any valid packets if ((DateTime.Now - comPort.lastvalidpacket).TotalSeconds > 10) { MainV2.cs.linkqualitygcs = 0; } + // attenuate the link qualty over time if ((DateTime.Now - comPort.lastvalidpacket).TotalSeconds >= 1) { if (linkqualitytime.Second != DateTime.Now.Second) @@ -1087,25 +1092,20 @@ namespace ArdupilotMega MainV2.cs.linkqualitygcs = (ushort)(MainV2.cs.linkqualitygcs * 0.8f); linkqualitytime = DateTime.Now; + int checkthis; GCSViews.FlightData.myhud.Invalidate(); } } + // send a hb every seconds from gcs to ap if (heatbeatSend.Second != DateTime.Now.Second) { - // Console.WriteLine("remote lost {0}", cs.packetdropremote); - - MAVLink.mavlink_heartbeat_t htb = new MAVLink.mavlink_heartbeat_t(); - -#if MAVLINK10 - htb.type = (byte)MAVLink.MAV_TYPE.GCS; - htb.autopilot = (byte)MAVLink.MAV_AUTOPILOT.ARDUPILOTMEGA; - htb.mavlink_version = 3; -#else - htb.type = (byte)MAVLink.MAV_TYPE.MAV_GENERIC; - htb.autopilot = (byte)MAVLink.MAV_AUTOPILOT_TYPE.MAV_AUTOPILOT_ARDUPILOTMEGA; - htb.mavlink_version = 2; -#endif + MAVLink.mavlink_heartbeat_t htb = new MAVLink.mavlink_heartbeat_t() + { + type = (byte)MAVLink.MAV_TYPE.GCS, + autopilot = (byte)MAVLink.MAV_AUTOPILOT.ARDUPILOTMEGA, + mavlink_version = 3 + }; comPort.sendPacket(htb); heatbeatSend = DateTime.Now; @@ -1121,15 +1121,11 @@ namespace ArdupilotMega } } - // Console.WriteLine(DateTime.Now.Millisecond + " " + comPort.BaseStream.BytesToRead); - + // actauly read the packets while (comPort.BaseStream.BytesToRead > minbytes && giveComport == false) { - //Console.WriteLine(DateTime.Now.Millisecond + " SR1 " + comPort.BaseStream.BytesToRead ); comPort.readPacket(); - //Console.WriteLine(DateTime.Now.Millisecond + " SR2 " + comPort.BaseStream.BytesToRead); } - // Console.WriteLine("SR left"); } catch (Exception e) { @@ -1245,7 +1241,12 @@ namespace ArdupilotMega { if (!System.Diagnostics.Debugger.IsAttached) { - CheckForUpdate(); + // single update check per day + if (getConfig("update_check") != DateTime.Now.ToShortDateString()) + { + CheckForUpdate(); + config["update_check"] = DateTime.Now.ToShortDateString(); + } } } catch (Exception ex) diff --git a/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs b/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs index b1bd91266..c93f913a5 100644 --- a/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs @@ -1345,7 +1345,7 @@ namespace ArdupilotMega } else { - log.Info(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); } } } @@ -1919,21 +1919,13 @@ namespace ArdupilotMega #if MAVLINK10 if (buffer[5] == MAVLINK_MSG_ID_MISSION_ACK) { - - var ans = buffer.ByteArrayToStructure<mavlink_mission_ack_t>(6); - - log.Info("set wp " + index + " ACK 47 : " + buffer[5] + " ans " + Enum.Parse(typeof(MAV_MISSION_RESULT), ans.type.ToString())); return (MAV_MISSION_RESULT)ans.type; } else if (buffer[5] == MAVLINK_MSG_ID_MISSION_REQUEST) { var ans = buffer.ByteArrayToStructure<mavlink_mission_request_t>(6); - - - - if (ans.seq == (index + 1)) { log.Info("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]); diff --git a/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs b/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs index 256cde867..52243d5ca 100644 --- a/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/MavlinkLog.Designer.cs @@ -35,6 +35,8 @@ this.BUT_graphmavlog = new ArdupilotMega.Controls.MyButton(); this.zg1 = new ZedGraph.ZedGraphControl(); this.BUT_convertcsv = new ArdupilotMega.Controls.MyButton(); + this.BUT_paramsfromlog = new ArdupilotMega.Controls.MyButton(); + this.BUT_getwpsfromlog = new ArdupilotMega.Controls.MyButton(); this.SuspendLayout(); // // BUT_redokml @@ -82,10 +84,26 @@ this.BUT_convertcsv.UseVisualStyleBackColor = true; this.BUT_convertcsv.Click += new System.EventHandler(this.BUT_convertcsv_Click); // + // BUT_paramsfromlog + // + resources.ApplyResources(this.BUT_paramsfromlog, "BUT_paramsfromlog"); + this.BUT_paramsfromlog.Name = "BUT_paramsfromlog"; + this.BUT_paramsfromlog.UseVisualStyleBackColor = true; + this.BUT_paramsfromlog.Click += new System.EventHandler(this.BUT_paramsfromlog_Click); + // + // BUT_getwpsfromlog + // + resources.ApplyResources(this.BUT_getwpsfromlog, "BUT_getwpsfromlog"); + this.BUT_getwpsfromlog.Name = "BUT_getwpsfromlog"; + this.BUT_getwpsfromlog.UseVisualStyleBackColor = true; + this.BUT_getwpsfromlog.Click += new System.EventHandler(this.BUT_getwpsfromlog_Click); + // // MavlinkLog // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.BUT_getwpsfromlog); + this.Controls.Add(this.BUT_paramsfromlog); this.Controls.Add(this.BUT_convertcsv); this.Controls.Add(this.zg1); this.Controls.Add(this.BUT_graphmavlog); @@ -106,5 +124,7 @@ private ArdupilotMega.Controls.MyButton BUT_graphmavlog; private ZedGraph.ZedGraphControl zg1; private Controls.MyButton BUT_convertcsv; + private Controls.MyButton BUT_paramsfromlog; + private Controls.MyButton BUT_getwpsfromlog; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/MavlinkLog.cs b/Tools/ArdupilotMegaPlanner/MavlinkLog.cs index 1df89ba44..d9e947849 100644 --- a/Tools/ArdupilotMegaPlanner/MavlinkLog.cs +++ b/Tools/ArdupilotMegaPlanner/MavlinkLog.cs @@ -1245,5 +1245,149 @@ namespace ArdupilotMega } } } + + private void BUT_paramsfromlog_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog1 = new OpenFileDialog(); + openFileDialog1.Filter = "*.tlog|*.tlog"; + openFileDialog1.FilterIndex = 2; + openFileDialog1.RestoreDirectory = true; + openFileDialog1.Multiselect = true; + try + { + openFileDialog1.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar; + } + catch { } // incase dir doesnt exist + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + if (MainV2.comPort.logplaybackfile != null) + { + MainV2.comPort.logreadmode = false; + MainV2.comPort.logplaybackfile.Close(); + } + + foreach (string logfile in openFileDialog1.FileNames) + { + + MAVLink mine = new MAVLink(); + try + { + mine.logplaybackfile = new BinaryReader(File.Open(logfile, FileMode.Open, FileAccess.Read, FileShare.Read)); + } + catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } + + mine.logreadmode = true; + + mine.packets.Initialize(); // clear + + StreamWriter sw = new StreamWriter(Path.GetDirectoryName(logfile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(logfile) + ".param"); + + // bar moves to 100 % in this step + progressBar1.Value = (int)((float)mine.logplaybackfile.BaseStream.Position / (float)mine.logplaybackfile.BaseStream.Length * 100.0f / 1.0f); + + progressBar1.Refresh(); + //Application.DoEvents(); + + mine.getParamList(); + + foreach (string item in mine.param.Keys) + { + sw.WriteLine(item + "\t" + mine.param[item]); + } + + sw.Close(); + + progressBar1.Value = 100; + + mine.logreadmode = false; + mine.logplaybackfile.Close(); + mine.logplaybackfile = null; + + CustomMessageBox.Show("File Saved with log file"); + } + } + } + + private void BUT_getwpsfromlog_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog1 = new OpenFileDialog(); + openFileDialog1.Filter = "*.tlog|*.tlog"; + openFileDialog1.FilterIndex = 2; + openFileDialog1.RestoreDirectory = true; + openFileDialog1.Multiselect = true; + try + { + openFileDialog1.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar; + } + catch { } // incase dir doesnt exist + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + if (MainV2.comPort.logplaybackfile != null) + { + MainV2.comPort.logreadmode = false; + MainV2.comPort.logplaybackfile.Close(); + } + + foreach (string logfile in openFileDialog1.FileNames) + { + + MAVLink mine = new MAVLink(); + try + { + mine.logplaybackfile = new BinaryReader(File.Open(logfile, FileMode.Open, FileAccess.Read, FileShare.Read)); + } + catch (Exception ex) { log.Debug(ex.ToString()); CustomMessageBox.Show("Log Can not be opened. Are you still connected?"); return; } + + mine.logreadmode = true; + + mine.packets.Initialize(); // clear + + StreamWriter sw = new StreamWriter(Path.GetDirectoryName(logfile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(logfile) + ".txt"); + + // bar moves to 100 % in this step + progressBar1.Value = (int)((float)mine.logplaybackfile.BaseStream.Position / (float)mine.logplaybackfile.BaseStream.Length * 100.0f / 1.0f); + + progressBar1.Refresh(); + //Application.DoEvents(); + + sw.WriteLine("QGC WPL 110"); + + byte count = mine.getWPCount(); + for (ushort a = 0; a < count; a++) + { + Locationwp wp = mine.getWP(a); + //sw.WriteLine(item + "\t" + mine.param[item]); + byte mode = (byte)wp.id; + + sw.Write((a + 1)); // seq + sw.Write("\t" + 0); // current + sw.Write("\t" + (byte)MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT); //frame + sw.Write("\t" + mode); + sw.Write("\t" + wp.p1.ToString("0.000000", new System.Globalization.CultureInfo("en-US"))); + sw.Write("\t" + wp.p2.ToString("0.000000", new System.Globalization.CultureInfo("en-US"))); + sw.Write("\t" + wp.p3.ToString("0.000000", new System.Globalization.CultureInfo("en-US"))); + sw.Write("\t" + wp.p4.ToString("0.000000", new System.Globalization.CultureInfo("en-US"))); + sw.Write("\t" + wp.lat.ToString("0.000000", new System.Globalization.CultureInfo("en-US"))); + sw.Write("\t" + wp.lng.ToString("0.000000", new System.Globalization.CultureInfo("en-US"))); + sw.Write("\t" + (wp.alt / MainV2.cs.multiplierdist).ToString("0.000000", new System.Globalization.CultureInfo("en-US"))); + sw.Write("\t" + 1); + sw.WriteLine(""); + } + + sw.Close(); + + progressBar1.Value = 100; + + mine.logreadmode = false; + mine.logplaybackfile.Close(); + mine.logplaybackfile = null; + + CustomMessageBox.Show("File Saved with log file"); + + } + } + } } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/MavlinkLog.resx b/Tools/ArdupilotMegaPlanner/MavlinkLog.resx index 11b80999a..b72c69d08 100644 --- a/Tools/ArdupilotMegaPlanner/MavlinkLog.resx +++ b/Tools/ArdupilotMegaPlanner/MavlinkLog.resx @@ -123,10 +123,10 @@ </data> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="BUT_redokml.Location" type="System.Drawing.Point, System.Drawing"> - <value>93, 12</value> + <value>10, 6</value> </data> <data name="BUT_redokml.Size" type="System.Drawing.Size, System.Drawing"> - <value>116, 23</value> + <value>68, 30</value> </data> <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <data name="BUT_redokml.TabIndex" type="System.Int32, mscorlib"> @@ -139,13 +139,13 @@ <value>BUT_redokml</value> </data> <data name=">>BUT_redokml.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4515.21878, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4622.30215, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_redokml.Parent" xml:space="preserve"> <value>$this</value> </data> <data name=">>BUT_redokml.ZOrder" xml:space="preserve"> - <value>5</value> + <value>7</value> </data> <data name="progressBar1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Left, Right</value> @@ -169,7 +169,7 @@ <value>$this</value> </data> <data name=">>progressBar1.ZOrder" xml:space="preserve"> - <value>4</value> + <value>6</value> </data> <data name="BUT_humanreadable.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top</value> @@ -178,10 +178,10 @@ <value>NoControl</value> </data> <data name="BUT_humanreadable.Location" type="System.Drawing.Point, System.Drawing"> - <value>215, 12</value> + <value>84, 6</value> </data> <data name="BUT_humanreadable.Size" type="System.Drawing.Size, System.Drawing"> - <value>116, 23</value> + <value>68, 30</value> </data> <data name="BUT_humanreadable.TabIndex" type="System.Int32, mscorlib"> <value>10</value> @@ -193,13 +193,13 @@ <value>BUT_humanreadable</value> </data> <data name=">>BUT_humanreadable.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4515.21878, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4622.30215, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_humanreadable.Parent" xml:space="preserve"> <value>$this</value> </data> <data name=">>BUT_humanreadable.ZOrder" xml:space="preserve"> - <value>3</value> + <value>5</value> </data> <data name="BUT_graphmavlog.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top</value> @@ -208,10 +208,10 @@ <value>NoControl</value> </data> <data name="BUT_graphmavlog.Location" type="System.Drawing.Point, System.Drawing"> - <value>459, 12</value> + <value>232, 6</value> </data> <data name="BUT_graphmavlog.Size" type="System.Drawing.Size, System.Drawing"> - <value>116, 23</value> + <value>68, 30</value> </data> <data name="BUT_graphmavlog.TabIndex" type="System.Int32, mscorlib"> <value>11</value> @@ -223,13 +223,13 @@ <value>BUT_graphmavlog</value> </data> <data name=">>BUT_graphmavlog.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4515.21878, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4622.30215, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_graphmavlog.Parent" xml:space="preserve"> <value>$this</value> </data> <data name=">>BUT_graphmavlog.ZOrder" xml:space="preserve"> - <value>2</value> + <value>4</value> </data> <data name="zg1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Bottom, Left, Right</value> @@ -253,7 +253,7 @@ <value>$this</value> </data> <data name=">>zg1.ZOrder" xml:space="preserve"> - <value>1</value> + <value>3</value> </data> <data name="BUT_convertcsv.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top</value> @@ -262,10 +262,10 @@ <value>NoControl</value> </data> <data name="BUT_convertcsv.Location" type="System.Drawing.Point, System.Drawing"> - <value>337, 12</value> + <value>158, 6</value> </data> <data name="BUT_convertcsv.Size" type="System.Drawing.Size, System.Drawing"> - <value>116, 23</value> + <value>68, 30</value> </data> <data name="BUT_convertcsv.TabIndex" type="System.Int32, mscorlib"> <value>13</value> @@ -277,12 +277,72 @@ <value>BUT_convertcsv</value> </data> <data name=">>BUT_convertcsv.Type" xml:space="preserve"> - <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4515.21878, Culture=neutral, PublicKeyToken=null</value> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4622.30215, Culture=neutral, PublicKeyToken=null</value> </data> <data name=">>BUT_convertcsv.Parent" xml:space="preserve"> <value>$this</value> </data> <data name=">>BUT_convertcsv.ZOrder" xml:space="preserve"> + <value>2</value> + </data> + <data name="BUT_paramsfromlog.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> + <value>Top</value> + </data> + <data name="BUT_paramsfromlog.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> + <value>NoControl</value> + </data> + <data name="BUT_paramsfromlog.Location" type="System.Drawing.Point, System.Drawing"> + <value>306, 6</value> + </data> + <data name="BUT_paramsfromlog.Size" type="System.Drawing.Size, System.Drawing"> + <value>68, 30</value> + </data> + <data name="BUT_paramsfromlog.TabIndex" type="System.Int32, mscorlib"> + <value>14</value> + </data> + <data name="BUT_paramsfromlog.Text" xml:space="preserve"> + <value>Extract Params</value> + </data> + <data name=">>BUT_paramsfromlog.Name" xml:space="preserve"> + <value>BUT_paramsfromlog</value> + </data> + <data name=">>BUT_paramsfromlog.Type" xml:space="preserve"> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4622.30215, Culture=neutral, PublicKeyToken=null</value> + </data> + <data name=">>BUT_paramsfromlog.Parent" xml:space="preserve"> + <value>$this</value> + </data> + <data name=">>BUT_paramsfromlog.ZOrder" xml:space="preserve"> + <value>1</value> + </data> + <data name="BUT_getwpsfromlog.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> + <value>Top</value> + </data> + <data name="BUT_getwpsfromlog.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> + <value>NoControl</value> + </data> + <data name="BUT_getwpsfromlog.Location" type="System.Drawing.Point, System.Drawing"> + <value>380, 6</value> + </data> + <data name="BUT_getwpsfromlog.Size" type="System.Drawing.Size, System.Drawing"> + <value>68, 30</value> + </data> + <data name="BUT_getwpsfromlog.TabIndex" type="System.Int32, mscorlib"> + <value>15</value> + </data> + <data name="BUT_getwpsfromlog.Text" xml:space="preserve"> + <value>Extract WPs</value> + </data> + <data name=">>BUT_getwpsfromlog.Name" xml:space="preserve"> + <value>BUT_getwpsfromlog</value> + </data> + <data name=">>BUT_getwpsfromlog.Type" xml:space="preserve"> + <value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4622.30215, Culture=neutral, PublicKeyToken=null</value> + </data> + <data name=">>BUT_getwpsfromlog.Parent" xml:space="preserve"> + <value>$this</value> + </data> + <data name=">>BUT_getwpsfromlog.ZOrder" xml:space="preserve"> <value>0</value> </data> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> diff --git a/Tools/ArdupilotMegaPlanner/Msi/installer.wxs b/Tools/ArdupilotMegaPlanner/Msi/installer.wxs index 45acc75dc..1de47d2ad 100644 --- a/Tools/ArdupilotMegaPlanner/Msi/installer.wxs +++ b/Tools/ArdupilotMegaPlanner/Msi/installer.wxs @@ -2,14 +2,14 @@ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:difx="http://schemas.microsoft.com/wix/DifxAppExtension"> - <Product Id="*" Name="APM Planner" Language="1033" Version="1.2.8" Manufacturer="Michael Oborne" UpgradeCode="{625389D7-EB3C-4d77-A5F6-A285CF99437D}"> + <Product Id="*" Name="APM Planner" Language="1033" Version="1.2.9" Manufacturer="Michael Oborne" UpgradeCode="{625389D7-EB3C-4d77-A5F6-A285CF99437D}"> <Package Description="APM Planner Installer" Comments="Apm Planner Installer" Manufacturer="Michael Oborne" InstallerVersion="200" Compressed="yes" /> <Upgrade Id="{625389D7-EB3C-4d77-A5F6-A285CF99437D}"> - <UpgradeVersion OnlyDetect="yes" Minimum="1.2.8" Property="NEWERVERSIONDETECTED" IncludeMinimum="no" /> - <UpgradeVersion OnlyDetect="no" Maximum="1.2.8" Property="OLDERVERSIONBEINGUPGRADED" IncludeMaximum="no" /> + <UpgradeVersion OnlyDetect="yes" Minimum="1.2.9" Property="NEWERVERSIONDETECTED" IncludeMinimum="no" /> + <UpgradeVersion OnlyDetect="no" Maximum="1.2.9" Property="OLDERVERSIONBEINGUPGRADED" IncludeMaximum="no" /> </Upgrade> <InstallExecuteSequence> @@ -31,7 +31,7 @@ <Permission User="Everyone" GenericAll="yes" /> </CreateFolder> </Component> -<Component Id="_comp1" Guid="9ffca6e2-5272-4c99-a10a-fb99b0a2bc9e"> +<Component Id="_comp1" Guid="374bbf47-d390-441d-b3c3-bf96b2f204e4"> <File Id="_2" Source="..\bin\release\.gdbinit" /> <File Id="_3" Source="..\bin\release\.gitignore" /> <File Id="_4" Source="..\bin\release\aerosim3.91.txt" /> @@ -54,203 +54,205 @@ <File Id="_21" Source="..\bin\release\ArdupilotMegaPlanner10.exe.manifest" /> <File Id="_22" Source="..\bin\release\ArdupilotMegaPlanner10.pdb" /> <File Id="_23" Source="..\bin\release\ArduPlane-hil.exe" /> -<File Id="_24" Source="..\bin\release\block_plane_0.dae" /> -<File Id="_25" Source="..\bin\release\BSE.Windows.Forms.dll" /> -<File Id="_26" Source="..\bin\release\BSE.Windows.Forms.pdb" /> -<File Id="_27" Source="..\bin\release\BSE.Windows.Forms.xml" /> -<File Id="_28" Source="..\bin\release\Core.dll" /> -<File Id="_29" Source="..\bin\release\cygstdc++-6.dll" /> -<File Id="_30" Source="..\bin\release\cygwin1.dll" /> -<File Id="_31" Source="..\bin\release\dataflashlog.xml" /> -<File Id="_32" Source="..\bin\release\DirectShowLib-2005.dll" /> -<File Id="_33" Source="..\bin\release\eeprom.bin" /> -<File Id="_34" Source="..\bin\release\GMap.NET.Core.dll" /> -<File Id="_35" Source="..\bin\release\GMap.NET.Core.pdb" /> -<File Id="_36" Source="..\bin\release\GMap.NET.WindowsForms.dll" /> -<File Id="_37" Source="..\bin\release\GMap.NET.WindowsForms.pdb" /> -<File Id="_38" Source="..\bin\release\hud.html" /> -<File Id="_39" Source="..\bin\release\ICSharpCode.SharpZipLib.dll" /> -<File Id="_40" Source="..\bin\release\Ionic.Zip.Reduced.dll" /> -<File Id="_41" Source="..\bin\release\IronPython.dll" /> -<File Id="_42" Source="..\bin\release\IronPython.Modules.dll" /> -<File Id="_43" Source="..\bin\release\JSBSim.exe" /> -<File Id="_44" Source="..\bin\release\KMLib.dll" /> -<File Id="_45" Source="..\bin\release\log4net.dll" /> -<File Id="_46" Source="..\bin\release\mavcmd.xml" /> -<File Id="_47" Source="..\bin\release\MAVLink.xml" /> -<File Id="_48" Source="..\bin\release\MetaDataExtractor.dll" /> -<File Id="_49" Source="..\bin\release\Microsoft.DirectX.DirectInput.dll" /> -<File Id="_50" Source="..\bin\release\Microsoft.DirectX.dll" /> -<File Id="_51" Source="..\bin\release\Microsoft.Dynamic.dll" /> -<File Id="_52" Source="..\bin\release\Microsoft.Scripting.Core.dll" /> -<File Id="_53" Source="..\bin\release\Microsoft.Scripting.Debugging.dll" /> -<File Id="_54" Source="..\bin\release\Microsoft.Scripting.dll" /> -<File Id="_55" Source="..\bin\release\Microsoft.Scripting.ExtensionAttribute.dll" /> -<File Id="_56" Source="..\bin\release\netDxf.dll" /> -<File Id="_57" Source="..\bin\release\OpenTK.Compatibility.dll" /> -<File Id="_58" Source="..\bin\release\OpenTK.dll" /> -<File Id="_59" Source="..\bin\release\OpenTK.dll.config" /> -<File Id="_60" Source="..\bin\release\OpenTK.GLControl.dll" /> -<File Id="_61" Source="..\bin\release\ParameterMetaData.xml" /> -<File Id="_62" Source="..\bin\release\quadhil.xml" /> -<File Id="_63" Source="..\bin\release\runme" /> -<File Id="_64" Source="..\bin\release\serialsent.raw" /> -<File Id="_65" Source="..\bin\release\SharpKml.dll" /> -<File Id="_66" Source="..\bin\release\SharpKml.pdb" /> -<File Id="_67" Source="..\bin\release\SharpKml.xml" /> -<File Id="_68" Source="..\bin\release\System.Data.SQLite.dll" /> -<File Id="_69" Source="..\bin\release\System.Reactive.dll" /> -<File Id="_70" Source="..\bin\release\System.Reactive.xml" /> -<File Id="_71" Source="..\bin\release\System.Speech.dll" /> -<File Id="_72" Source="..\bin\release\Transitions.dll" /> -<File Id="_73" Source="..\bin\release\Updater.exe" /> -<File Id="_74" Source="..\bin\release\Updater.exe.config" /> -<File Id="_75" Source="..\bin\release\Updater.pdb" /> -<File Id="_76" Source="..\bin\release\version.exe" /> -<File Id="_77" Source="..\bin\release\version.txt" /> -<File Id="_78" Source="..\bin\release\ZedGraph.dll" /> +<File Id="_24" Source="..\bin\release\AStar.dll" /> +<File Id="_25" Source="..\bin\release\AStar.pdb" /> +<File Id="_26" Source="..\bin\release\block_plane_0.dae" /> +<File Id="_27" Source="..\bin\release\BSE.Windows.Forms.dll" /> +<File Id="_28" Source="..\bin\release\BSE.Windows.Forms.pdb" /> +<File Id="_29" Source="..\bin\release\BSE.Windows.Forms.xml" /> +<File Id="_30" Source="..\bin\release\Core.dll" /> +<File Id="_31" Source="..\bin\release\cygstdc++-6.dll" /> +<File Id="_32" Source="..\bin\release\cygwin1.dll" /> +<File Id="_33" Source="..\bin\release\dataflashlog.xml" /> +<File Id="_34" Source="..\bin\release\DirectShowLib-2005.dll" /> +<File Id="_35" Source="..\bin\release\eeprom.bin" /> +<File Id="_36" Source="..\bin\release\GMap.NET.Core.dll" /> +<File Id="_37" Source="..\bin\release\GMap.NET.Core.pdb" /> +<File Id="_38" Source="..\bin\release\GMap.NET.WindowsForms.dll" /> +<File Id="_39" Source="..\bin\release\GMap.NET.WindowsForms.pdb" /> +<File Id="_40" Source="..\bin\release\hud.html" /> +<File Id="_41" Source="..\bin\release\ICSharpCode.SharpZipLib.dll" /> +<File Id="_42" Source="..\bin\release\Ionic.Zip.Reduced.dll" /> +<File Id="_43" Source="..\bin\release\IronPython.dll" /> +<File Id="_44" Source="..\bin\release\IronPython.Modules.dll" /> +<File Id="_45" Source="..\bin\release\JSBSim.exe" /> +<File Id="_46" Source="..\bin\release\KMLib.dll" /> +<File Id="_47" Source="..\bin\release\log4net.dll" /> +<File Id="_48" Source="..\bin\release\mavcmd.xml" /> +<File Id="_49" Source="..\bin\release\MAVLink.xml" /> +<File Id="_50" Source="..\bin\release\MetaDataExtractor.dll" /> +<File Id="_51" Source="..\bin\release\Microsoft.DirectX.DirectInput.dll" /> +<File Id="_52" Source="..\bin\release\Microsoft.DirectX.dll" /> +<File Id="_53" Source="..\bin\release\Microsoft.Dynamic.dll" /> +<File Id="_54" Source="..\bin\release\Microsoft.Scripting.Core.dll" /> +<File Id="_55" Source="..\bin\release\Microsoft.Scripting.Debugging.dll" /> +<File Id="_56" Source="..\bin\release\Microsoft.Scripting.dll" /> +<File Id="_57" Source="..\bin\release\Microsoft.Scripting.ExtensionAttribute.dll" /> +<File Id="_58" Source="..\bin\release\netDxf.dll" /> +<File Id="_59" Source="..\bin\release\OpenTK.Compatibility.dll" /> +<File Id="_60" Source="..\bin\release\OpenTK.dll" /> +<File Id="_61" Source="..\bin\release\OpenTK.dll.config" /> +<File Id="_62" Source="..\bin\release\OpenTK.GLControl.dll" /> +<File Id="_63" Source="..\bin\release\ParameterMetaData.xml" /> +<File Id="_64" Source="..\bin\release\quadhil.xml" /> +<File Id="_65" Source="..\bin\release\runme" /> +<File Id="_66" Source="..\bin\release\serialsent.raw" /> +<File Id="_67" Source="..\bin\release\SharpKml.dll" /> +<File Id="_68" Source="..\bin\release\SharpKml.pdb" /> +<File Id="_69" Source="..\bin\release\SharpKml.xml" /> +<File Id="_70" Source="..\bin\release\System.Data.SQLite.dll" /> +<File Id="_71" Source="..\bin\release\System.Reactive.dll" /> +<File Id="_72" Source="..\bin\release\System.Reactive.xml" /> +<File Id="_73" Source="..\bin\release\System.Speech.dll" /> +<File Id="_74" Source="..\bin\release\Transitions.dll" /> +<File Id="_75" Source="..\bin\release\Updater.exe" /> +<File Id="_76" Source="..\bin\release\Updater.exe.config" /> +<File Id="_77" Source="..\bin\release\Updater.pdb" /> +<File Id="_78" Source="..\bin\release\version.exe" /> +<File Id="_79" Source="..\bin\release\version.txt" /> +<File Id="_80" Source="..\bin\release\ZedGraph.dll" /> </Component> -<Directory Id="aircraft78" Name="aircraft"> -<Component Id="_comp79" Guid="df6ce645-ec84-4f3e-a498-3c333976ab92"> -<File Id="_80" Source="..\bin\release\aircraft\placeholder.txt" /> +<Directory Id="aircraft80" Name="aircraft"> +<Component Id="_comp81" Guid="63a1bc0f-998e-4d82-95af-f794c0195bb7"> +<File Id="_82" Source="..\bin\release\aircraft\placeholder.txt" /> </Component> -<Directory Id="arducopter80" Name="arducopter"> -<Component Id="_comp81" Guid="4845bf66-01c9-4601-bee7-b226c8046bf4"> -<File Id="_82" Source="..\bin\release\aircraft\arducopter\arducopter-set.xml" /> -<File Id="_83" Source="..\bin\release\aircraft\arducopter\arducopter.jpg" /> -<File Id="_84" Source="..\bin\release\aircraft\arducopter\arducopter.xml" /> -<File Id="_85" Source="..\bin\release\aircraft\arducopter\initfile.xml" /> -<File Id="_86" Source="..\bin\release\aircraft\arducopter\plus_quad2-set.xml" /> -<File Id="_87" Source="..\bin\release\aircraft\arducopter\plus_quad2.xml" /> -<File Id="_88" Source="..\bin\release\aircraft\arducopter\quad.nas" /> -<File Id="_89" Source="..\bin\release\aircraft\arducopter\README" /> +<Directory Id="arducopter82" Name="arducopter"> +<Component Id="_comp83" Guid="0630f92e-f583-4937-af02-c4c2ab38049e"> +<File Id="_84" Source="..\bin\release\aircraft\arducopter\arducopter-set.xml" /> +<File Id="_85" Source="..\bin\release\aircraft\arducopter\arducopter.jpg" /> +<File Id="_86" Source="..\bin\release\aircraft\arducopter\arducopter.xml" /> +<File Id="_87" Source="..\bin\release\aircraft\arducopter\initfile.xml" /> +<File Id="_88" Source="..\bin\release\aircraft\arducopter\plus_quad2-set.xml" /> +<File Id="_89" Source="..\bin\release\aircraft\arducopter\plus_quad2.xml" /> +<File Id="_90" Source="..\bin\release\aircraft\arducopter\quad.nas" /> +<File Id="_91" Source="..\bin\release\aircraft\arducopter\README" /> </Component> -<Directory Id="data89" Name="data"> -<Component Id="_comp90" Guid="4bc20931-aa71-42f4-af95-8a4879d3b83e"> -<File Id="_91" Source="..\bin\release\aircraft\arducopter\data\arducopter_half_step.txt" /> -<File Id="_92" Source="..\bin\release\aircraft\arducopter\data\arducopter_step.txt" /> -<File Id="_93" Source="..\bin\release\aircraft\arducopter\data\rw_generic_pylon.ac" /> +<Directory Id="data91" Name="data"> +<Component Id="_comp92" Guid="acf4cb9c-693e-4307-a085-a83880478047"> +<File Id="_93" Source="..\bin\release\aircraft\arducopter\data\arducopter_half_step.txt" /> +<File Id="_94" Source="..\bin\release\aircraft\arducopter\data\arducopter_step.txt" /> +<File Id="_95" Source="..\bin\release\aircraft\arducopter\data\rw_generic_pylon.ac" /> </Component> </Directory> -<Directory Id="Engines93" Name="Engines"> -<Component Id="_comp94" Guid="4ad5527d-c704-460a-a4df-564a8707c9fd"> -<File Id="_95" Source="..\bin\release\aircraft\arducopter\Engines\a2830-12.xml" /> -<File Id="_96" Source="..\bin\release\aircraft\arducopter\Engines\prop10x4.5.xml" /> +<Directory Id="Engines95" Name="Engines"> +<Component Id="_comp96" Guid="03b81b85-ae7e-4b69-9f8b-8c2c187fdf7f"> +<File Id="_97" Source="..\bin\release\aircraft\arducopter\Engines\a2830-12.xml" /> +<File Id="_98" Source="..\bin\release\aircraft\arducopter\Engines\prop10x4.5.xml" /> </Component> </Directory> -<Directory Id="Models96" Name="Models"> -<Component Id="_comp97" Guid="35ef65d9-7ee3-4ed2-8a70-c9be8301d98b"> -<File Id="_98" Source="..\bin\release\aircraft\arducopter\Models\arducopter.ac" /> -<File Id="_99" Source="..\bin\release\aircraft\arducopter\Models\arducopter.xml" /> -<File Id="_100" Source="..\bin\release\aircraft\arducopter\Models\plus_quad.ac" /> -<File Id="_101" Source="..\bin\release\aircraft\arducopter\Models\plus_quad2.ac" /> -<File Id="_102" Source="..\bin\release\aircraft\arducopter\Models\plus_quad2.xml" /> -<File Id="_103" Source="..\bin\release\aircraft\arducopter\Models\quad.3ds" /> -<File Id="_104" Source="..\bin\release\aircraft\arducopter\Models\shareware_output.3ds" /> -<File Id="_105" Source="..\bin\release\aircraft\arducopter\Models\Untitled.ac" /> -<File Id="_106" Source="..\bin\release\aircraft\arducopter\Models\Y6_test.ac" /> +<Directory Id="Models98" Name="Models"> +<Component Id="_comp99" Guid="91c2026d-303f-4a5d-81a6-892f7a2a569f"> +<File Id="_100" Source="..\bin\release\aircraft\arducopter\Models\arducopter.ac" /> +<File Id="_101" Source="..\bin\release\aircraft\arducopter\Models\arducopter.xml" /> +<File Id="_102" Source="..\bin\release\aircraft\arducopter\Models\plus_quad.ac" /> +<File Id="_103" Source="..\bin\release\aircraft\arducopter\Models\plus_quad2.ac" /> +<File Id="_104" Source="..\bin\release\aircraft\arducopter\Models\plus_quad2.xml" /> +<File Id="_105" Source="..\bin\release\aircraft\arducopter\Models\quad.3ds" /> +<File Id="_106" Source="..\bin\release\aircraft\arducopter\Models\shareware_output.3ds" /> +<File Id="_107" Source="..\bin\release\aircraft\arducopter\Models\Untitled.ac" /> +<File Id="_108" Source="..\bin\release\aircraft\arducopter\Models\Y6_test.ac" /> </Component> </Directory> </Directory> -<Directory Id="Rascal106" Name="Rascal"> -<Component Id="_comp107" Guid="e12705ad-9a87-4402-8215-a1f516298b82"> -<File Id="_108" Source="..\bin\release\aircraft\Rascal\Rascal-keyboard.xml" /> -<File Id="_109" Source="..\bin\release\aircraft\Rascal\Rascal-submodels.xml" /> -<File Id="_110" Source="..\bin\release\aircraft\Rascal\Rascal.xml" /> -<File Id="_111" Source="..\bin\release\aircraft\Rascal\Rascal110-JSBSim-set.xml" /> -<File Id="_112" Source="..\bin\release\aircraft\Rascal\Rascal110-JSBSim.xml" /> -<File Id="_113" Source="..\bin\release\aircraft\Rascal\Rascal110-splash.rgb" /> -<File Id="_114" Source="..\bin\release\aircraft\Rascal\README.Rascal" /> -<File Id="_115" Source="..\bin\release\aircraft\Rascal\reset_CMAC.xml" /> -<File Id="_116" Source="..\bin\release\aircraft\Rascal\thumbnail.jpg" /> +<Directory Id="Rascal108" Name="Rascal"> +<Component Id="_comp109" Guid="291468a0-aa56-4839-a693-d18f08298aef"> +<File Id="_110" Source="..\bin\release\aircraft\Rascal\Rascal-keyboard.xml" /> +<File Id="_111" Source="..\bin\release\aircraft\Rascal\Rascal-submodels.xml" /> +<File Id="_112" Source="..\bin\release\aircraft\Rascal\Rascal.xml" /> +<File Id="_113" Source="..\bin\release\aircraft\Rascal\Rascal110-JSBSim-set.xml" /> +<File Id="_114" Source="..\bin\release\aircraft\Rascal\Rascal110-JSBSim.xml" /> +<File Id="_115" Source="..\bin\release\aircraft\Rascal\Rascal110-splash.rgb" /> +<File Id="_116" Source="..\bin\release\aircraft\Rascal\README.Rascal" /> +<File Id="_117" Source="..\bin\release\aircraft\Rascal\reset_CMAC.xml" /> +<File Id="_118" Source="..\bin\release\aircraft\Rascal\thumbnail.jpg" /> </Component> -<Directory Id="Engines116" Name="Engines"> -<Component Id="_comp117" Guid="54175779-45d8-4321-bb6a-d996f8e93a55"> -<File Id="_118" Source="..\bin\release\aircraft\Rascal\Engines\18x8.xml" /> -<File Id="_119" Source="..\bin\release\aircraft\Rascal\Engines\Zenoah_G-26A.xml" /> +<Directory Id="Engines118" Name="Engines"> +<Component Id="_comp119" Guid="96bd3719-1478-4a01-9634-0d7b8dbdd573"> +<File Id="_120" Source="..\bin\release\aircraft\Rascal\Engines\18x8.xml" /> +<File Id="_121" Source="..\bin\release\aircraft\Rascal\Engines\Zenoah_G-26A.xml" /> </Component> </Directory> -<Directory Id="Models119" Name="Models"> -<Component Id="_comp120" Guid="2d5f3c62-07d7-4bd4-9475-e65bdd47974d"> -<File Id="_121" Source="..\bin\release\aircraft\Rascal\Models\Rascal.rgb" /> -<File Id="_122" Source="..\bin\release\aircraft\Rascal\Models\Rascal110-000-013.ac" /> -<File Id="_123" Source="..\bin\release\aircraft\Rascal\Models\Rascal110.xml" /> -<File Id="_124" Source="..\bin\release\aircraft\Rascal\Models\smoke.png" /> -<File Id="_125" Source="..\bin\release\aircraft\Rascal\Models\smokeW.xml" /> -<File Id="_126" Source="..\bin\release\aircraft\Rascal\Models\Trajectory-Marker.ac" /> -<File Id="_127" Source="..\bin\release\aircraft\Rascal\Models\Trajectory-Marker.xml" /> +<Directory Id="Models121" Name="Models"> +<Component Id="_comp122" Guid="e63c75ad-ec68-4311-8757-e69263089e31"> +<File Id="_123" Source="..\bin\release\aircraft\Rascal\Models\Rascal.rgb" /> +<File Id="_124" Source="..\bin\release\aircraft\Rascal\Models\Rascal110-000-013.ac" /> +<File Id="_125" Source="..\bin\release\aircraft\Rascal\Models\Rascal110.xml" /> +<File Id="_126" Source="..\bin\release\aircraft\Rascal\Models\smoke.png" /> +<File Id="_127" Source="..\bin\release\aircraft\Rascal\Models\smokeW.xml" /> +<File Id="_128" Source="..\bin\release\aircraft\Rascal\Models\Trajectory-Marker.ac" /> +<File Id="_129" Source="..\bin\release\aircraft\Rascal\Models\Trajectory-Marker.xml" /> </Component> </Directory> -<Directory Id="Systems127" Name="Systems"> -<Component Id="_comp128" Guid="e3eafd18-aabe-42ad-9bd0-85abb070cc8b"> -<File Id="_129" Source="..\bin\release\aircraft\Rascal\Systems\110-autopilot.xml" /> -<File Id="_130" Source="..\bin\release\aircraft\Rascal\Systems\airdata.nas" /> -<File Id="_131" Source="..\bin\release\aircraft\Rascal\Systems\electrical.xml" /> -<File Id="_132" Source="..\bin\release\aircraft\Rascal\Systems\main.nas" /> -<File Id="_133" Source="..\bin\release\aircraft\Rascal\Systems\ugear.nas" /> +<Directory Id="Systems129" Name="Systems"> +<Component Id="_comp130" Guid="428f1bf2-7280-44df-ab87-46f9954c90b5"> +<File Id="_131" Source="..\bin\release\aircraft\Rascal\Systems\110-autopilot.xml" /> +<File Id="_132" Source="..\bin\release\aircraft\Rascal\Systems\airdata.nas" /> +<File Id="_133" Source="..\bin\release\aircraft\Rascal\Systems\electrical.xml" /> +<File Id="_134" Source="..\bin\release\aircraft\Rascal\Systems\main.nas" /> +<File Id="_135" Source="..\bin\release\aircraft\Rascal\Systems\ugear.nas" /> </Component> </Directory> </Directory> </Directory> -<Directory Id="Driver133" Name="Driver"> -<Component Id="_comp134" Guid="55169111-e676-4f85-b41c-a31db018ea72"> -<File Id="_135" Source="..\bin\release\Driver\Arduino MEGA 2560.inf" /> +<Directory Id="Driver135" Name="Driver"> +<Component Id="_comp136" Guid="cf4756cc-09a6-43ae-855e-dffc804a309c"> +<File Id="_137" Source="..\bin\release\Driver\Arduino MEGA 2560.inf" /> </Component> </Directory> -<Directory Id="es_ES135" Name="es-ES"> -<Component Id="_comp136" Guid="71eba501-12fa-4e9a-822d-86aa58b2948f"> -<File Id="_137" Source="..\bin\release\es-ES\ArdupilotMegaPlanner10.resources.dll" /> +<Directory Id="es_ES137" Name="es-ES"> +<Component Id="_comp138" Guid="8451bc36-e241-4895-905c-97fee9f3d429"> +<File Id="_139" Source="..\bin\release\es-ES\ArdupilotMegaPlanner10.resources.dll" /> </Component> </Directory> -<Directory Id="fr137" Name="fr"> -<Component Id="_comp138" Guid="4c38c69a-5d19-444c-8b1d-a06aeec16c70"> -<File Id="_139" Source="..\bin\release\fr\ArdupilotMegaPlanner10.resources.dll" /> +<Directory Id="fr139" Name="fr"> +<Component Id="_comp140" Guid="2d859ed3-675b-4d55-ac7e-e7988ae1ca41"> +<File Id="_141" Source="..\bin\release\fr\ArdupilotMegaPlanner10.resources.dll" /> </Component> </Directory> -<Directory Id="it_IT139" Name="it-IT"> -<Component Id="_comp140" Guid="987445fe-8357-4e16-86bb-2bbad83996bb"> -<File Id="_141" Source="..\bin\release\it-IT\ArdupilotMegaPlanner10.resources.dll" /> +<Directory Id="it_IT141" Name="it-IT"> +<Component Id="_comp142" Guid="01eff05b-9fbc-4ba1-9f06-254165878059"> +<File Id="_143" Source="..\bin\release\it-IT\ArdupilotMegaPlanner10.resources.dll" /> </Component> </Directory> -<Directory Id="jsbsim141" Name="jsbsim"> -<Component Id="_comp142" Guid="d50d8011-0236-494c-9081-b9b0127f6001"> -<File Id="_143" Source="..\bin\release\jsbsim\fgout.xml" /> -<File Id="_144" Source="..\bin\release\jsbsim\rascal_test.xml" /> +<Directory Id="jsbsim143" Name="jsbsim"> +<Component Id="_comp144" Guid="32e4a0b3-b855-42fd-915f-2b22d41e31db"> +<File Id="_145" Source="..\bin\release\jsbsim\fgout.xml" /> +<File Id="_146" Source="..\bin\release\jsbsim\rascal_test.xml" /> </Component> </Directory> -<Directory Id="m3u144" Name="m3u"> -<Component Id="_comp145" Guid="38eb3420-35be-4736-9089-ae935db0d957"> -<File Id="_146" Source="..\bin\release\m3u\both.m3u" /> -<File Id="_147" Source="..\bin\release\m3u\GeoRefnetworklink.kml" /> -<File Id="_148" Source="..\bin\release\m3u\hud.m3u" /> -<File Id="_149" Source="..\bin\release\m3u\map.m3u" /> -<File Id="_150" Source="..\bin\release\m3u\networklink.kml" /> +<Directory Id="m3u146" Name="m3u"> +<Component Id="_comp147" Guid="c1731c97-36b2-4118-a4e4-26dea45c9e87"> +<File Id="_148" Source="..\bin\release\m3u\both.m3u" /> +<File Id="_149" Source="..\bin\release\m3u\GeoRefnetworklink.kml" /> +<File Id="_150" Source="..\bin\release\m3u\hud.m3u" /> +<File Id="_151" Source="..\bin\release\m3u\map.m3u" /> +<File Id="_152" Source="..\bin\release\m3u\networklink.kml" /> </Component> </Directory> -<Directory Id="pl150" Name="pl"> -<Component Id="_comp151" Guid="0f77a481-bd50-477c-8e58-c88beb432150"> -<File Id="_152" Source="..\bin\release\pl\ArdupilotMegaPlanner10.resources.dll" /> +<Directory Id="pl152" Name="pl"> +<Component Id="_comp153" Guid="d20e0b51-89db-4829-9376-ac87eb0c014d"> +<File Id="_154" Source="..\bin\release\pl\ArdupilotMegaPlanner10.resources.dll" /> </Component> </Directory> -<Directory Id="Resources152" Name="Resources"> -<Component Id="_comp153" Guid="464dcaaa-af87-4e12-b682-adaf6fbafa27"> -<File Id="_154" Source="..\bin\release\Resources\MAVCmd.txt" /> -<File Id="_155" Source="..\bin\release\Resources\Welcome_to_Michael_Oborne.rtf" /> +<Directory Id="Resources154" Name="Resources"> +<Component Id="_comp155" Guid="bcb133d9-727d-4e80-8cfb-96e7c22f6b4e"> +<File Id="_156" Source="..\bin\release\Resources\MAVCmd.txt" /> +<File Id="_157" Source="..\bin\release\Resources\Welcome_to_Michael_Oborne.rtf" /> </Component> </Directory> -<Directory Id="ru_RU155" Name="ru-RU"> -<Component Id="_comp156" Guid="46cb98a1-f305-4671-9e8c-cc3b2c415753"> -<File Id="_157" Source="..\bin\release\ru-RU\ArdupilotMegaPlanner10.resources.dll" /> +<Directory Id="ru_RU157" Name="ru-RU"> +<Component Id="_comp158" Guid="04f82c03-bca7-4ea1-bf67-ae9580ff8de5"> +<File Id="_159" Source="..\bin\release\ru-RU\ArdupilotMegaPlanner10.resources.dll" /> </Component> </Directory> -<Directory Id="zh_Hans157" Name="zh-Hans"> -<Component Id="_comp158" Guid="8c95775f-5d01-48a4-8e9b-3e0453d3f9f3"> -<File Id="_159" Source="..\bin\release\zh-Hans\ArdupilotMegaPlanner10.resources.dll" /> +<Directory Id="zh_Hans159" Name="zh-Hans"> +<Component Id="_comp160" Guid="11eadd21-3f68-4184-9d9b-cd73889e38b7"> +<File Id="_161" Source="..\bin\release\zh-Hans\ArdupilotMegaPlanner10.resources.dll" /> </Component> </Directory> -<Directory Id="zh_TW159" Name="zh-TW"> -<Component Id="_comp160" Guid="5f9fc027-04e8-418a-9b5b-bc6d3046681b"> -<File Id="_161" Source="..\bin\release\zh-TW\ArdupilotMegaPlanner10.resources.dll" /> +<Directory Id="zh_TW161" Name="zh-TW"> +<Component Id="_comp162" Guid="d334ccf7-6290-4a4f-a6fd-55727721ef7a"> +<File Id="_163" Source="..\bin\release\zh-TW\ArdupilotMegaPlanner10.resources.dll" /> </Component> </Directory> @@ -294,26 +296,26 @@ <ComponentRef Id="InstallDirPermissions" /> <ComponentRef Id="_comp1" /> -<ComponentRef Id="_comp79" /> <ComponentRef Id="_comp81" /> -<ComponentRef Id="_comp90" /> -<ComponentRef Id="_comp94" /> -<ComponentRef Id="_comp97" /> -<ComponentRef Id="_comp107" /> -<ComponentRef Id="_comp117" /> -<ComponentRef Id="_comp120" /> -<ComponentRef Id="_comp128" /> -<ComponentRef Id="_comp134" /> +<ComponentRef Id="_comp83" /> +<ComponentRef Id="_comp92" /> +<ComponentRef Id="_comp96" /> +<ComponentRef Id="_comp99" /> +<ComponentRef Id="_comp109" /> +<ComponentRef Id="_comp119" /> +<ComponentRef Id="_comp122" /> +<ComponentRef Id="_comp130" /> <ComponentRef Id="_comp136" /> <ComponentRef Id="_comp138" /> <ComponentRef Id="_comp140" /> <ComponentRef Id="_comp142" /> -<ComponentRef Id="_comp145" /> -<ComponentRef Id="_comp151" /> +<ComponentRef Id="_comp144" /> +<ComponentRef Id="_comp147" /> <ComponentRef Id="_comp153" /> -<ComponentRef Id="_comp156" /> +<ComponentRef Id="_comp155" /> <ComponentRef Id="_comp158" /> <ComponentRef Id="_comp160" /> +<ComponentRef Id="_comp162" /> <ComponentRef Id="ApplicationShortcut" /> diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index 49216dd91..73d7f09fb 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs +++ b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ using System.Resources; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.*")] -[assembly: AssemblyFileVersion("1.2.9")] +[assembly: AssemblyFileVersion("1.2.10")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Utilities/Capture.cs b/Tools/ArdupilotMegaPlanner/Utilities/Capture.cs index 6d721dea6..e977a150a 100644 --- a/Tools/ArdupilotMegaPlanner/Utilities/Capture.cs +++ b/Tools/ArdupilotMegaPlanner/Utilities/Capture.cs @@ -50,7 +50,7 @@ namespace WebCamService IntPtr ip = IntPtr.Zero; public event CamImage camimage; - System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer(); + Thread timer1; #endregion @@ -88,8 +88,12 @@ namespace WebCamService m_bGotOne = true; m_bRunning = false; - timer1.Interval = 1000 / 15; // 15 fps - timer1.Tick += new EventHandler(timer1_Tick); + //timer1.Interval = 1000 / 15; // 15 fps + //timer1.Tick += new EventHandler(timer1_Tick); + //timer1.Start(); + + timer1 = new Thread(timer); + timer1.IsBackground = true; timer1.Start(); } @@ -99,10 +103,37 @@ namespace WebCamService throw; } } + + void timer() + { + DateTime last = DateTime.Now; + + while (true) + { + try + { + System.Threading.Thread.Sleep(1000/25); // 25 fps + + timer1_Tick(this, null); + + } + catch (ThreadAbortException) + { + break; + } + catch + { + + } + } + } + /// <summary> release everything. </summary> public void Dispose() { - timer1.Stop(); + if (timer1 != null) + timer1.Abort(); + if (camimage != null) { camimage(null); // clear last pic @@ -159,7 +190,7 @@ namespace WebCamService // Start waiting if ( ! m_PictureReady.WaitOne(5000, false) ) { - throw new Exception("Timeout waiting to get picture"); + //throw new Exception("Timeout waiting to get picture"); } //Pause(); //- we are effectivly pulling at 15 fps, so no need to pause } @@ -224,8 +255,8 @@ namespace WebCamService { camimage(image); } - } - catch { Console.WriteLine("Grab bmp failed"); timer1.Enabled = false; this.CloseInterfaces(); System.Windows.Forms.CustomMessageBox.Show("Problem with capture device, grabbing frame took longer than 5 sec"); } + }//System.Windows.Forms.CustomMessageBox.Show("Problem with capture device, grabbing frame took longer than 5 sec"); + catch { Console.WriteLine("Grab bmp failed"); } } /// <summary> build the capture graph for grabber. </summary> @@ -404,8 +435,14 @@ namespace WebCamService } // Set the new format - hr = videoStreamConfig.SetFormat( media ); - DsError.ThrowExceptionForHR( hr ); + try + { + hr = videoStreamConfig.SetFormat(media); + } + catch { } + + DsError.ThrowExceptionForHR(hr); + DsUtils.FreeAMMediaType(media); media = null; diff --git a/Tools/ArdupilotMegaPlanner/Utilities/CaptureMJPEG.cs b/Tools/ArdupilotMegaPlanner/Utilities/CaptureMJPEG.cs index 915a4c950..477867c59 100644 --- a/Tools/ArdupilotMegaPlanner/Utilities/CaptureMJPEG.cs +++ b/Tools/ArdupilotMegaPlanner/Utilities/CaptureMJPEG.cs @@ -110,6 +110,9 @@ namespace ArdupilotMega.Utilities mpheader = mpheader.Substring(startboundary, endboundary - startboundary); } + dataStream.ReadTimeout = 30000; // 30 seconds + br.BaseStream.ReadTimeout = 30000; + while (running) { try diff --git a/Tools/ArdupilotMegaPlanner/temp.cs b/Tools/ArdupilotMegaPlanner/temp.cs index 8df60453f..1686e1447 100644 --- a/Tools/ArdupilotMegaPlanner/temp.cs +++ b/Tools/ArdupilotMegaPlanner/temp.cs @@ -903,8 +903,6 @@ namespace ArdupilotMega private void myButton1_Click(object sender, EventArgs e) { new SerialOutput2().Show(); - } - - + } } } -- GitLab