From daa5cfd02aa3775558a0b8bb00bd4515ccbf0d83 Mon Sep 17 00:00:00 2001 From: Matthew Clarke Date: Thu, 26 Oct 2023 10:50:15 +0200 Subject: [PATCH 1/2] New Feature: Fuel gauge bar on HUD, accessible via the contextMenuStrip of the HUD. The user can set the size of the fuel tank of the vehicle connected and set the amount of fuel that is added into the fuel tank. The fuel remaining is calculated using the EFI fuel consumed value and is calculated into millilitres from grams. --- GCSViews/FlightData.Designer.cs | 174 +++++--- GCSViews/FlightData.cs | 763 +++++++++++++++++++++++++++++++- GCSViews/FlightData.resx | 232 +++++----- 3 files changed, 986 insertions(+), 183 deletions(-) diff --git a/GCSViews/FlightData.Designer.cs b/GCSViews/FlightData.Designer.cs index 6e052b0177..a94f66bc2f 100644 --- a/GCSViews/FlightData.Designer.cs +++ b/GCSViews/FlightData.Designer.cs @@ -201,6 +201,7 @@ private void InitializeComponent() this.setHomeHereToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.takeOffToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.onOffCameraOverlapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.jumpToTagToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.but_disablejoystick = new MissionPlanner.Controls.MyButton(); this.distanceBar1 = new MissionPlanner.Controls.DistanceBar(); this.windDir1 = new MissionPlanner.Controls.WindDir(); @@ -225,7 +226,7 @@ private void InitializeComponent() this.scriptChecker = new System.Windows.Forms.Timer(this.components); this.Messagetabtimer = new System.Windows.Forms.Timer(this.components); this.bindingSourceStatusTab = new System.Windows.Forms.BindingSource(this.components); - this.jumpToTagToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.FuelGaugeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.MainH)).BeginInit(); this.MainH.Panel1.SuspendLayout(); this.MainH.Panel2.SuspendLayout(); @@ -323,6 +324,7 @@ private void InitializeComponent() this.hud1.batterycellcount = 4; this.hud1.batterylevel = 0F; this.hud1.batterylevel2 = 0F; + this.hud1.batteryon2 = true; this.hud1.batteryremaining = 0F; this.hud1.batteryremaining2 = 0F; this.hud1.bgimage = null; @@ -333,52 +335,52 @@ private void InitializeComponent() this.hud1.critSSA = 30F; this.hud1.current = 0F; this.hud1.current2 = 0F; - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("airspeed", this.bindingSourceHud, "airspeed", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("alt", this.bindingSourceHud, "alt", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("load", this.bindingSourceHud, "load", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batterylevel", this.bindingSourceHud, "battery_voltage", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batteryremaining", this.bindingSourceHud, "battery_remaining", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("connected", this.bindingSourceHud, "connected", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("current", this.bindingSourceHud, "current", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batterylevel2", this.bindingSourceHud, "battery_voltage2", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batteryremaining2", this.bindingSourceHud, "battery_remaining2", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("current2", this.bindingSourceHud, "current2", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("datetime", this.bindingSourceHud, "datetime", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("disttowp", this.bindingSourceHud, "wp_dist", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("ekfstatus", this.bindingSourceHud, "ekfstatus", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("failsafe", this.bindingSourceHud, "failsafe", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpsfix", this.bindingSourceHud, "gpsstatus", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpsfix2", this.bindingSourceHud, "gpsstatus2", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpshdop", this.bindingSourceHud, "gpshdop", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpshdop2", this.bindingSourceHud, "gpshdop2", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("groundalt", this.bindingSourceHud, "HomeAlt", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("groundcourse", this.bindingSourceHud, "groundcourse", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("groundspeed", this.bindingSourceHud, "groundspeed", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("heading", this.bindingSourceHud, "yaw", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("linkqualitygcs", this.bindingSourceHud, "linkqualitygcs", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("message", this.bindingSourceHud, "messageHigh", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("messageSeverity", this.bindingSourceHud, "messageHighSeverity", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("mode", this.bindingSourceHud, "mode", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("navpitch", this.bindingSourceHud, "nav_pitch", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("navroll", this.bindingSourceHud, "nav_roll", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("pitch", this.bindingSourceHud, "pitch", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("prearmstatus", this.bindingSourceHud, "prearmstatus", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("roll", this.bindingSourceHud, "roll", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("safetyactive", this.bindingSourceHud, "safetyactive", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("status", this.bindingSourceHud, "armed", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("targetalt", this.bindingSourceHud, "targetalt", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("targetheading", this.bindingSourceHud, "nav_bearing", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("targetspeed", this.bindingSourceHud, "targetairspeed", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("turnrate", this.bindingSourceHud, "turnrate", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("verticalspeed", this.bindingSourceHud, "verticalspeed", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("vibex", this.bindingSourceHud, "vibex", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("vibey", this.bindingSourceHud, "vibey", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("vibez", this.bindingSourceHud, "vibez", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("wpno", this.bindingSourceHud, "wpno", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("xtrack_error", this.bindingSourceHud, "xtrack_error", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("AOA", this.bindingSourceHud, "AOA", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("SSA", this.bindingSourceHud, "SSA", false)); - this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("critAOA", this.bindingSourceHud, "crit_AOA", false)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("airspeed", this.bindingSourceHud, "airspeed", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("alt", this.bindingSourceHud, "alt", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("load", this.bindingSourceHud, "load", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batterylevel", this.bindingSourceHud, "battery_voltage", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batteryremaining", this.bindingSourceHud, "battery_remaining", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("connected", this.bindingSourceHud, "connected", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("current", this.bindingSourceHud, "current", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batterylevel2", this.bindingSourceHud, "battery_voltage2", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("batteryremaining2", this.bindingSourceHud, "battery_remaining2", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("current2", this.bindingSourceHud, "current2", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("datetime", this.bindingSourceHud, "datetime", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("disttowp", this.bindingSourceHud, "wp_dist", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("ekfstatus", this.bindingSourceHud, "ekfstatus", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("failsafe", this.bindingSourceHud, "failsafe", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpsfix", this.bindingSourceHud, "gpsstatus", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpsfix2", this.bindingSourceHud, "gpsstatus2", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpshdop", this.bindingSourceHud, "gpshdop", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("gpshdop2", this.bindingSourceHud, "gpshdop2", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("groundalt", this.bindingSourceHud, "HomeAlt", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("groundcourse", this.bindingSourceHud, "groundcourse", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("groundspeed", this.bindingSourceHud, "groundspeed", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("heading", this.bindingSourceHud, "yaw", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("linkqualitygcs", this.bindingSourceHud, "linkqualitygcs", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("message", this.bindingSourceHud, "messageHigh", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("messageSeverity", this.bindingSourceHud, "messageHighSeverity", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("mode", this.bindingSourceHud, "mode", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("navpitch", this.bindingSourceHud, "nav_pitch", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("navroll", this.bindingSourceHud, "nav_roll", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("pitch", this.bindingSourceHud, "pitch", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("prearmstatus", this.bindingSourceHud, "prearmstatus", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("roll", this.bindingSourceHud, "roll", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("safetyactive", this.bindingSourceHud, "safetyactive", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("status", this.bindingSourceHud, "armed", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("targetalt", this.bindingSourceHud, "targetalt", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("targetheading", this.bindingSourceHud, "nav_bearing", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("targetspeed", this.bindingSourceHud, "targetairspeed", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("turnrate", this.bindingSourceHud, "turnrate", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("verticalspeed", this.bindingSourceHud, "verticalspeed", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("vibex", this.bindingSourceHud, "vibex", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("vibey", this.bindingSourceHud, "vibey", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("vibez", this.bindingSourceHud, "vibez", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("wpno", this.bindingSourceHud, "wpno", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("xtrack_error", this.bindingSourceHud, "xtrack_error", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("AOA", this.bindingSourceHud, "AOA", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("SSA", this.bindingSourceHud, "SSA", true)); + this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("critAOA", this.bindingSourceHud, "crit_AOA", true)); this.hud1.datetime = new System.DateTime(((long)(0))); this.hud1.displayAOASSA = false; this.hud1.displayCellVoltage = false; @@ -398,6 +400,7 @@ private void InitializeComponent() this.hud1.heading = 0F; this.hud1.hudcolor = System.Drawing.Color.LightGray; this.hud1.linkqualitygcs = 0F; + this.hud1.load = 0F; this.hud1.lowairspeed = false; this.hud1.lowgroundspeed = false; this.hud1.lowvoltagealert = false; @@ -411,6 +414,7 @@ private void InitializeComponent() this.hud1.prearmstatus = false; this.hud1.roll = 0F; this.hud1.Russian = false; + this.hud1.safetyactive = false; this.hud1.skyColor1 = System.Drawing.Color.Blue; this.hud1.skyColor2 = System.Drawing.Color.LightBlue; this.hud1.speedunit = null; @@ -436,6 +440,7 @@ private void InitializeComponent() // // contextMenuStripHud // + this.contextMenuStripHud.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStripHud.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.videoToolStripMenuItem, this.setAspectRatioToolStripMenuItem, @@ -444,7 +449,8 @@ private void InitializeComponent() this.swapWithMapToolStripMenuItem, this.groundColorToolStripMenuItem, this.setBatteryCellCountToolStripMenuItem, - this.showIconsToolStripMenuItem}); + this.showIconsToolStripMenuItem, + this.FuelGaugeToolStripMenuItem}); this.contextMenuStripHud.Name = "contextMenuStrip2"; resources.ApplyResources(this.contextMenuStripHud, "contextMenuStripHud"); // @@ -575,6 +581,7 @@ private void InitializeComponent() // // contextMenuStripactionstab // + this.contextMenuStripactionstab.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStripactionstab.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.customizeToolStripMenuItem, this.multiLineToolStripMenuItem}); @@ -627,6 +634,7 @@ private void InitializeComponent() // // contextMenuStripQuickView // + this.contextMenuStripQuickView.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStripQuickView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.setViewCountToolStripMenuItem, this.undockToolStripMenuItem}); @@ -757,6 +765,7 @@ private void InitializeComponent() this.BUT_SendMSG.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_SendMSG, "BUT_SendMSG"); this.BUT_SendMSG.Name = "BUT_SendMSG"; + this.BUT_SendMSG.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_SendMSG, resources.GetString("BUT_SendMSG.ToolTip")); this.BUT_SendMSG.UseVisualStyleBackColor = true; this.BUT_SendMSG.Click += new System.EventHandler(this.BUT_SendMSG_Click); @@ -768,6 +777,7 @@ private void InitializeComponent() this.BUT_abortland.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_abortland, "BUT_abortland"); this.BUT_abortland.Name = "BUT_abortland"; + this.BUT_abortland.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_abortland, resources.GetString("BUT_abortland.ToolTip")); this.BUT_abortland.UseVisualStyleBackColor = true; this.BUT_abortland.Click += new System.EventHandler(this.BUT_abortland_Click); @@ -807,6 +817,7 @@ private void InitializeComponent() this.BUT_clear_track.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_clear_track, "BUT_clear_track"); this.BUT_clear_track.Name = "BUT_clear_track"; + this.BUT_clear_track.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_clear_track, resources.GetString("BUT_clear_track.ToolTip")); this.BUT_clear_track.UseVisualStyleBackColor = true; this.BUT_clear_track.Click += new System.EventHandler(this.BUT_clear_track_Click); @@ -826,6 +837,7 @@ private void InitializeComponent() this.BUTactiondo.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUTactiondo, "BUTactiondo"); this.BUTactiondo.Name = "BUTactiondo"; + this.BUTactiondo.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUTactiondo, resources.GetString("BUTactiondo.ToolTip")); this.BUTactiondo.UseVisualStyleBackColor = true; this.BUTactiondo.Click += new System.EventHandler(this.BUTactiondo_Click); @@ -837,6 +849,7 @@ private void InitializeComponent() this.BUT_resumemis.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_resumemis, "BUT_resumemis"); this.BUT_resumemis.Name = "BUT_resumemis"; + this.BUT_resumemis.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_resumemis.UseVisualStyleBackColor = true; this.BUT_resumemis.Click += new System.EventHandler(this.BUT_resumemis_Click); // @@ -915,6 +928,7 @@ private void InitializeComponent() this.BUT_ARM.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_ARM, "BUT_ARM"); this.BUT_ARM.Name = "BUT_ARM"; + this.BUT_ARM.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_ARM, resources.GetString("BUT_ARM.ToolTip")); this.BUT_ARM.UseVisualStyleBackColor = true; this.BUT_ARM.Click += new System.EventHandler(this.BUT_ARM_Click); @@ -926,6 +940,7 @@ private void InitializeComponent() this.BUT_mountmode.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_mountmode, "BUT_mountmode"); this.BUT_mountmode.Name = "BUT_mountmode"; + this.BUT_mountmode.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_mountmode, resources.GetString("BUT_mountmode.ToolTip")); this.BUT_mountmode.UseVisualStyleBackColor = true; this.BUT_mountmode.Click += new System.EventHandler(this.BUT_mountmode_Click); @@ -937,6 +952,7 @@ private void InitializeComponent() this.BUT_joystick.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_joystick, "BUT_joystick"); this.BUT_joystick.Name = "BUT_joystick"; + this.BUT_joystick.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_joystick, resources.GetString("BUT_joystick.ToolTip")); this.BUT_joystick.UseVisualStyleBackColor = true; this.BUT_joystick.Click += new System.EventHandler(this.BUT_joystick_Click); @@ -948,6 +964,7 @@ private void InitializeComponent() this.BUT_RAWSensor.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_RAWSensor, "BUT_RAWSensor"); this.BUT_RAWSensor.Name = "BUT_RAWSensor"; + this.BUT_RAWSensor.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_RAWSensor, resources.GetString("BUT_RAWSensor.ToolTip")); this.BUT_RAWSensor.UseVisualStyleBackColor = true; this.BUT_RAWSensor.Click += new System.EventHandler(this.BUT_RAWSensor_Click); @@ -959,6 +976,7 @@ private void InitializeComponent() this.BUT_Homealt.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_Homealt, "BUT_Homealt"); this.BUT_Homealt.Name = "BUT_Homealt"; + this.BUT_Homealt.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_Homealt, resources.GetString("BUT_Homealt.ToolTip")); this.BUT_Homealt.UseVisualStyleBackColor = true; this.BUT_Homealt.Click += new System.EventHandler(this.BUT_Homealt_Click); @@ -970,6 +988,7 @@ private void InitializeComponent() this.BUTrestartmission.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUTrestartmission, "BUTrestartmission"); this.BUTrestartmission.Name = "BUTrestartmission"; + this.BUTrestartmission.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUTrestartmission, resources.GetString("BUTrestartmission.ToolTip")); this.BUTrestartmission.UseVisualStyleBackColor = true; this.BUTrestartmission.Click += new System.EventHandler(this.BUTrestartmission_Click); @@ -989,6 +1008,7 @@ private void InitializeComponent() this.BUT_quickrtl.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_quickrtl, "BUT_quickrtl"); this.BUT_quickrtl.Name = "BUT_quickrtl"; + this.BUT_quickrtl.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_quickrtl, resources.GetString("BUT_quickrtl.ToolTip")); this.BUT_quickrtl.UseVisualStyleBackColor = true; this.BUT_quickrtl.Click += new System.EventHandler(this.BUT_quickrtl_Click); @@ -1000,6 +1020,7 @@ private void InitializeComponent() this.BUT_quickmanual.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_quickmanual, "BUT_quickmanual"); this.BUT_quickmanual.Name = "BUT_quickmanual"; + this.BUT_quickmanual.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_quickmanual, resources.GetString("BUT_quickmanual.ToolTip")); this.BUT_quickmanual.UseVisualStyleBackColor = true; this.BUT_quickmanual.Click += new System.EventHandler(this.BUT_quickmanual_Click); @@ -1011,6 +1032,7 @@ private void InitializeComponent() this.BUT_setwp.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_setwp, "BUT_setwp"); this.BUT_setwp.Name = "BUT_setwp"; + this.BUT_setwp.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_setwp, resources.GetString("BUT_setwp.ToolTip")); this.BUT_setwp.UseVisualStyleBackColor = true; this.BUT_setwp.Click += new System.EventHandler(this.BUT_setwp_Click); @@ -1031,6 +1053,7 @@ private void InitializeComponent() this.BUT_quickauto.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_quickauto, "BUT_quickauto"); this.BUT_quickauto.Name = "BUT_quickauto"; + this.BUT_quickauto.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_quickauto, resources.GetString("BUT_quickauto.ToolTip")); this.BUT_quickauto.UseVisualStyleBackColor = true; this.BUT_quickauto.Click += new System.EventHandler(this.BUT_quickauto_Click); @@ -1042,6 +1065,7 @@ private void InitializeComponent() this.BUT_setmode.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_setmode, "BUT_setmode"); this.BUT_setmode.Name = "BUT_setmode"; + this.BUT_setmode.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.BUT_setmode, resources.GetString("BUT_setmode.ToolTip")); this.BUT_setmode.UseVisualStyleBackColor = true; this.BUT_setmode.Click += new System.EventHandler(this.BUT_setmode_Click); @@ -1074,6 +1098,7 @@ private void InitializeComponent() this.myButton1.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.myButton1, "myButton1"); this.myButton1.Name = "myButton1"; + this.myButton1.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.myButton1, resources.GetString("myButton1.ToolTip")); this.myButton1.UseVisualStyleBackColor = true; this.myButton1.Click += new System.EventHandler(this.BUT_quickmanual_Click); @@ -1085,6 +1110,7 @@ private void InitializeComponent() this.myButton2.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.myButton2, "myButton2"); this.myButton2.Name = "myButton2"; + this.myButton2.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.myButton2, resources.GetString("myButton2.ToolTip")); this.myButton2.UseVisualStyleBackColor = true; this.myButton2.Click += new System.EventHandler(this.BUT_quickrtl_Click); @@ -1096,6 +1122,7 @@ private void InitializeComponent() this.myButton3.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.myButton3, "myButton3"); this.myButton3.Name = "myButton3"; + this.myButton3.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.toolTip1.SetToolTip(this.myButton3, resources.GetString("myButton3.ToolTip")); this.myButton3.UseVisualStyleBackColor = true; this.myButton3.Click += new System.EventHandler(this.BUT_quickauto_Click); @@ -1931,6 +1958,7 @@ private void InitializeComponent() this.BUT_edit_selected.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_edit_selected, "BUT_edit_selected"); this.BUT_edit_selected.Name = "BUT_edit_selected"; + this.BUT_edit_selected.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_edit_selected.UseVisualStyleBackColor = true; this.BUT_edit_selected.Click += new System.EventHandler(this.BUT_edit_selected_Click); // @@ -1946,6 +1974,7 @@ private void InitializeComponent() this.BUT_run_script.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_run_script, "BUT_run_script"); this.BUT_run_script.Name = "BUT_run_script"; + this.BUT_run_script.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_run_script.UseVisualStyleBackColor = true; this.BUT_run_script.Click += new System.EventHandler(this.BUT_run_script_Click); // @@ -1956,6 +1985,7 @@ private void InitializeComponent() this.BUT_abort_script.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_abort_script, "BUT_abort_script"); this.BUT_abort_script.Name = "BUT_abort_script"; + this.BUT_abort_script.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_abort_script.UseVisualStyleBackColor = true; this.BUT_abort_script.Click += new System.EventHandler(this.BUT_abort_script_Click); // @@ -1971,6 +2001,7 @@ private void InitializeComponent() this.BUT_select_script.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_select_script, "BUT_select_script"); this.BUT_select_script.Name = "BUT_select_script"; + this.BUT_select_script.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_select_script.UseVisualStyleBackColor = true; this.BUT_select_script.Click += new System.EventHandler(this.BUT_select_script_Click); // @@ -1989,6 +2020,7 @@ private void InitializeComponent() // resources.ApplyResources(this.BUT_PayloadFolder, "BUT_PayloadFolder"); this.BUT_PayloadFolder.Name = "BUT_PayloadFolder"; + this.BUT_PayloadFolder.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_PayloadFolder.UseVisualStyleBackColor = true; // // groupBoxRoll @@ -2047,6 +2079,7 @@ private void InitializeComponent() // resources.ApplyResources(this.BUT_resetGimbalPos, "BUT_resetGimbalPos"); this.BUT_resetGimbalPos.Name = "BUT_resetGimbalPos"; + this.BUT_resetGimbalPos.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_resetGimbalPos.UseVisualStyleBackColor = true; this.BUT_resetGimbalPos.Click += new System.EventHandler(this.BUT_resetGimbalPos_Click); // @@ -2121,6 +2154,7 @@ private void InitializeComponent() resources.ApplyResources(this.BUT_speed10, "BUT_speed10"); this.BUT_speed10.Name = "BUT_speed10"; this.BUT_speed10.Tag = "10"; + this.BUT_speed10.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_speed10.UseVisualStyleBackColor = true; this.BUT_speed10.Click += new System.EventHandler(this.BUT_speed1_Click); // @@ -2132,6 +2166,7 @@ private void InitializeComponent() resources.ApplyResources(this.BUT_speed5, "BUT_speed5"); this.BUT_speed5.Name = "BUT_speed5"; this.BUT_speed5.Tag = "5"; + this.BUT_speed5.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_speed5.UseVisualStyleBackColor = true; this.BUT_speed5.Click += new System.EventHandler(this.BUT_speed1_Click); // @@ -2143,6 +2178,7 @@ private void InitializeComponent() resources.ApplyResources(this.BUT_speed2, "BUT_speed2"); this.BUT_speed2.Name = "BUT_speed2"; this.BUT_speed2.Tag = "2"; + this.BUT_speed2.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_speed2.UseVisualStyleBackColor = true; this.BUT_speed2.Click += new System.EventHandler(this.BUT_speed1_Click); // @@ -2154,6 +2190,7 @@ private void InitializeComponent() resources.ApplyResources(this.BUT_speed1, "BUT_speed1"); this.BUT_speed1.Name = "BUT_speed1"; this.BUT_speed1.Tag = "1"; + this.BUT_speed1.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_speed1.UseVisualStyleBackColor = true; this.BUT_speed1.Click += new System.EventHandler(this.BUT_speed1_Click); // @@ -2165,6 +2202,7 @@ private void InitializeComponent() resources.ApplyResources(this.BUT_speed1_2, "BUT_speed1_2"); this.BUT_speed1_2.Name = "BUT_speed1_2"; this.BUT_speed1_2.Tag = "0.5"; + this.BUT_speed1_2.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_speed1_2.UseVisualStyleBackColor = true; this.BUT_speed1_2.Click += new System.EventHandler(this.BUT_speed1_Click); // @@ -2176,6 +2214,7 @@ private void InitializeComponent() resources.ApplyResources(this.BUT_speed1_4, "BUT_speed1_4"); this.BUT_speed1_4.Name = "BUT_speed1_4"; this.BUT_speed1_4.Tag = "0.25"; + this.BUT_speed1_4.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_speed1_4.UseVisualStyleBackColor = true; this.BUT_speed1_4.Click += new System.EventHandler(this.BUT_speed1_Click); // @@ -2187,6 +2226,7 @@ private void InitializeComponent() resources.ApplyResources(this.BUT_speed1_10, "BUT_speed1_10"); this.BUT_speed1_10.Name = "BUT_speed1_10"; this.BUT_speed1_10.Tag = "0.1"; + this.BUT_speed1_10.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_speed1_10.UseVisualStyleBackColor = true; this.BUT_speed1_10.Click += new System.EventHandler(this.BUT_speed1_Click); // @@ -2197,6 +2237,7 @@ private void InitializeComponent() this.BUT_loadtelem.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_loadtelem, "BUT_loadtelem"); this.BUT_loadtelem.Name = "BUT_loadtelem"; + this.BUT_loadtelem.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_loadtelem.UseVisualStyleBackColor = true; this.BUT_loadtelem.Click += new System.EventHandler(this.BUT_loadtelem_Click); // @@ -2223,6 +2264,7 @@ private void InitializeComponent() this.BUT_log2kml.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_log2kml, "BUT_log2kml"); this.BUT_log2kml.Name = "BUT_log2kml"; + this.BUT_log2kml.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_log2kml.UseVisualStyleBackColor = true; this.BUT_log2kml.Click += new System.EventHandler(this.BUT_log2kml_Click); // @@ -2233,6 +2275,7 @@ private void InitializeComponent() this.BUT_playlog.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_playlog, "BUT_playlog"); this.BUT_playlog.Name = "BUT_playlog"; + this.BUT_playlog.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_playlog.UseVisualStyleBackColor = true; this.BUT_playlog.Click += new System.EventHandler(this.BUT_playlog_Click); // @@ -2270,6 +2313,7 @@ private void InitializeComponent() this.BUT_DFMavlink.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_DFMavlink, "BUT_DFMavlink"); this.BUT_DFMavlink.Name = "BUT_DFMavlink"; + this.BUT_DFMavlink.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_DFMavlink.UseVisualStyleBackColor = true; this.BUT_DFMavlink.Click += new System.EventHandler(this.BUT_DFMavlink_Click); // @@ -2277,6 +2321,7 @@ private void InitializeComponent() // resources.ApplyResources(this.BUT_georefimage, "BUT_georefimage"); this.BUT_georefimage.Name = "BUT_georefimage"; + this.BUT_georefimage.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_georefimage.Click += new System.EventHandler(this.BUT_georefimage_Click); // // BUT_logbrowse @@ -2286,6 +2331,7 @@ private void InitializeComponent() this.BUT_logbrowse.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_logbrowse, "BUT_logbrowse"); this.BUT_logbrowse.Name = "BUT_logbrowse"; + this.BUT_logbrowse.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_logbrowse.UseVisualStyleBackColor = true; this.BUT_logbrowse.Click += new System.EventHandler(this.BUT_logbrowse_Click); // @@ -2296,6 +2342,7 @@ private void InitializeComponent() this.BUT_matlab.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_matlab, "BUT_matlab"); this.BUT_matlab.Name = "BUT_matlab"; + this.BUT_matlab.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_matlab.UseVisualStyleBackColor = true; this.BUT_matlab.Click += new System.EventHandler(this.BUT_matlab_Click); // @@ -2306,6 +2353,7 @@ private void InitializeComponent() this.but_bintolog.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.but_bintolog, "but_bintolog"); this.but_bintolog.Name = "but_bintolog"; + this.but_bintolog.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.but_bintolog.UseVisualStyleBackColor = true; this.but_bintolog.Click += new System.EventHandler(this.but_bintolog_Click); // @@ -2316,6 +2364,7 @@ private void InitializeComponent() this.but_dflogtokml.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.but_dflogtokml, "but_dflogtokml"); this.but_dflogtokml.Name = "but_dflogtokml"; + this.but_dflogtokml.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.but_dflogtokml.UseVisualStyleBackColor = true; this.but_dflogtokml.Click += new System.EventHandler(this.but_dflogtokml_Click); // @@ -2326,6 +2375,7 @@ private void InitializeComponent() this.BUT_loganalysis.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.BUT_loganalysis, "BUT_loganalysis"); this.BUT_loganalysis.Name = "BUT_loganalysis"; + this.BUT_loganalysis.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_loganalysis.UseVisualStyleBackColor = true; this.BUT_loganalysis.Click += new System.EventHandler(this.BUT_loganalysis_Click); // @@ -2380,6 +2430,7 @@ private void InitializeComponent() // // contextMenuStripMap // + this.contextMenuStripMap.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStripMap.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.goHereToolStripMenuItem, this.flyToHereAltToolStripMenuItem, @@ -2506,6 +2557,12 @@ private void InitializeComponent() resources.ApplyResources(this.onOffCameraOverlapToolStripMenuItem, "onOffCameraOverlapToolStripMenuItem"); this.onOffCameraOverlapToolStripMenuItem.Click += new System.EventHandler(this.onOffCameraOverlapToolStripMenuItem_Click); // + // jumpToTagToolStripMenuItem + // + this.jumpToTagToolStripMenuItem.Name = "jumpToTagToolStripMenuItem"; + resources.ApplyResources(this.jumpToTagToolStripMenuItem, "jumpToTagToolStripMenuItem"); + this.jumpToTagToolStripMenuItem.Click += new System.EventHandler(this.jumpToTagToolStripMenuItem_Click); + // // but_disablejoystick // this.but_disablejoystick.ColorMouseDown = System.Drawing.Color.Empty; @@ -2513,6 +2570,7 @@ private void InitializeComponent() this.but_disablejoystick.ColorNotEnabled = System.Drawing.Color.Empty; resources.ApplyResources(this.but_disablejoystick, "but_disablejoystick"); this.but_disablejoystick.Name = "but_disablejoystick"; + this.but_disablejoystick.TextColorNotEnabled = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.but_disablejoystick.UseVisualStyleBackColor = true; this.but_disablejoystick.Click += new System.EventHandler(this.but_disablejoystick_Click); // @@ -2527,9 +2585,9 @@ private void InitializeComponent() // windDir1 // this.windDir1.BackColor = System.Drawing.Color.Transparent; - this.windDir1.DataBindings.Add(new System.Windows.Forms.Binding("Direction", this.bindingSource1, "wind_dir", false, System.Windows.Forms.DataSourceUpdateMode.Never)); - this.windDir1.DataBindings.Add(new System.Windows.Forms.Binding("Speed", this.bindingSource1, "wind_vel", false, System.Windows.Forms.DataSourceUpdateMode.Never)); - this.windDir1.Direction = 180D; + this.windDir1.DataBindings.Add(new System.Windows.Forms.Binding("Direction", this.bindingSource1, "wind_dir", true, System.Windows.Forms.DataSourceUpdateMode.Never)); + this.windDir1.DataBindings.Add(new System.Windows.Forms.Binding("Speed", this.bindingSource1, "wind_vel", true, System.Windows.Forms.DataSourceUpdateMode.Never)); + this.windDir1.Direction = 360D; resources.ApplyResources(this.windDir1, "windDir1"); this.windDir1.Name = "windDir1"; this.windDir1.Speed = 0D; @@ -2643,9 +2701,9 @@ private void InitializeComponent() this.coords1.Alt = 0D; this.coords1.AltSource = ""; this.coords1.AltUnit = "m"; - this.coords1.DataBindings.Add(new System.Windows.Forms.Binding("Alt", this.bindingSource1, "alt", false)); - this.coords1.DataBindings.Add(new System.Windows.Forms.Binding("Lat", this.bindingSource1, "lat", false)); - this.coords1.DataBindings.Add(new System.Windows.Forms.Binding("Lng", this.bindingSource1, "lng", false)); + this.coords1.DataBindings.Add(new System.Windows.Forms.Binding("Alt", this.bindingSource1, "alt", true)); + this.coords1.DataBindings.Add(new System.Windows.Forms.Binding("Lat", this.bindingSource1, "lat", true)); + this.coords1.DataBindings.Add(new System.Windows.Forms.Binding("Lng", this.bindingSource1, "lng", true)); this.coords1.Lat = 0D; this.coords1.Lng = 0D; resources.ApplyResources(this.coords1, "coords1"); @@ -2730,11 +2788,10 @@ private void InitializeComponent() // this.bindingSourceStatusTab.DataSource = typeof(MissionPlanner.CurrentState); // - // jumpToTagToolStripMenuItem + // FuelGaugeToolStripMenuItem // - this.jumpToTagToolStripMenuItem.Name = "jumpToTagToolStripMenuItem"; - resources.ApplyResources(this.jumpToTagToolStripMenuItem, "jumpToTagToolStripMenuItem"); - this.jumpToTagToolStripMenuItem.Click += new System.EventHandler(this.jumpToTagToolStripMenuItem_Click); + this.FuelGaugeToolStripMenuItem.Name = "FuelGaugeToolStripMenuItem"; + resources.ApplyResources(this.FuelGaugeToolStripMenuItem, "FuelGaugeToolStripMenuItem"); // // FlightData // @@ -3036,5 +3093,6 @@ private void InitializeComponent() private Controls.AuxOptions auxOptions6; private Controls.AuxOptions auxOptions7; private ToolStripMenuItem jumpToTagToolStripMenuItem; + private ToolStripMenuItem FuelGaugeToolStripMenuItem; } } diff --git a/GCSViews/FlightData.cs b/GCSViews/FlightData.cs index 044a3e63f6..ec9579740b 100644 --- a/GCSViews/FlightData.cs +++ b/GCSViews/FlightData.cs @@ -54,6 +54,41 @@ public partial class FlightData : MyUserControl, IActivate, IDeactivate internal PointLatLng MouseDownStart; + //Fuel Gauge + //Input field for amount of fuel added into fuel tank + NumericUpDown FuelInTank = new NumericUpDown { Visible = false }; + //Button to add/hide the fuel gauge to the screen + MyButton FuelGaugeButton = new MyButton { Visible = false }; + //Input field for setting the size of the fuel tank + NumericUpDown FuelTankSize = new NumericUpDown { Visible = false }; + //Button to set the fuel tank size + MyButton FuelTankSizeButton = new MyButton { Visible = false }; + //Vertical progress bar used for the fuel gauge + VerticalProgressBar2 FuelGaugeBar = new VerticalProgressBar2 { Visible = false, Enabled = false, BackgroundColor = Color.DarkSlateGray, Text = string.Empty, ValueColor = Color.DarkSlateGray }; + //Tooltip for Fuel Gauge + ToolTip FuelGaugeToolTip = new ToolTip(); + //Initialize timers + //Fuel Gauge Timer + System.Windows.Forms.Timer FuelGaugeTimer = new System.Windows.Forms.Timer(); + //Fuel Gauge MessageBox Timer + System.Windows.Forms.Timer FuelGaugeMessageBoxTimer = new System.Windows.Forms.Timer(); + //Arm/disarm status timer + System.Windows.Forms.Timer ArmStatusTimer = new System.Windows.Forms.Timer(); + //Variables for displaying Message boxes for zero and 15 percent fuel remaining in tank + int ZeroPercentFuelCount = 0; + int FifteenPercentFuelCount = 0; + //Variable for displaying and hiding the fuel gauge controls + int displayFuelGaugeControls = 0; + //Variable for 10 percnt of fuel in tank - used with the colours of the fuel gauge + int TenPercentFuelTankSize = 0; + //Variable for the remaining fuel in vehicle + decimal MillilitresOfFuelRemaining = 0; + //Variable count for displaying/hiding the fuel bar only + int displayFuelBar = 0; + + //Dropout HUD Form + Form dropoutHUDForm = new Form(); + //The file path of the selected script internal string selectedscript = ""; @@ -2499,38 +2534,50 @@ private void deleteToolStripMenuItem_Click(object sender, EventArgs e) void dropout_FormClosed(object sender, FormClosedEventArgs e) { - (sender as Form).SaveStartupLocation(); + dropoutHUDForm.SaveStartupLocation(); //GetFormFromGuid(GetOrCreateGuid("fd_hud_guid")).Controls.Add(hud1); - ((sender as Form).Tag as Control).Controls.Add(hud1); + (dropoutHUDForm.Tag as Control).Controls.Add(hud1); //SubMainLeft.Panel1.Controls.Add(hud1); if (hud1.Parent == SubMainLeft.Panel1) SubMainLeft.Panel1Collapsed = false; huddropout = false; + //Add the fuel Gauge back to the correct spot on the HUD once the dropout form has closed + ShowFuelGauge(); } void dropout_Resize(object sender, EventArgs e) { + //Variables for the width and the height of the form + int height = 0; + int width = 0; + //Variable for the sender object as a form + var form = (sender as Form); if (huddropoutresize) return; huddropoutresize = true; int hudh = hud1.Height; - int formh = ((Form) sender).Height - 30; + int formh = (form).Height - 30; - if (((Form) sender).Height < hudh) + if (form.Height < hudh) { - if (((Form) sender).WindowState == FormWindowState.Maximized) + if (form.WindowState == FormWindowState.Maximized) { - Point tl = ((Form) sender).DesktopLocation; - ((Form) sender).WindowState = FormWindowState.Normal; - ((Form) sender).Location = tl; + Point tl = (form).DesktopLocation; + form.WindowState = FormWindowState.Normal; + form.Location = tl; } - - ((Form) sender).Width = (int) (formh * (hud1.SixteenXNine ? 1.777f : 1.333f)); - ((Form) sender).Height = formh + 20; } - + //Set the width and height variables to be the same as the form's width and height + width = form.Width = (int)(formh * (hud1.SixteenXNine ? 1.777f : 1.333f)); + height = form.Height = formh + 20; + //If the hud dropout is displaying, change the dimensions of the fuel gauge + if (huddropout) + { + //Resize the fuel gauge bar on the hud dropout correctly + FuelGaugeHUDDropoutDimensions(width, height); + } hud1.Refresh(); huddropoutresize = false; } @@ -2609,7 +2656,8 @@ private void FlightData_Load(object sender, EventArgs e) groundColorToolStripMenuItem_Click(null, null); hud1.doResize(); - + //Tool strip menu item click event handler for Fuel Gauge + FuelGaugeToolStripMenuItem.Click += new EventHandler(FuelGaugeContextMenuStripItem_Click); prop = new Propagation(gMapControl1); splitContainer1.Panel1Collapsed = true; @@ -3117,19 +3165,89 @@ private void hud1_DoubleClick(object sender, EventArgs e) if(hud1.Parent == SubMainLeft.Panel1) SubMainLeft.Panel1Collapsed = true; - Form dropout = new Form(); + Form dropout = new Form(); dropout.Text = "HUD Dropout"; dropout.Size = new Size(hud1.Width, hud1.Height + 20); dropout.Tag = hud1.Parent; SubMainLeft.Panel1.Controls.Remove(hud1); dropout.Controls.Add(hud1); + //Assign the Form to the dropoutHUDForm + dropoutHUDForm = dropout; dropout.Resize += dropout_Resize; + //Added - load event handler for the dropoutHUD form + dropout.Load += new EventHandler(HUD1Dropout_Load); + //Set the Tool Tip for the fuel gauge bar. + FuelGaugeToolTip.SetToolTip(FuelGaugeBar, $"Fuel remaining: {MillilitresOfFuelRemaining} ml"); dropout.FormClosed += dropout_FormClosed; dropout.RestoreStartupLocation(); dropout.Show(); - huddropout = true; + huddropout = true; } + private void HUD1Dropout_Load(object sender, EventArgs e) + { + //Variable for the form from the sender object + var form = sender as Form; + //If the fuel gauge bar is visible from the original HUD + if (displayFuelBar % 2 != 0) + { + //Set the width and height variables to be the same as the form's width and height + int width = form.Width; + int height = form.Height; + //Set the dimensions for the Fuel Gauge + FuelGaugeHUDDropoutDimensions(width, height); + } + } + private void FuelGaugeHUDDropoutDimensions(int width, int height) + { + //Try block for the fuel gauge on the HUD dropout form + try + { + //Make the fuel gauge visible every second button click on the "FuelGaugeButton" button + //if the displayFuelBar variable is divisible by 2, then the fuel gauge bar will not show on the HUD dropout + if (displayFuelBar % 2 == 0) + { + FuelGaugeBar.Visible = false; + } + //if the displayFuelBar int variable value is divisible by 2 or the fuelgauge bar is already visible, then the fuel gauge bar will not show on the HUD dropout + else if (this.FuelGaugeBar.Visible == true || displayFuelBar % 2 != 0) + { + FuelGaugeBar.Visible = false; + //If statement to make the Fuel Gauge Bar display in the correct area of the dropout hud according to the width of the dropout hud + if (width >= 610) + { + //Location of the Fuel Gauge + FuelGaugeBar.Location = new Point((int)((0.81) * width), (int)(0.235 * height)); + //Size of the Fuel Gauge + FuelGaugeBar.Size = new Size((int)((0.04) * width), (int)(0.2 * height)); + } + else if (width < 610 && width >= 350) + { + //Location of the Fuel Gauge + FuelGaugeBar.Location = new Point((int)((0.8) * width), (int)(0.22 * height)); + //Size of the Fuel Gauge + FuelGaugeBar.Size = new Size((int)((0.04) * width), (int)(0.2 * height)); + } + else if (width < 350) + { + //Location of the Fuel Gauge + this.FuelGaugeBar.Location = new Point((int)((0.78) * width), (int)(0.23 * height)); + //Size of the Fuel Gauge + this.FuelGaugeBar.Size = new Size((int)((0.035) * width), (int)(0.2 * height)); + } + //Display the fuel gauge bar + this.FuelGaugeBar.Show(); + this.FuelGaugeBar.BringToFront(); + this.FuelGaugeBar.Update(); + this.FuelGaugeBar.Invalidate(); + this.FuelGaugeBar.Visible = true; + } + } + catch (Exception ex) + { + CustomMessageBox.Show(ex.Message); + } + } private void hud1_ekfclick(object sender, EventArgs e) { EKFStatus frm = new EKFStatus(); @@ -5803,7 +5921,622 @@ private void poiatcoordsToolStripMenuItem_Click(object sender, EventArgs e) CustomMessageBox.Show(Strings.InvalidField, Strings.ERROR); } } + private void ControlDimensions() + { + //Variable for positioning the controls on the Persistant Panel + var panelPositionInputLocationX = MainV2.instance.FlightData.panel_persistent.Width - (MainV2.instance.FlightData.panel_persistent.Width * 0.21); + //Size and location for the input fuel field + FuelTankSize.Location = new Point((int)(panelPositionInputLocationX), (int)(4)); + FuelTankSize.Size = new Size((int)(MainV2.instance.FlightData.panel_persistent.Width * 0.18), (int)(MainV2.instance.FlightData.panel_persistent.Height * 0.85)); + //Set the size of the FuelTankSize button + FuelTankSizeButton.Size = FuelTankSize.Size; + //Variable for X location of the Fuel tank size button + var locationX = FuelTankSize.Location.X - FuelTankSize.Width; + //Location of the FuelTankSize button + FuelTankSizeButton.Location = new Point((int)(locationX - 3), (int)(3)); + //Set location and size for FuelinTank input field + FuelInTank.Location = new Point(FuelTankSize.Location.X, FuelTankSize.Bottom + 2); + FuelInTank.Size = FuelTankSize.Size; + //Set location and size for fuel gauge button + FuelGaugeButton.Location = new Point(FuelTankSizeButton.Location.X, FuelTankSizeButton.Bottom + 2); + FuelGaugeButton.Size = FuelTankSizeButton.Size; + } + private void PersistentPanelFuelGaugeControls_Resize(object sender, EventArgs e) + { + //Set the Control dimensions to the starting dimentions of the controls when resizing + ControlDimensions(); + } + private void FuelGaugeControls_Hide() + { + //All of the Controls visiblity set to false + FuelGaugeButton.Visible = false; + FuelTankSizeButton.Visible = false; + FuelInTank.Visible = false; + FuelTankSize.Visible = false; + FuelGaugeBar.Hide(); + FuelGaugeBar.Update(); + FuelGaugeBar.Invalidate(); + FuelGaugeBar.Visible = false; + //Set the display fuel bar int value to 0 when hiding the fuel gauge - this is to ensure when the button to display the fuel gauge is clicked, the ShowFuelGauge() method will be used. + displayFuelBar = 0; + //Set the back colour of the strip menu item for when the Fuel Gaugeis no displaying + FuelGaugeToolStripMenuItem.BackColor = System.Drawing.Color.Empty; + } + private void DisArmedStatusFuelGauge() + { + //Enable controls + FuelTankSizeButton.Enabled = true; + FuelTankSize.Enabled = true; + } + private void ArmedStatusFuelGauge() + { + //Disable controls + FuelTankSizeButton.Enabled = false; + FuelTankSize.Enabled = false; + FuelInTank.Enabled = false; + //Keep the Fuel gauge button enabled so the user will be able to show/hide the bar on the hud while the vehicle is armed + FuelGaugeButton.Enabled = true; + } + private void FuelGaugeControls_Load() + { + //Change the colour of the Fuel Gauge menu strip item for when the Fuel Gauge is active + FuelGaugeToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(255, 240, 240, 240); + //Fuel Gauge Button Visible + FuelGaugeButton.Visible = true; + FuelGaugeButton.Enabled = false; + //Name of Fuel Gauge button + FuelGaugeButton.Text = "Set Fuel Amount (ml)"; + //Set the font size + FuelGaugeButton.Font = new Font(FuelGaugeButton.Font.FontFamily, 6); + //Fuel tank size button visible and enabled + FuelTankSizeButton.Visible = true; + //If disarmed then can set the values and use the controls + var isitarmed = MainV2.comPort.MAV.cs.armed; + if (!isitarmed) + { + FuelTankSizeButton.Enabled = true; + FuelTankSize.Enabled = true; + } + else if (isitarmed) + { + FuelTankSizeButton.Enabled = false; + FuelTankSize.Enabled = false; + } + //Name of Fuel Gauge button and font + FuelTankSizeButton.Text = "Set Tank Size (ml)"; + FuelTankSizeButton.Font = new Font(FuelGaugeButton.Font.FontFamily, 7); + //Set minimum and maximum value for the fuel tank size input + FuelTankSize.Minimum = 0; + FuelTankSize.Maximum = 10000000000; + //Make the input field visible + FuelTankSize.Visible = true; + //Set the minimum value for the fuel added into tank input + FuelInTank.Minimum = 0; + //Set the fuel in tank input to false and display the field + FuelInTank.Enabled = false; + FuelInTank.Visible = true; + //Set Tool Tips for the controls on the persistent panel + FuelGaugeToolTip.SetToolTip(FuelGaugeButton, "Fuel set in milliliters"); + FuelGaugeToolTip.SetToolTip(FuelTankSizeButton, "Fuel set in milliliters"); + FuelGaugeToolTip.SetToolTip(FuelTankSize, "Fuel set in milliliters"); + FuelGaugeToolTip.SetToolTip(FuelInTank, "Fuel set in milliliters"); + //Display and add the controls to the persistent panel + FuelInTank.Show(); + FuelInTank.BringToFront(); + FuelInTank.Update(); + FuelInTank.Invalidate(); + FuelGaugeButton.Show(); + FuelGaugeButton.BringToFront(); + FuelGaugeButton.Update(); + FuelGaugeButton.Invalidate(); + FuelTankSizeButton.Show(); + FuelTankSizeButton.BringToFront(); + FuelTankSizeButton.Update(); + FuelTankSizeButton.Invalidate(); + FuelTankSize.Show(); + FuelTankSize.BringToFront(); + FuelTankSize.Update(); + FuelTankSize.Invalidate(); + MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelInTank); + MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelGaugeButton); + MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelTankSize); + MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelTankSizeButton); + } + private void UpdateTenPercentLine() + { + //Ten percent of the fuel tank size + var tenPercent = (decimal)(0.1) * (decimal)(this.FuelTankSize.Value); + //Set the variable to the int ten percent fuel in tank + TenPercentFuelTankSize = (int)(tenPercent); + } + //Method for changing the value of input field + private void FuelTankSize_ValueChanged(object sender, EventArgs e) + { + //Checks to see if the fuel tank size input value is greater than 0 or if it is equal to 0 in order to either enable or keep the buttons disabled. + if (Convert.ToDecimal(this.FuelTankSize.Value) == 0) + { + FuelGaugeButton.Enabled = false; + FuelTankSizeButton.Enabled = false; + } + else if (Convert.ToDecimal(this.FuelTankSize.Value) > 0) + { + //If disarmed then can set the values and use the controls + var isitarmed = MainV2.comPort.MAV.cs.armed; + if (!isitarmed) + { + //The fuel amount added input and button are only enabled once the set fuel tank size button is clicked + FuelGaugeButton.Enabled = false; + FuelInTank.Enabled = false; + //Fuel tank size button is enabled + FuelTankSizeButton.Enabled = true; + } + } + } + private void FuelinTank_ValueChanged(object sender, EventArgs e) + { + //Stop the message box timer + FuelGaugeMessageBoxTimer.Stop(); + //Checks to see if the fuel in the tank input value is greater than 0 or if it is equal to 0 in order to either enable or keep the button disabled. + if (Convert.ToDecimal(this.FuelInTank.Value) == 0) + { + FuelGaugeButton.Enabled = false; + } + else if (Convert.ToDecimal(this.FuelInTank.Value) > 0) + { + //Enable both fuel buttons when the value has changed + FuelGaugeButton.Enabled = true; + FuelTankSizeButton.Enabled = true; + } + } + //FUNCTION: Colour of the chart + private Color ChartColour() + { + //Variable for the fuel gauge bar value + var fuelBarValue = MillilitresOfFuelRemaining; + //Variable for the COlor of the fuel gauge bar + var fuelBarColour = Color.Empty; + //Percentage variable for selecting correct color of the fuel gauge bar + //30 Percent of fuel tank size + var thirtyPercRemaining = Math.Round(Convert.ToDecimal(0.3), 2) * Math.Round(Convert.ToDecimal(this.FuelTankSize.Value), 2); + //15 Percent of fuel tank size + var fifteenPercRemaining = Math.Round(Convert.ToDecimal(0.15), 2) * Math.Round(Convert.ToDecimal(this.FuelTankSize.Value), 2); + //Change the colour based on the amount remaining in the tank + //Above 30% = Lime + if (Convert.ToInt32(fuelBarValue) > thirtyPercRemaining) + { + fuelBarColour = Color.Lime; + this.FuelGaugeBar.ValueColor = Color.Transparent; + } // Above 15% and Below 30% = Orange + else if (Convert.ToInt32(fuelBarValue) <= thirtyPercRemaining && Convert.ToInt32(fuelBarValue) > fifteenPercRemaining) + { + fuelBarColour = Color.Orange; + this.FuelGaugeBar.ValueColor = Color.Transparent; + } //Above 0% and below 15% = Red + else if (Convert.ToInt32(fuelBarValue) <= fifteenPercRemaining && Convert.ToInt32(fuelBarValue) > 0) + { + fuelBarColour = Color.Red; + this.FuelGaugeBar.ValueColor = Color.Transparent; + } //0% = White + else if (Convert.ToInt32(fuelBarValue) == 0) + { + fuelBarColour = Color.White; + this.FuelGaugeBar.ValueColor = Color.Transparent; + } + return fuelBarColour; + } + //FuelTankSize input - Enter button + private void FuelTankSize_KeyDown(object sender, KeyEventArgs k) + { + //If the enter button is pressed, make the fuel in tank maximum value equal to the fuelTankSize value + if (k.KeyValue == (char)Keys.Enter) + { + //Assign the fuel tank value to the decimal variable + decimal amountOfFuelInTank = Convert.ToDecimal(FuelTankSize.Value); + //Maximum value for the progress bar + this.FuelGaugeBar.Maximum = (int)(amountOfFuelInTank); + //Update the 10 percent line when the Fuel value changes + UpdateTenPercentLine(); + //Set the Maximum value of the fuelinTank input value to be the fuel tank size value and enable the input field + FuelInTank.Maximum = FuelTankSize.Value; + FuelInTank.Enabled = true; + //Enable the Fuel gauge button and set the message box int counts to 0 + FuelGaugeButton.Enabled = true; + FifteenPercentFuelCount = 0; + ZeroPercentFuelCount = 0; + return; + } + } + //FuelinTank input - Enter button + private void FuelinTank_KeyDown(object sender, KeyEventArgs k) + { + //If the Enter button is pressed, then display the Fuel Gauge bar + if (k.KeyValue == (char)Keys.Enter) + { + //Load the fuel gauge bar and set the message box int counts to 0 + LoadFuelGauge(sender, k); + FifteenPercentFuelCount = 0; + ZeroPercentFuelCount = 0; + return; + } + } + private void FuelGauge_Resize(object sender, EventArgs e) + { + try + { + //Only resize when displayed + if (displayFuelBar % 2 != 0) + { + //Fuel gauge bar set to invisible when starting resizing + FuelGaugeBar.Visible = false; + //Set the fuel gauge size and Location + //Variables for the sizes of the FlightData Screen Controls: MainHCopy, Persistent Panel, tab control actions + var mainHCopySize = MainV2.instance.FlightData.MainHcopy.Size; + var panelPersistentSize = MainV2.instance.FlightData.panel_persistent.Size; + var tabQuickSize = MainV2.instance.FlightData.tabControlactions.Size; + //Width of the map and the Zoom Bar on the right side of the screen + var mapAndZoomBarWidth = MainV2.instance.FlightData.gMapControl1.Size.Width + 56; + //Width size difference between the full size of screen that Mission Planner takes up and the size of the map on Mission Planner + var hUDWidth = mainHCopySize.Width - mapAndZoomBarWidth; + //Calculate approximate HUD Height from teh other controls on the left side of the screen (including the panel persistant and the MainMenu tab at the top of the screen) + var finalHeihgt = mainHCopySize.Height - tabQuickSize.Height - panelPersistentSize.Height; + //Location of the fuel gauge bar + FuelGaugeBar.Location = new Point((int)((0.825) * hUDWidth), (int)(0.25 * finalHeihgt)); + //Size of the fuel gauge bar + FuelGaugeBar.Size = new Size((int)((0.04) * hUDWidth), (int)(0.2 * finalHeihgt)); + //Display the fuel gauge bar + FuelGaugeBar.Show(); + FuelGaugeBar.BringToFront(); + FuelGaugeBar.Update(); + FuelGaugeBar.Invalidate(); + FuelGaugeBar.Visible = true; + } + } + catch (Exception ex) + { + CustomMessageBox.Show(ex.Message); + FuelGaugeBar.Visible = true; + } + } + private void ShowFuelGauge() + { + //Display the fuel bar + try + { + //When the display fuel bar variable is not divisible by 2, then display the fuel gauge bar + if (displayFuelBar % 2 != 0) + { + //Variables for the FlightData Controls + var mainHCopySize = MainV2.instance.FlightData.MainHcopy.Size; + var panelPersistentSize = MainV2.instance.FlightData.panel_persistent.Size; + var tabQuickSize = MainV2.instance.FlightData.tabControlactions.Size; + //Width of ther map and the Zoom Bar on the right side of the screen + var mapAndZoomBarWidth = MainV2.instance.FlightData.gMapControl1.Size.Width + 56; + //Width size difference between the full size of screen that Mission Planner takes up and the size of the map on mission Planner + var hUDWidth = mainHCopySize.Width - mapAndZoomBarWidth; + //Calculate approximate HUD Height from teh other controls on the left side of the screen (including the panel persistant and the MainMenu tab at the top of the screen) + var finalHeihgt = mainHCopySize.Height - tabQuickSize.Height - panelPersistentSize.Height; + //Location of the fuel gauge bar + FuelGaugeBar.Location = new Point((int)((0.825) * hUDWidth), (int)(0.25 * finalHeihgt)); + //Size of the fuel gauge bar + FuelGaugeBar.Size = new Size((int)((0.04) * hUDWidth), (int)(0.2 * finalHeihgt)); + //Set the bar color + FuelGaugeBar.ValueColor = ChartColour(); + //Assign the fuel tank input value to a decimal variable + decimal amountOfFuelInTank = Convert.ToDecimal(FuelInTank.Value); + //Set the fuel gauge bar value as the amount specified in the FuelinTank input value + FuelGaugeBar.Value = (int)(amountOfFuelInTank); + //Make the bar visible + FuelGaugeBar.Visible = true; + //Enable the bar + FuelGaugeBar.Enabled = true; + //Tool Tip to let user know that the fuel is displayed in millilitres + FuelGaugeToolTip.SetToolTip(FuelGaugeButton, "Fuel set in milliliters"); + FuelGaugeToolTip.SetToolTip(FuelTankSizeButton, "Fuel set in milliliters"); + FuelGaugeToolTip.SetToolTip(FuelTankSize, "Fuel set in milliliters"); + FuelGaugeToolTip.SetToolTip(FuelInTank, "Fuel set in milliliters"); + //Display and update the bar + FuelGaugeBar.Show(); + FuelGaugeBar.BringToFront(); + FuelGaugeBar.Update(); + FuelGaugeBar.Invalidate(); + //Name of Fuel Gauge button + FuelGaugeButton.Text = "Hide Fuel Gauge"; + //Font and font size for the Fuel Gauge Button + FuelGaugeButton.Font = new Font(FuelGaugeButton.Font.FontFamily, 6); + } + else if (displayFuelBar % 2 == 0) + { + //Name of Fuel Gauge button and set font and font size + FuelGaugeButton.Text = "Show Fuel Gauge"; + FuelGaugeButton.Font = new Font(FuelGaugeButton.Font.FontFamily, 7); + //Make the Bar invisible and disabled + FuelGaugeBar.Visible = false; + FuelGaugeBar.Enabled = false; + FuelGaugeBar.Hide(); + //Update/display the progress bar + FuelGaugeBar.Update(); + FuelGaugeBar.Invalidate(); + } + } + catch (Exception ex) + { + CustomMessageBox.Show(ex.Message); + } + } + private void SetFuelTankSize_Click(object sender, EventArgs e) + { + //Assign the fuel tank value to the decimal variable + decimal amountOfFuelInTank = Convert.ToDecimal(FuelTankSize.Value); + //Maximum value for the bar + FuelGaugeBar.Maximum = (int)(amountOfFuelInTank); + //Enable the fuel in tank input and button and set the message box int counts to 0 + //Only can enable when armed + FuelInTank.Enabled = true; + FuelGaugeButton.Enabled = true; + FifteenPercentFuelCount = 0; + ZeroPercentFuelCount = 0; + //Fuel in tank maximum value set to the fuel tank size value + FuelInTank.Maximum = FuelTankSize.Value; + //Set the 10% value of the tank + UpdateTenPercentLine(); + } + public void LoadFuelGauge(object sender, EventArgs e) + { + //Add 1 to the display fuel bar count + displayFuelBar += 1; + //Start the fuel gauge bar timer + FuelGaugeTimer.Start(); + //If the count above is odd, then display the bar + if (displayFuelBar % 2 != 0) + { + //Display the fuel gauge bar and then set the messagebox int counts to 0 + ShowFuelGauge(); + FifteenPercentFuelCount = 0; + ZeroPercentFuelCount = 0; + //If the Hud Dropout is visible, then the fuel gauge dimensions need to be set for the dropout HUD + if (huddropout) + { + //Set the width and height variables to be the same as the Hud Dropout form's width and height + int width = dropoutHUDForm.Width; + int height = dropoutHUDForm.Height; + //Resize the fuel gauge bar on the hud dropout correctly + FuelGaugeHUDDropoutDimensions(width, height); + } + } + //Else if the count for displaying the fuel gauge bar is a number divisible by 2, then hide the bar + else if (displayFuelBar % 2 == 0) + { + //Rename fuel gauge button and reset the font size + FuelGaugeButton.Text = "Show Fuel Gauge"; + FuelGaugeButton.Font = new Font(FuelGaugeButton.Font.FontFamily, 7); + //Hide the fuel gauge + FuelGaugeBar.Visible = false; + FuelGaugeBar.Hide(); + FuelGaugeBar.Update(); + FuelGaugeBar.Invalidate(); + //Reset the display fuel gauge variable to 0 so that the next time the button is pressed, the fuel gauge will be shown. + displayFuelBar = 0; + } + } + private decimal LitresOfFuel() + { + //Variable for the efi_fuelconsumed from MAVlink (in grams) and convert to decimals + var dataSource = MainV2.comPort.MAV.cs.efi_fuelconsumed; + decimal value = Convert.ToDecimal(dataSource); + //Variable for the Ratio conversion: grams/Litre 1000/736 + decimal ratioValue = Convert.ToDecimal(1.358695652173913); + //Formula to calculate the amount of litres that the data source is from (efi_fuelconsumed) + decimal millilitresOfFuelConsumed = Math.Round(Convert.ToDecimal((value * ratioValue)), 2); + //Total fuel input capacity below is the value of the input field value of fuel added into the fuel tank + //Total fuel input available + decimal totalFuelInputCapacity = Math.Round(Convert.ToDecimal(this.FuelInTank.Value), 2); + //Total fuel left in Millilitres + MillilitresOfFuelRemaining = totalFuelInputCapacity - millilitresOfFuelConsumed; + return MillilitresOfFuelRemaining; + } + private void MessageBoxTimer_Tick(object sender, EventArgs e) + { + //Variable for the percentage of the fuel used + var percentageFuelUsed = 1 - (MillilitresOfFuelRemaining / FuelTankSize.Value); + //If the percentage ratio is greater than 0 and less than 1, display message box for the user to inform the user that the fuel is below 15% + if (percentageFuelUsed > 0 && percentageFuelUsed < 1) + { + //If message box timer is ticking, display the message box and stop the message box timer + if (FuelGaugeMessageBoxTimer.Enabled) + { + //Disable the messagebox timer + FuelGaugeMessageBoxTimer.Enabled = false; + //Stop the Timer + FuelGaugeMessageBoxTimer.Stop(); + //Show a customMessageBox + CustomMessageBox.Show("The fuel level of the vehicle is below 15%", $"{(CustomMessageBox.MessageBoxIcon.Warning, "Fuel below 15%")}"); + } + else if (FuelGaugeMessageBoxTimer.Enabled != true) + { + //Disable the messagebox timer + FuelGaugeMessageBoxTimer.Enabled = false; + //Stop the Timer + FuelGaugeMessageBoxTimer.Stop(); + return; + } + } + //Else if the percentage ratio is greater or equal to 1, display message box for the user to inform the user that the fuel is depleted + else if (percentageFuelUsed >= 1) + { + //If message box timer is ticking, display the message box and stop the message box timer + if (FuelGaugeMessageBoxTimer.Enabled) + { + //Disable the message box timer + FuelGaugeMessageBoxTimer.Enabled = false; + //Stop the Timer + FuelGaugeMessageBoxTimer.Stop(); + //Show a custom message box + CustomMessageBox.Show("The fuel for the vehicle has depleted", $"{(CustomMessageBox.MessageBoxIcon.Warning, "No Fuel")}"); + } + else if (FuelGaugeMessageBoxTimer.Enabled != true) + { + //Disable the messagebox timer + FuelGaugeMessageBoxTimer.Enabled = false; + //Stop the Timer + FuelGaugeMessageBoxTimer.Stop(); + return; + } + } + } + private void FuelGaugeTimer_Tick(object sender, EventArgs e) + { + try + { + //Set the amount of Milliliters + LitresOfFuel(); + //Percentage variable for colors of fuel gauge + //30 Percent + var thirtyPercRemaining = Math.Round(Convert.ToDecimal(0.3), 2) * Math.Round(Convert.ToDecimal(this.FuelTankSize.Value), 2); + //15 Percent + var fifteenPercRemaining = Math.Round(Convert.ToDecimal(0.15), 2) * Math.Round(Convert.ToDecimal(this.FuelTankSize.Value), 2); + //Variable for the Chart Color + var barColour = ChartColour(); + //Change the colour based on the amount of fuel remaining + if (Convert.ToInt32(MillilitresOfFuelRemaining) > thirtyPercRemaining) + { + FuelGaugeBar.ForeColor = Color.Transparent; + FuelGaugeBar.ValueColor = barColour; + } + else if (Convert.ToInt32(MillilitresOfFuelRemaining) <= thirtyPercRemaining && Convert.ToInt32(MillilitresOfFuelRemaining) > fifteenPercRemaining) + { + FuelGaugeBar.ForeColor = Color.Transparent; + FuelGaugeBar.ValueColor = barColour; + } + else if (Convert.ToInt32(MillilitresOfFuelRemaining) <= fifteenPercRemaining && Convert.ToInt32(MillilitresOfFuelRemaining) > 0) + { + FuelGaugeBar.ForeColor = Color.Transparent; + FuelGaugeBar.ValueColor = barColour; + if (FifteenPercentFuelCount == 0) + { + //If the vehicle is armed start the message box timer to display the message box + var isitarmed = MainV2.comPort.MAV.cs.armed; + if (isitarmed) + { + //Set the timer interval + FuelGaugeMessageBoxTimer.Interval = 100; + //Start the timer for the message box to display - below 15% remaining + FuelGaugeMessageBoxTimer.Start(); + FifteenPercentFuelCount = 1; + } + } + //If the amount in the tank is under 10%, show one color, else show another color + if (MillilitresOfFuelRemaining < (decimal)(TenPercentFuelTankSize)) + { + FuelGaugeBar.BackColor = System.Drawing.Color.White; + } + else + { + FuelGaugeBar.BackColor = System.Drawing.Color.DarkGray; + } + } + else if (Convert.ToInt32(MillilitresOfFuelRemaining) <= 0) + { + if (ZeroPercentFuelCount == 0) + { + //If the vehicle is armed start the message box timer to display the message box + var isitarmed = MainV2.comPort.MAV.cs.armed; + if (isitarmed) + { + //Set the timer interval + FuelGaugeMessageBoxTimer.Interval = 100; + //Start the timer for the message box to display - fuel depleted + FuelGaugeMessageBoxTimer.Start(); + ZeroPercentFuelCount = 1; + } + } + } + //Set the value of the bar chart to be the estimated calculated Milliliters remaining in the tank + FuelGaugeBar.Value = Convert.ToInt32(MillilitresOfFuelRemaining); + //Add the tooltip to the fuel gauge bar - constantly updated in the timer tick function + FuelGaugeToolTip.SetToolTip(FuelGaugeBar, $"Fuel remaining: {MillilitresOfFuelRemaining} ml"); + //Update the Fuel Gauge + FuelGaugeBar.Update(); + FuelGaugeBar.Invalidate(); + } + catch (Exception ex) + { + CustomMessageBox.Show(ex.Message); + } + } + private void ArmStatus_Timer(object sender, EventArgs e) + { + //Enable/disable the fuel gauge controls if the vehicle is disarmed/armed, respectively + var isitarmed = MainV2.comPort.MAV.cs.armed; + if (isitarmed == true) + { + ArmedStatusFuelGauge(); + } + else if (isitarmed == false) + { + DisArmedStatusFuelGauge(); + } + } + private void FuelGaugeContextMenuStripItem_Click(object sender, EventArgs e) + { + //Make the presistent panel visible + MainV2.instance.FlightData.panel_persistent.Visible = true; + //Set the arm status timer interval to 3.5 seconds + ArmStatusTimer.Interval = 3500; + //Check the arm status and keep the buttons armed/disarmed accordingly + ArmStatusTimer.Tick += new EventHandler(ArmStatus_Timer); + //Add 1 to the display controls int. + displayFuelGaugeControls += 1; + if (displayFuelGaugeControls % 2 != 0) + { + //Start the Arm status timer + ArmStatusTimer.Start(); + //Load the fuel gauge controls when the strip menu item for the fuel gauge is clicked every second time + FuelGaugeControls_Load(); + } + else if (displayFuelGaugeControls % 2 == 0) + { + //Stop the Arm Status timer + ArmStatusTimer.Stop(); + //Hide all of the fuel gauge controls when the strip menu item is clicked every second click + FuelGaugeControls_Hide(); + } + //Display the controls on the persistent panel for the fuel gauge + ControlDimensions(); + //Fuel tank size and fuel in tank inputs value changed event handlers + FuelInTank.ValueChanged += new EventHandler(FuelinTank_ValueChanged); + FuelTankSize.ValueChanged += new EventHandler(FuelTankSize_ValueChanged); + //Fuel tank size and fuel in tank inputs key down event handlers + FuelTankSize.KeyDown += new KeyEventHandler(FuelTankSize_KeyDown); + FuelInTank.KeyDown += new KeyEventHandler(FuelinTank_KeyDown); + //Fuel gauge button event handler + FuelGaugeButton.Click += new EventHandler(LoadFuelGauge); + //Fuel tank size button eventhandler + FuelTankSizeButton.Click += new EventHandler(SetFuelTankSize_Click); + //The following two resize event handlers are to resize the controls on the persistent panel and resize the fuel gauge bar, respectively. + MainV2.instance.FlightData.panel_persistent.Resize += new EventHandler(PersistentPanelFuelGaugeControls_Resize); + MainV2.instance.FlightData.gMapControl1.Resize += new EventHandler(FuelGauge_Resize); + //Set the back color of the bar + FuelGaugeBar.BackColor = System.Drawing.Color.DarkGray; + //Set the value color of the fuel bar + FuelGaugeBar.ValueColor = ChartColour(); + //Set the Border color of the bar + FuelGaugeBar.BorderColor = Color.Transparent; + //Set the Color for the bar at the start + FuelGaugeBar.ForeColor = Color.Lime; + //Add the bar control to the HUD + hud1.Controls.Add(FuelGaugeBar); + //Set the 10% for the fuel gauge + UpdateTenPercentLine(); + //Time interval for the timer + FuelGaugeTimer.Interval = 1000; + //Timer event handler + FuelGaugeTimer.Tick += new EventHandler(FuelGaugeTimer_Tick); + //Message box timer event handler + FuelGaugeMessageBoxTimer.Tick += new EventHandler(MessageBoxTimer_Tick); + //Minimum size of the persistent panel + MainV2.instance.FlightData.panel_persistent.MinimumSize = new System.Drawing.Size(0, 35); + } private void hud1_Load(object sender, EventArgs e) { diff --git a/GCSViews/FlightData.resx b/GCSViews/FlightData.resx index 1bb5e9051c..1b0c81f794 100644 --- a/GCSViews/FlightData.resx +++ b/GCSViews/FlightData.resx @@ -144,97 +144,103 @@ 714, 17 - 187, 22 + 236, 26 Record Hud to AVI - 187, 22 + 236, 26 Stop Record - 187, 22 + 236, 26 Set MJPEG source - 187, 22 + 236, 26 Start Camera - 187, 22 + 236, 26 Set GStreamer Source - 187, 22 + 236, 26 HereLink Video - 187, 22 + 236, 26 GStreamer Stop - 176, 22 + 209, 24 Video - 176, 22 + 209, 24 Set Aspect Ratio - 176, 22 + 209, 24 User Items - 176, 22 + 209, 24 Russian Hud - 176, 22 + 209, 24 Swap With Map - 176, 22 + 209, 24 Ground Color - 176, 22 + 209, 24 Battery Cell Voltage - 176, 22 + 209, 24 Show icons + + 209, 24 + + + Fuel Gauge + - 177, 180 + 210, 220 contextMenuStripHud @@ -289,19 +295,19 @@ 491, 57 - 130, 22 + 147, 24 Customize - 130, 22 + 147, 24 MultiLine - 131, 48 + 148, 52 contextMenuStripactionstab @@ -325,19 +331,19 @@ 696, 57 - 154, 22 + 178, 24 Set View Count - 154, 22 + 178, 24 Undock - 155, 48 + 179, 52 contextMenuStripQuickView @@ -562,7 +568,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="quickView6" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="quickView5" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="quickView4" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="quickView3" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="quickView2" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="quickView1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,50,Percent,50" /><Rows Styles="Percent,33.33333,Percent,33.33333,Percent,33.33333" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="quickView6" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="quickView5" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="quickView4" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="quickView3" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="quickView2" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="quickView1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,50,Percent,50" /><Rows Styles="Percent,33,33333,Percent,33,33333,Percent,33,33333" /></TableLayoutSettings> 4, 44 @@ -694,7 +700,7 @@ modifyandSetLoiterRad - MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -745,7 +751,7 @@ 3, 3 - 51, 28 + 51, 33 59 @@ -853,7 +859,7 @@ modifyandSetAlt - MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -889,7 +895,7 @@ modifyandSetSpeed - MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 @@ -910,7 +916,7 @@ 3, 39 - 51, 28 + 51, 33 72 @@ -1135,7 +1141,7 @@ 3, 111 - 51, 28 + 51, 33 82 @@ -1261,7 +1267,7 @@ 3, 75 - 51, 28 + 51, 33 70 @@ -1582,7 +1588,7 @@ checkListControl1 - MissionPlanner.Controls.PreFlight.CheckListControl, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.PreFlight.CheckListControl, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null tabPagePreFlight @@ -2555,7 +2561,7 @@ 113, 89 - 77, 20 + 77, 22 24 @@ -2576,7 +2582,7 @@ 113, 63 - 77, 20 + 77, 22 23 @@ -2603,7 +2609,7 @@ 64, 89 - 35, 13 + 43, 16 22 @@ -2633,7 +2639,7 @@ 64, 63 - 25, 13 + 29, 16 21 @@ -2663,7 +2669,7 @@ 113, 31 - 77, 26 + 77, 30 18 @@ -2690,7 +2696,7 @@ 113, 6 - 77, 20 + 77, 23 14 @@ -2786,7 +2792,7 @@ 64, 37 - 46, 13 + 55, 16 17 @@ -2816,7 +2822,7 @@ 64, 11 - 43, 13 + 52, 16 16 @@ -3071,7 +3077,7 @@ servoOptions1 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3092,7 +3098,7 @@ servoOptions2 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3113,7 +3119,7 @@ servoOptions3 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3134,7 +3140,7 @@ servoOptions4 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3155,7 +3161,7 @@ servoOptions5 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3176,7 +3182,7 @@ servoOptions6 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3197,7 +3203,7 @@ servoOptions7 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3218,7 +3224,7 @@ servoOptions8 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3239,7 +3245,7 @@ servoOptions9 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3260,7 +3266,7 @@ servoOptions10 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3281,7 +3287,7 @@ servoOptions11 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3302,7 +3308,7 @@ servoOptions12 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3323,7 +3329,7 @@ relayOptions1 - MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3344,7 +3350,7 @@ relayOptions2 - MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3365,7 +3371,7 @@ relayOptions3 - MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3386,7 +3392,7 @@ relayOptions4 - MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3407,7 +3413,7 @@ relayOptions5 - MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3428,7 +3434,7 @@ relayOptions6 - MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.RelayOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -3503,7 +3509,7 @@ auxOptions1 - MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -3524,7 +3530,7 @@ auxOptions2 - MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -3545,7 +3551,7 @@ auxOptions3 - MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -3566,7 +3572,7 @@ auxOptions4 - MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -3587,7 +3593,7 @@ auxOptions5 - MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -3608,7 +3614,7 @@ auxOptions6 - MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -3629,7 +3635,7 @@ auxOptions7 - MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.AuxOptions, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null flowLayoutPanel1 @@ -3698,7 +3704,7 @@ 19, 48 - 143, 17 + 176, 20 91 @@ -3758,7 +3764,7 @@ 19, 29 - 111, 13 + 137, 16 89 @@ -3848,7 +3854,7 @@ 19, 10 - 160, 13 + 194, 16 86 @@ -3959,7 +3965,7 @@ 6, 19 - 51, 20 + 51, 22 3 @@ -3989,7 +3995,7 @@ True - 104, 45 + 104, 56 1 @@ -4034,7 +4040,7 @@ 6, 18 - 51, 20 + 51, 22 3 @@ -4058,7 +4064,7 @@ 63, 18 - 104, 45 + 104, 56 1 @@ -4136,7 +4142,7 @@ Vertical - 45, 104 + 56, 104 1 @@ -4157,7 +4163,7 @@ 6, 18 - 50, 20 + 50, 22 3 @@ -4241,7 +4247,7 @@ 49, 7 - 38, 13 + 48, 16 84 @@ -4943,7 +4949,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="BUT_DFMavlink" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="BUT_georefimage" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="BUT_logbrowse" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="BUT_matlab" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="but_bintolog" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="but_dflogtokml" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="BUT_loganalysis" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /></Controls><Columns Styles="Percent,33.33333,Percent,33.33333,Percent,33.33333" /><Rows Styles="Percent,33.33333,Percent,33.33333,Percent,33.33333" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="BUT_DFMavlink" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="BUT_georefimage" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="BUT_logbrowse" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="BUT_matlab" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="but_bintolog" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="but_dflogtokml" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="BUT_loganalysis" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /></Controls><Columns Styles="Percent,33,33333,Percent,33,33333,Percent,33,33333" /><Rows Styles="Percent,33,33333,Percent,33,33333,Percent,33,33333" /></TableLayoutSettings> 4, 44 @@ -5138,115 +5144,115 @@ 444, 17 - 187, 22 + 220, 24 Fly To Here - 187, 22 + 220, 24 Fly To Here Alt - 187, 22 + 220, 24 Fly To Coords - 121, 22 + 152, 26 Delete - 121, 22 + 152, 26 Save File - 121, 22 + 152, 26 Load File - 121, 22 + 152, 26 Coords - 187, 22 + 220, 24 Add Poi - 187, 22 + 220, 24 Point Camera Here - 187, 22 + 220, 24 Point Camera Coords - 187, 22 + 220, 24 Trigger Camera NOW - 187, 22 + 220, 24 Flight Planner - 176, 22 + 222, 26 Set EKF Origin Here - 176, 22 + 222, 26 Set Home Here - 187, 22 + 220, 24 Set Home Here - 187, 22 + 220, 24 TakeOff - 187, 22 + 220, 24 Camera Overlap - 187, 22 + 220, 24 Jump To Tag - 188, 290 + 221, 292 contextMenuStripMap @@ -5300,7 +5306,7 @@ distanceBar1 - MissionPlanner.Controls.DistanceBar, MissionPlanner, Version=1.3.8313.24739, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.DistanceBar, MissionPlanner, Version=1.3.8699.17526, Culture=neutral, PublicKeyToken=null splitContainer1.Panel2 @@ -5348,7 +5354,7 @@ 332, 167 - 96, 13 + 118, 16 74 @@ -5381,7 +5387,7 @@ 245, 167 - 81, 13 + 102, 16 73 @@ -5414,7 +5420,7 @@ 135, 167 - 104, 13 + 124, 16 71 @@ -5447,7 +5453,7 @@ 45, 167 - 84, 13 + 104, 16 72 @@ -5543,7 +5549,7 @@ 0, 0, 0, 0 - 550, 197 + 539, 197 0 @@ -5567,13 +5573,13 @@ NoControl - 550, 0 + 539, 0 Vertical - 45, 197 + 56, 197 72 @@ -5654,7 +5660,7 @@ 438, 2 - 76, 20 + 76, 22 69 @@ -5714,10 +5720,10 @@ NoControl - 325, 3 + 325, 0 - 70, 17 + 83, 20 68 @@ -5750,10 +5756,10 @@ NoControl - 260, 3 + 260, 0 - 59, 17 + 70, 20 62 @@ -6136,6 +6142,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + jumpToTagToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + bindingSource1 @@ -6178,10 +6190,10 @@ System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - jumpToTagToolStripMenuItem + + FuelGaugeToolStripMenuItem - + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 From a6b66a297dbcdf5990c9e4eade760315225970f5 Mon Sep 17 00:00:00 2001 From: Matthew Clarke Date: Fri, 27 Oct 2023 13:16:32 +0200 Subject: [PATCH 2/2] Update: User to specify the fuel Density - this would be the same value as set in the Config Parameters labelled: 'EFI_FUEL_DENS' --- GCSViews/FlightData.cs | 132 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 125 insertions(+), 7 deletions(-) diff --git a/GCSViews/FlightData.cs b/GCSViews/FlightData.cs index ec9579740b..f597e231c7 100644 --- a/GCSViews/FlightData.cs +++ b/GCSViews/FlightData.cs @@ -63,6 +63,10 @@ public partial class FlightData : MyUserControl, IActivate, IDeactivate NumericUpDown FuelTankSize = new NumericUpDown { Visible = false }; //Button to set the fuel tank size MyButton FuelTankSizeButton = new MyButton { Visible = false }; + //variable for setting fuel density of the fuel used - used in calculation for the fuel consumption in mililitres + decimal EFIFuelDensity = 0; + //Button to set the fuel density + MyButton EFIFuelDensityButton = new MyButton { Visible = false }; //Vertical progress bar used for the fuel gauge VerticalProgressBar2 FuelGaugeBar = new VerticalProgressBar2 { Visible = false, Enabled = false, BackgroundColor = Color.DarkSlateGray, Text = string.Empty, ValueColor = Color.DarkSlateGray }; //Tooltip for Fuel Gauge @@ -85,7 +89,12 @@ public partial class FlightData : MyUserControl, IActivate, IDeactivate decimal MillilitresOfFuelRemaining = 0; //Variable count for displaying/hiding the fuel bar only int displayFuelBar = 0; - + //Input Field for the fuel density value + NumericUpDown FuelDensityInput = new NumericUpDown(); + //Button for the fuel density form + Button SetDensityButton = new Button(); + //Bool for Fuel Density + bool FuelDensityClicked = false; //Dropout HUD Form Form dropoutHUDForm = new Form(); @@ -2658,6 +2667,8 @@ private void FlightData_Load(object sender, EventArgs e) hud1.doResize(); //Tool strip menu item click event handler for Fuel Gauge FuelGaugeToolStripMenuItem.Click += new EventHandler(FuelGaugeContextMenuStripItem_Click); + //Fuel density button eventhandler + EFIFuelDensityButton.Click += new EventHandler(SetFuelDensity_Click); prop = new Propagation(gMapControl1); splitContainer1.Panel1Collapsed = true; @@ -5940,6 +5951,10 @@ private void ControlDimensions() //Set location and size for fuel gauge button FuelGaugeButton.Location = new Point(FuelTankSizeButton.Location.X, FuelTankSizeButton.Bottom + 2); FuelGaugeButton.Size = FuelTankSizeButton.Size; + //Size and location for the fuel density button + var fuelDensityButtonLocationX = FuelTankSizeButton.Location.X - (int)(FuelTankSizeButton.Width*0.8) - 3; + EFIFuelDensityButton.Location = new Point((int)(fuelDensityButtonLocationX), (int)(3)); + EFIFuelDensityButton.Size = new Size((int)(0.8 * FuelTankSizeButton.Width),(int)(FuelTankSizeButton.Height)); } private void PersistentPanelFuelGaugeControls_Resize(object sender, EventArgs e) { @@ -5957,6 +5972,7 @@ private void FuelGaugeControls_Hide() FuelGaugeBar.Update(); FuelGaugeBar.Invalidate(); FuelGaugeBar.Visible = false; + EFIFuelDensityButton.Visible = false; //Set the display fuel bar int value to 0 when hiding the fuel gauge - this is to ensure when the button to display the fuel gauge is clicked, the ShowFuelGauge() method will be used. displayFuelBar = 0; //Set the back colour of the strip menu item for when the Fuel Gaugeis no displaying @@ -5965,8 +5981,12 @@ private void FuelGaugeControls_Hide() private void DisArmedStatusFuelGauge() { //Enable controls - FuelTankSizeButton.Enabled = true; - FuelTankSize.Enabled = true; + if (FuelDensityClicked == true) + { + FuelTankSizeButton.Enabled = true; + FuelTankSize.Enabled = true; + } + EFIFuelDensityButton.Enabled = true; } private void ArmedStatusFuelGauge() { @@ -5974,6 +5994,7 @@ private void ArmedStatusFuelGauge() FuelTankSizeButton.Enabled = false; FuelTankSize.Enabled = false; FuelInTank.Enabled = false; + EFIFuelDensityButton.Enabled = false; //Keep the Fuel gauge button enabled so the user will be able to show/hide the bar on the hud while the vehicle is armed FuelGaugeButton.Enabled = true; } @@ -5994,8 +6015,17 @@ private void FuelGaugeControls_Load() var isitarmed = MainV2.comPort.MAV.cs.armed; if (!isitarmed) { - FuelTankSizeButton.Enabled = true; - FuelTankSize.Enabled = true; + //If the fuel density button has been clicked, then can make the tank size controls enabled to use + if (FuelDensityClicked) + { + FuelTankSizeButton.Enabled = true; + FuelTankSize.Enabled = true; + } + else + { + FuelTankSizeButton.Enabled = false; + FuelTankSize.Enabled = false; + } } else if (isitarmed) { @@ -6015,11 +6045,17 @@ private void FuelGaugeControls_Load() //Set the fuel in tank input to false and display the field FuelInTank.Enabled = false; FuelInTank.Visible = true; + //Setup fuel density button + EFIFuelDensityButton.Enabled = true; + EFIFuelDensityButton.Visible = true; + EFIFuelDensityButton.Text = "Set Fuel Density"; + EFIFuelDensityButton.Font = new Font(FuelGaugeButton.Font.FontFamily, 6); //Set Tool Tips for the controls on the persistent panel FuelGaugeToolTip.SetToolTip(FuelGaugeButton, "Fuel set in milliliters"); FuelGaugeToolTip.SetToolTip(FuelTankSizeButton, "Fuel set in milliliters"); FuelGaugeToolTip.SetToolTip(FuelTankSize, "Fuel set in milliliters"); FuelGaugeToolTip.SetToolTip(FuelInTank, "Fuel set in milliliters"); + FuelGaugeToolTip.SetToolTip(EFIFuelDensityButton, "Set fuel Density (g)"); //Display and add the controls to the persistent panel FuelInTank.Show(); FuelInTank.BringToFront(); @@ -6036,11 +6072,16 @@ private void FuelGaugeControls_Load() FuelTankSize.Show(); FuelTankSize.BringToFront(); FuelTankSize.Update(); - FuelTankSize.Invalidate(); + FuelTankSize.Invalidate(); + EFIFuelDensityButton.Show(); + EFIFuelDensityButton.BringToFront(); + EFIFuelDensityButton.Update(); + EFIFuelDensityButton.Invalidate(); MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelInTank); MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelGaugeButton); MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelTankSize); MainV2.instance.FlightData.panel_persistent.Controls.Add(FuelTankSizeButton); + MainV2.instance.FlightData.panel_persistent.Controls.Add(EFIFuelDensityButton); } private void UpdateTenPercentLine() { @@ -6325,7 +6366,7 @@ private decimal LitresOfFuel() var dataSource = MainV2.comPort.MAV.cs.efi_fuelconsumed; decimal value = Convert.ToDecimal(dataSource); //Variable for the Ratio conversion: grams/Litre 1000/736 - decimal ratioValue = Convert.ToDecimal(1.358695652173913); + decimal ratioValue = Math.Round(Convert.ToDecimal(Math.Round(Convert.ToDecimal(1000),2) / Math.Round(Convert.ToDecimal(EFIFuelDensity),2)),15); //Formula to calculate the amount of litres that the data source is from (efi_fuelconsumed) decimal millilitresOfFuelConsumed = Math.Round(Convert.ToDecimal((value * ratioValue)), 2); //Total fuel input capacity below is the value of the input field value of fuel added into the fuel tank @@ -6477,6 +6518,77 @@ private void ArmStatus_Timer(object sender, EventArgs e) DisArmedStatusFuelGauge(); } } + //Function: Set the Fuel Density Value in grams into the EFI Fuel Density variable + private void SetFuelDensityValue() + { + //Set the fuel density input variable + EFIFuelDensity = (FuelDensityInput.Value); + FuelDensityClicked = true; + FuelGaugeToolTip.SetToolTip(EFIFuelDensityButton, "Fuel density set to: " + EFIFuelDensity + " grams"); + return; + } + private void SetDensityValueGrams(object sender, EventArgs e) + { + SetFuelDensityValue(); + } + private void FuelDensity_ValueChanged(object sender, EventArgs e) + { + //Enable the button if the density input value is greater than 0 + if (FuelDensityInput.Value<=0) + { + SetDensityButton.Enabled = false; + } + else if (FuelDensityInput.Value>0) + { + SetDensityButton.Enabled = true; + } + } + private void FuelDensity_KeyDown(object sender, KeyEventArgs k) + { + //If the enter button is pressed, make the fuel in tank maximum value equal to the fuelTankSize value + if (k.KeyValue == (char)Keys.Enter) + { + SetFuelDensityValue(); + return; + } + } + private void SetFuelDensity_Click(object sender, EventArgs e) + { + //Setup the Fuel Density form + Form DensityForm = new Form(); + DensityForm.Name = $"Fuel Density"; + DensityForm.Text = DensityForm.Name; + DensityForm.Size = new System.Drawing.Size(315, 170); + DensityForm.MinimumSize = DensityForm.Size; + DensityForm.MaximumSize = DensityForm.Size; + //DensityForm.MaximumSize = DensityForm.Size; + //Setup the label text for the form + RichTextBox rtxFuelDensity = new RichTextBox(); + rtxFuelDensity.Text = "Set the weight per litre of the fuel being used, in grams, for the fuel consumption calculation.\n(This will be the same value as the EFI_FUEL_DENS parameter set in the configuration settings)\nThis value only needs to be reset when Mission Planner is reopened."; + //lblFuelDensity.ForeColor = Color.Black; + rtxFuelDensity.SelectionColor = Color.Black; + rtxFuelDensity.Font = new Font(rtxFuelDensity.Font.FontFamily, 9); + rtxFuelDensity.Location = new Point(2, 1); + rtxFuelDensity.Size = new Size(DensityForm.Width-21,90); + rtxFuelDensity.ReadOnly = true; + //Setup the input - fuel density field + FuelDensityInput.Size = new System.Drawing.Size(80, 20); + FuelDensityInput.Location = new System.Drawing.Point(75, 100); + FuelDensityInput.Maximum = 10000; + //Setup the Button - set the fuel density + SetDensityButton.AutoSize = true; + SetDensityButton.Text = $"Set"; + SetDensityButton.Enabled = true; + var locationButton = new System.Drawing.Point((int)(FuelDensityInput.Location.X + FuelDensityInput.Width+5), (int)(100)); + SetDensityButton.Location = locationButton; + SetDensityButton.Size = FuelDensityInput.Size; + //Add controls to the Fue Density Form + DensityForm.Controls.Add(FuelDensityInput); + DensityForm.Controls.Add(SetDensityButton); + DensityForm.Controls.Add(rtxFuelDensity); + DensityForm.ShowDialog(); + return; + } private void FuelGaugeContextMenuStripItem_Click(object sender, EventArgs e) { //Make the presistent panel visible @@ -6503,6 +6615,11 @@ private void FuelGaugeContextMenuStripItem_Click(object sender, EventArgs e) } //Display the controls on the persistent panel for the fuel gauge ControlDimensions(); + //Value Change EventHandler + FuelDensityInput.ValueChanged += new EventHandler(FuelDensity_ValueChanged); + //Fuel Density button click event handler + SetDensityButton.Click += new EventHandler(SetDensityValueGrams); + FuelDensityInput.KeyDown += new KeyEventHandler(FuelDensity_KeyDown); //Fuel tank size and fuel in tank inputs value changed event handlers FuelInTank.ValueChanged += new EventHandler(FuelinTank_ValueChanged); FuelTankSize.ValueChanged += new EventHandler(FuelTankSize_ValueChanged); @@ -6536,6 +6653,7 @@ private void FuelGaugeContextMenuStripItem_Click(object sender, EventArgs e) FuelGaugeMessageBoxTimer.Tick += new EventHandler(MessageBoxTimer_Tick); //Minimum size of the persistent panel MainV2.instance.FlightData.panel_persistent.MinimumSize = new System.Drawing.Size(0, 35); + return; } private void hud1_Load(object sender, EventArgs e) {