diff --git a/3DRRadio/ChangeLog.txt b/3DRRadio/ChangeLog.txt index 4a9f34cc3f..35fa072712 100644 --- a/3DRRadio/ChangeLog.txt +++ b/3DRRadio/ChangeLog.txt @@ -1,11 +1,12 @@ -1.0a - fix 868 freq range -1.0 - added rf freeq for 868 -0.9 - added rfd900a -0.8 - fix settings saving. -0.7 - fix typos - log rssi screen to log as well -0.6 - add terminal logging to file, fix remote radio config -0.5 - add terminal -0.4 - adjust erase timeout - to prevent lost bootloader sync error. -0.3 - add RFD900 support -0.2 - change packet size to 32 bytes -0.1 - Initial Release - Based off code by Mike Smith +1.02 - fix frequency display and add device id +1.0a - fix 868 freq range +1.0 - added rf freeq for 868 +0.9 - added rfd900a +0.8 - fix settings saving. +0.7 - fix typos - log rssi screen to log as well +0.6 - add terminal logging to file, fix remote radio config +0.5 - add terminal +0.4 - adjust erase timeout - to prevent lost bootloader sync error. +0.3 - add RFD900 support +0.2 - change packet size to 32 bytes +0.1 - Initial Release - Based off code by Mike Smith diff --git a/3DRRadio/Config.resx b/3DRRadio/Config.resx index fb7244e7a0..71a1f3f567 100644 --- a/3DRRadio/Config.resx +++ b/3DRRadio/Config.resx @@ -1591,7 +1591,7 @@ - 3DRRadio Config 1.01 + 3DRRadio Config 1.02 settingsToolStripMenuItem diff --git a/ChangeLog.txt b/ChangeLog.txt index 4e26373a91..ddcbf8d717 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,28 @@ -* Mission Planner 1.2.85 +* Mission Planner 1.2.86 +spline display support +doublebuffer quick view +move hud message text to bottom of hud & always ontop +fix processreporterdialog size on mono +add iris defaults to full param list +fix rally point alt +close comport on log download close +close logbrowse on no file picked +add internal plla to vector3 +make mavlink log selection form close on new log load +increase multiple timeouts on mavlink interface - ms +- setparam 500 > 700 +- get wp count 500 > 700 +- set wp 150 > 700 +- get fence point 500 > 700 +- get rally point 500 > 700 +add better high prio severity message parsing. +fix 3dr radio config device id +update H frame icons to I +tweak wizard connect +increase connect time - other boards compatability +remove no rc receiver temp + +* Mission Planner 1.2.85 update map library - this will invalidate your map prefetch remove arial narrow and Century Gothic font issues add ability to load a kml linestring as a mission diff --git a/Controls/ConnectionStats.Designer.cs b/Controls/ConnectionStats.Designer.cs index a764f12b21..3827137056 100644 --- a/Controls/ConnectionStats.Designer.cs +++ b/Controls/ConnectionStats.Designer.cs @@ -13,6 +13,9 @@ partial class ConnectionStats /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { + if (_subscriptionsDisposable != null) + _subscriptionsDisposable.Dispose(); + if (disposing && (components != null)) { components.Dispose(); diff --git a/Controls/Waypoints/Spline.cs b/Controls/Waypoints/Spline.cs new file mode 100644 index 0000000000..c64160e654 --- /dev/null +++ b/Controls/Waypoints/Spline.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using MissionPlanner.HIL; +using MissionPlanner.Utilities; + +namespace MissionPlanner.Controls.Waypoints +{ + public class Spline: MissionPlanner.HIL.Utils + { + float spline_t; + Vector3 current_position; + Vector3 spline_start_point; + Vector3 spline_target; + Vector3 spline_p0; + Vector3 spline_p0_prime; + Vector3 spline_p1; + Vector3 spline_p1_prime; + Vector3 spline_p2; + Vector3 spline_a; + Vector3 spline_b; + private float SPLINE_TENSION = 1.6f; + private float spline_t_sq; + + List wplist; + int wpindex = 0; + + public List doit(List wplist, int steps) + { + SPLINE_TENSION = 1.6f; + this.wplist = wplist; + + List answer = new List(); + + spline_t = spline_t_sq = 0.0f; + + current_position = wplist[0]; + + // set spline p0, p1, p2, and p0 prime + spline_p0 = spline_start_point = current_position; + spline_p1 = next_spline_waypoint(); + spline_p2 = next_spline_waypoint(); + spline_p0_prime = new Vector3(); + spline_p0_prime.x = 0;// cosf(heading_in_radians); + spline_p0_prime.y = 0;// sinf(heading_in_radians); + spline_p0_prime.z = spline_p1.z - spline_p0.z; + + initialize_spline_segment(); + + foreach (int p in range(wplist.Count-1)) { + foreach (var step in range(steps)) + { + spline_t = (1f / steps) * step; + spline_t_sq = spline_t * spline_t; + evaluate_spline(); + answer.Add(new PointLatLngAlt(spline_target.x,spline_target.y,spline_target.z,"")); + } + next_spline_segment(); + } + + + answer.Add(wplist[wplist.Count - 1]); + + + + return answer; + } + + // perform initialization in preparation for the new spline segment + void initialize_spline_segment() + { + // derivative of spline at p1 is based on difference of previous and next points + spline_p1_prime = (spline_p2 - spline_p0) / SPLINE_TENSION; + + + // compute a and b vectors used in spline formula + spline_a = spline_p0 * 2.0f - spline_p1 * 2.0f + spline_p0_prime + spline_p1_prime; + spline_b = spline_p1 * 3.0f - spline_p0 * 3.0f - spline_p0_prime * 2.0f - spline_p1_prime; + } + + // continue to the next spline segment + void next_spline_segment() + { + // start t back at near the beginning of the new segment + spline_t -= 1.0f; + + + // p1 becomes the next p01, p2 the next p1, etc. + spline_p0 = spline_p1; + spline_p1 = spline_p2; + spline_p0_prime = spline_p1_prime; + spline_p2 = next_spline_waypoint(); + + + initialize_spline_segment(); + } + + private Vector3 next_spline_waypoint() + { + wpindex++; + + if (wpindex >= wplist.Count) + { + return wplist[wplist.Count - 1]; + } + + return wplist[wpindex]; + } + + + //evaluate spline formula at point t + void evaluate_spline() + { + // evaluate spline t cubed + float t_cu = spline_t_sq * spline_t; + + spline_target = spline_a * t_cu + spline_b * spline_t_sq + spline_p0_prime * spline_t + spline_p0; + } + } +} \ No newline at end of file diff --git a/CurrentState.cs b/CurrentState.cs index ab979040e7..87bb2f5c9f 100644 --- a/CurrentState.cs +++ b/CurrentState.cs @@ -826,8 +826,9 @@ enum gcs_severity { } else if (sensors_present.rc_receiver != sensors_enabled.rc_receiver) { - messageHigh = "NO RC Receiver"; - messageHighTime = DateTime.Now; + int fixme; + //messageHigh = "NO RC Receiver"; + //messageHighTime = DateTime.Now; } diff --git a/ExtLibs/Controls/BackstageView/BackstageView.cs b/ExtLibs/Controls/BackstageView/BackstageView.cs index fc979f9b40..96db9c0122 100644 --- a/ExtLibs/Controls/BackstageView/BackstageView.cs +++ b/ExtLibs/Controls/BackstageView/BackstageView.cs @@ -171,9 +171,10 @@ public BackstageViewPage AddPage(UserControl userControl, string headerText, Bac { Page = { - Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, - Location = new Point(pnlMenu.Width, 0), - Dock = DockStyle.Fill + //Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, + Location = new Point(0, 0), + Dock = DockStyle.Fill, + Visible = false, } }; @@ -423,6 +424,7 @@ public void ActivatePage(BackstageViewPage associatedPage) MissionPlanner.Utilities.Tracking.AddPage(associatedPage.Page.GetType().ToString(), associatedPage.LinkText); this.SuspendLayout(); + associatedPage.Page.SuspendLayout(); DrawMenu(associatedPage , false); @@ -458,6 +460,10 @@ public void ActivatePage(BackstageViewPage associatedPage) ((IActivate)(associatedPage.Page)).Activate(); } + //this.PerformLayout(); + + associatedPage.Page.ResumeLayout(); + this.ResumeLayout(); // show it associatedPage.Page.Visible = true; @@ -469,8 +475,6 @@ public void ActivatePage(BackstageViewPage associatedPage) catch { } _activePage = associatedPage; - - this.ResumeLayout(); } public void Close() diff --git a/ExtLibs/Controls/HUD.cs b/ExtLibs/Controls/HUD.cs index 7264cd615d..cd4a3bd109 100644 --- a/ExtLibs/Controls/HUD.cs +++ b/ExtLibs/Controls/HUD.cs @@ -917,45 +917,8 @@ void doPaint(PaintEventArgs e) graphicsObject.SetClip(new Rectangle(0, this.Height / 14, this.Width, this.Height - this.Height / 14)); graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2); - - graphicsObject.RotateTransform(-_roll); - - - // draw armed - - if (status != statuslast) - { - armedtimer = DateTime.Now; - } - - if (status == false) // not armed - { - //if ((armedtimer.AddSeconds(8) > DateTime.Now)) - { - drawstring(graphicsObject, "DISARMED", font, fontsize + 10, (SolidBrush)Brushes.Red, -85, halfheight / -3); - statuslast = status; - } - } - else if (status == true) // armed - { - if ((armedtimer.AddSeconds(8) > DateTime.Now)) - { - drawstring(graphicsObject, "ARMED", font, fontsize + 20, (SolidBrush)Brushes.Red, -70, halfheight / -3); - statuslast = status; - } - } - - if (failsafe == true) - { - drawstring(graphicsObject, "FAILSAFE", font, fontsize + 20, (SolidBrush)Brushes.Red, -85, halfheight / -5); - statuslast = status; - } - - if (message != "" && messagetime.AddSeconds(20) > DateTime.Now) - { - drawstring(graphicsObject, message, font, fontsize + 10, (SolidBrush)Brushes.Red, -halfwidth + 50, halfheight / -2); - } + graphicsObject.RotateTransform(-_roll); //draw pitch @@ -1542,6 +1505,53 @@ void doPaint(PaintEventArgs e) catch { } } + + + + + graphicsObject.TranslateTransform(this.Width / 2, this.Height / 2); + + // draw armed + + if (status != statuslast) + { + armedtimer = DateTime.Now; + } + + if (status == false) // not armed + { + //if ((armedtimer.AddSeconds(8) > DateTime.Now)) + { + drawstring(graphicsObject, "DISARMED", font, fontsize + 10, (SolidBrush)Brushes.Red, -85, halfheight / -3); + statuslast = status; + } + } + else if (status == true) // armed + { + if ((armedtimer.AddSeconds(8) > DateTime.Now)) + { + drawstring(graphicsObject, "ARMED", font, fontsize + 20, (SolidBrush)Brushes.Red, -70, halfheight / -3); + statuslast = status; + } + } + + if (failsafe == true) + { + drawstring(graphicsObject, "FAILSAFE", font, fontsize + 20, (SolidBrush)Brushes.Red, -85, halfheight / -5); + statuslast = status; + } + + if (message != "" && messagetime.AddSeconds(20) > DateTime.Now) + { + drawstring(graphicsObject, message, font, fontsize + 10, (SolidBrush)Brushes.Red, -halfwidth + 50, halfheight / 3); + } + + + + graphicsObject.ResetTransform(); + + + if (!opengl) diff --git a/ExtLibs/Controls/MainSwitcher.cs b/ExtLibs/Controls/MainSwitcher.cs index 965cf75eff..5c86a189cd 100644 --- a/ExtLibs/Controls/MainSwitcher.cs +++ b/ExtLibs/Controls/MainSwitcher.cs @@ -79,6 +79,9 @@ public void ShowScreen(string name) // find next screen Screen nextscreen = screens.Single(s => s.Name == name); + MainControl.SuspendLayout(); + nextscreen.Control.SuspendLayout(); + nextscreen.Control.Location = new Point(0, 0); nextscreen.Control.AutoScaleMode = AutoScaleMode.None; @@ -87,13 +90,8 @@ public void ShowScreen(string name) nextscreen.Control.Dock = DockStyle.Fill; - nextscreen.Control.PerformLayout(); - MissionPlanner.Utilities.Tracking.AddPage(nextscreen.Control.GetType().ToString(), name); - MainControl.SuspendLayout(); - nextscreen.Control.SuspendLayout(); - if (nextscreen.Control is IActivate) { ((IActivate)(nextscreen.Control)).Activate(); @@ -104,8 +102,8 @@ public void ShowScreen(string name) MainControl.Controls.Add(nextscreen.Control); + nextscreen.Control.ResumeLayout(); MainControl.ResumeLayout(); - nextscreen.Control.ResumeLayout(); nextscreen.Visible = true; diff --git a/ExtLibs/Controls/MyUserControl.cs b/ExtLibs/Controls/MyUserControl.cs index 27fb8df739..42aa318d0f 100644 --- a/ExtLibs/Controls/MyUserControl.cs +++ b/ExtLibs/Controls/MyUserControl.cs @@ -6,12 +6,14 @@ using System.ComponentModel; using log4net; using System.Reflection; +using System.Runtime.InteropServices; namespace System.Windows.Forms { /// /// This is a mono fix, windows handles this error, mono crashs /// + //[assembly: ComVisible(true)] public class MyUserControl : System.Windows.Forms.UserControl { /// diff --git a/ExtLibs/Controls/ProgressReporterDialogue.cs b/ExtLibs/Controls/ProgressReporterDialogue.cs index 4c83612eef..b98b377bf1 100644 --- a/ExtLibs/Controls/ProgressReporterDialogue.cs +++ b/ExtLibs/Controls/ProgressReporterDialogue.cs @@ -47,6 +47,11 @@ public ProgressReporterDialogue() public void RunBackgroundOperationAsync() { ThreadPool.QueueUserWorkItem(RunBackgroundOperation); + + var t = Type.GetType("Mono.Runtime"); + if ((t != null)) + this.Height += 25; + this.ShowDialog(); } diff --git a/ExtLibs/Controls/ProgressReporterDialogue.designer.cs b/ExtLibs/Controls/ProgressReporterDialogue.designer.cs index 78e541eacc..0c631e34e1 100644 --- a/ExtLibs/Controls/ProgressReporterDialogue.designer.cs +++ b/ExtLibs/Controls/ProgressReporterDialogue.designer.cs @@ -131,14 +131,13 @@ private void InitializeComponent() this.Controls.Add(this.btnCancel); this.Controls.Add(this.lblProgressMessage); this.Controls.Add(this.progressBar1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ProgressReporterDialogue"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Progress"; - this.TopMost = true; this.Load += new System.EventHandler(this.ProgressReporterDialogue_Load); ((System.ComponentModel.ISupportInitialize)(this.imgWarning)).EndInit(); this.ResumeLayout(false); diff --git a/ExtLibs/Controls/QuickView.Designer.cs b/ExtLibs/Controls/QuickView.Designer.cs index 69ec525f45..12ed4ae574 100644 --- a/ExtLibs/Controls/QuickView.Designer.cs +++ b/ExtLibs/Controls/QuickView.Designer.cs @@ -29,9 +29,9 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.labelWithPseudoOpacity1 = new Controls.LabelWithPseudoOpacity(); + this.labelWithPseudoOpacity1 = new MissionPlanner.Controls.LabelWithPseudoOpacity(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.labelWithPseudoOpacity2 = new Controls.LabelWithPseudoOpacity(); + this.labelWithPseudoOpacity2 = new MissionPlanner.Controls.LabelWithPseudoOpacity(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -68,7 +68,7 @@ private void InitializeComponent() // labelWithPseudoOpacity2 // this.labelWithPseudoOpacity2.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelWithPseudoOpacity2.DoubleBuffered = false; + this.labelWithPseudoOpacity2.DoubleBuffered = true; this.labelWithPseudoOpacity2.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelWithPseudoOpacity2.Location = new System.Drawing.Point(3, 20); this.labelWithPseudoOpacity2.Name = "labelWithPseudoOpacity2"; diff --git a/GCSViews/ConfigurationView/ConfigFailSafe.Designer.cs b/GCSViews/ConfigurationView/ConfigFailSafe.Designer.cs index dfcc1684e3..80c5c16040 100644 --- a/GCSViews/ConfigurationView/ConfigFailSafe.Designer.cs +++ b/GCSViews/ConfigurationView/ConfigFailSafe.Designer.cs @@ -47,14 +47,14 @@ private void InitializeComponent() this.mavlinkCheckBoxthr_fs = new MissionPlanner.Controls.MavlinkCheckBox(); this.mavlinkComboBox_fs_thr_enable = new MissionPlanner.Controls.MavlinkComboBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.mavlinkCheckBoxFS_GCS_ENABLE = new MissionPlanner.Controls.MavlinkCheckBox(); + this.mavlinkCheckBoxfs_gps_enable = new MissionPlanner.Controls.MavlinkCheckBox(); + this.mavlinkCheckBoxfs_batt_enable = new MissionPlanner.Controls.MavlinkCheckBox(); this.pnlmah = new System.Windows.Forms.Panel(); this.label5 = new System.Windows.Forms.Label(); this.mavlinkNumericUpDownFS_BATT_MAH = new MissionPlanner.Controls.MavlinkNumericUpDown(); - this.mavlinkCheckBoxFS_GCS_ENABLE = new MissionPlanner.Controls.MavlinkCheckBox(); - this.mavlinkCheckBoxfs_gps_enable = new MissionPlanner.Controls.MavlinkCheckBox(); this.PNL_low_bat = new System.Windows.Forms.Panel(); this.label4 = new System.Windows.Forms.Label(); - this.mavlinkCheckBoxfs_batt_enable = new MissionPlanner.Controls.MavlinkCheckBox(); this.PNL_thr_fs_value = new System.Windows.Forms.Panel(); this.label3 = new System.Windows.Forms.Label(); this.lbl_armed = new MissionPlanner.Controls.MyLabel(); @@ -232,20 +232,50 @@ private void InitializeComponent() // this.groupBox1.Controls.Add(this.mavlinkCheckBoxFS_GCS_ENABLE); this.groupBox1.Controls.Add(this.mavlinkCheckBoxfs_gps_enable); - this.groupBox1.Controls.Add(this.mavlinkCheckBoxfs_batt_enable); this.groupBox1.Controls.Add(this.pnlmah); this.groupBox1.Controls.Add(this.PNL_low_bat); + this.groupBox1.Controls.Add(this.PNL_thr_fs_value); + this.groupBox1.Controls.Add(this.mavlinkCheckBoxfs_batt_enable); this.groupBox1.Controls.Add(this.mavlinkCheckBoxlong_fs); this.groupBox1.Controls.Add(this.mavlinkCheckBoxshort_fs); this.groupBox1.Controls.Add(this.mavlinkCheckBoxgcs_fs); this.groupBox1.Controls.Add(this.mavlinkCheckBoxthr_fs_action); - this.groupBox1.Controls.Add(this.PNL_thr_fs_value); this.groupBox1.Controls.Add(this.mavlinkCheckBoxthr_fs); this.groupBox1.Controls.Add(this.mavlinkComboBox_fs_thr_enable); resources.ApplyResources(this.groupBox1, "groupBox1"); this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // + // mavlinkCheckBoxFS_GCS_ENABLE + // + resources.ApplyResources(this.mavlinkCheckBoxFS_GCS_ENABLE, "mavlinkCheckBoxFS_GCS_ENABLE"); + this.mavlinkCheckBoxFS_GCS_ENABLE.Name = "mavlinkCheckBoxFS_GCS_ENABLE"; + this.mavlinkCheckBoxFS_GCS_ENABLE.OffValue = 0F; + this.mavlinkCheckBoxFS_GCS_ENABLE.OnValue = 1F; + this.mavlinkCheckBoxFS_GCS_ENABLE.param = null; + this.mavlinkCheckBoxFS_GCS_ENABLE.ParamName = null; + this.mavlinkCheckBoxFS_GCS_ENABLE.UseVisualStyleBackColor = true; + // + // mavlinkCheckBoxfs_gps_enable + // + resources.ApplyResources(this.mavlinkCheckBoxfs_gps_enable, "mavlinkCheckBoxfs_gps_enable"); + this.mavlinkCheckBoxfs_gps_enable.Name = "mavlinkCheckBoxfs_gps_enable"; + this.mavlinkCheckBoxfs_gps_enable.OffValue = 0F; + this.mavlinkCheckBoxfs_gps_enable.OnValue = 1F; + this.mavlinkCheckBoxfs_gps_enable.param = null; + this.mavlinkCheckBoxfs_gps_enable.ParamName = null; + this.mavlinkCheckBoxfs_gps_enable.UseVisualStyleBackColor = true; + // + // mavlinkCheckBoxfs_batt_enable + // + resources.ApplyResources(this.mavlinkCheckBoxfs_batt_enable, "mavlinkCheckBoxfs_batt_enable"); + this.mavlinkCheckBoxfs_batt_enable.Name = "mavlinkCheckBoxfs_batt_enable"; + this.mavlinkCheckBoxfs_batt_enable.OffValue = 0F; + this.mavlinkCheckBoxfs_batt_enable.OnValue = 1F; + this.mavlinkCheckBoxfs_batt_enable.param = null; + this.mavlinkCheckBoxfs_batt_enable.ParamName = null; + this.mavlinkCheckBoxfs_batt_enable.UseVisualStyleBackColor = true; + // // pnlmah // this.pnlmah.Controls.Add(this.label5); @@ -278,26 +308,6 @@ private void InitializeComponent() 0, 65536}); // - // mavlinkCheckBoxFS_GCS_ENABLE - // - resources.ApplyResources(this.mavlinkCheckBoxFS_GCS_ENABLE, "mavlinkCheckBoxFS_GCS_ENABLE"); - this.mavlinkCheckBoxFS_GCS_ENABLE.Name = "mavlinkCheckBoxFS_GCS_ENABLE"; - this.mavlinkCheckBoxFS_GCS_ENABLE.OffValue = 0F; - this.mavlinkCheckBoxFS_GCS_ENABLE.OnValue = 1F; - this.mavlinkCheckBoxFS_GCS_ENABLE.param = null; - this.mavlinkCheckBoxFS_GCS_ENABLE.ParamName = null; - this.mavlinkCheckBoxFS_GCS_ENABLE.UseVisualStyleBackColor = true; - // - // mavlinkCheckBoxfs_gps_enable - // - resources.ApplyResources(this.mavlinkCheckBoxfs_gps_enable, "mavlinkCheckBoxfs_gps_enable"); - this.mavlinkCheckBoxfs_gps_enable.Name = "mavlinkCheckBoxfs_gps_enable"; - this.mavlinkCheckBoxfs_gps_enable.OffValue = 0F; - this.mavlinkCheckBoxfs_gps_enable.OnValue = 1F; - this.mavlinkCheckBoxfs_gps_enable.param = null; - this.mavlinkCheckBoxfs_gps_enable.ParamName = null; - this.mavlinkCheckBoxfs_gps_enable.UseVisualStyleBackColor = true; - // // PNL_low_bat // this.PNL_low_bat.Controls.Add(this.label4); @@ -310,21 +320,11 @@ private void InitializeComponent() resources.ApplyResources(this.label4, "label4"); this.label4.Name = "label4"; // - // mavlinkCheckBoxfs_batt_enable - // - resources.ApplyResources(this.mavlinkCheckBoxfs_batt_enable, "mavlinkCheckBoxfs_batt_enable"); - this.mavlinkCheckBoxfs_batt_enable.Name = "mavlinkCheckBoxfs_batt_enable"; - this.mavlinkCheckBoxfs_batt_enable.OffValue = 0F; - this.mavlinkCheckBoxfs_batt_enable.OnValue = 1F; - this.mavlinkCheckBoxfs_batt_enable.param = null; - this.mavlinkCheckBoxfs_batt_enable.ParamName = null; - this.mavlinkCheckBoxfs_batt_enable.UseVisualStyleBackColor = true; - // // PNL_thr_fs_value // + this.PNL_thr_fs_value.Controls.Add(this.label3); this.PNL_thr_fs_value.Controls.Add(this.mavlinkNumericUpDownfs_thr_value); this.PNL_thr_fs_value.Controls.Add(this.mavlinkNumericUpDownthr_fs_value); - this.PNL_thr_fs_value.Controls.Add(this.label3); resources.ApplyResources(this.PNL_thr_fs_value, "PNL_thr_fs_value"); this.PNL_thr_fs_value.Name = "PNL_thr_fs_value"; // diff --git a/GCSViews/ConfigurationView/ConfigFailSafe.cs b/GCSViews/ConfigurationView/ConfigFailSafe.cs index d9b45a057e..2057a456a2 100644 --- a/GCSViews/ConfigurationView/ConfigFailSafe.cs +++ b/GCSViews/ConfigurationView/ConfigFailSafe.cs @@ -53,8 +53,14 @@ public void Activate() mavlinkNumericUpDownfs_thr_value.setup(800, 1200, 1, 1, "FS_THR_VALUE", MainV2.comPort.MAV.param); // low battery - mavlinkNumericUpDownlow_voltage.setup(6, 99, 1, 0.1f, "LOW_VOLT", MainV2.comPort.MAV.param, PNL_low_bat); - mavlinkNumericUpDownlow_voltage.setup(6, 99, 1, 0.1f, "FS_BATT_VOLTAGE", MainV2.comPort.MAV.param, PNL_low_bat); + if (MainV2.comPort.MAV.param.ContainsKey("LOW_VOLT")) + { + mavlinkNumericUpDownlow_voltage.setup(6, 99, 1, 0.1f, "LOW_VOLT", MainV2.comPort.MAV.param, PNL_low_bat); + } + else + { + mavlinkNumericUpDownlow_voltage.setup(6, 99, 1, 0.1f, "FS_BATT_VOLTAGE", MainV2.comPort.MAV.param, PNL_low_bat); + } mavlinkNumericUpDownFS_BATT_MAH.setup(1000, 99999, 1, 1, "FS_BATT_MAH", MainV2.comPort.MAV.param, pnlmah); mavlinkCheckBoxfs_gps_enable.setup(1, 0, "FS_GPS_ENABLE", MainV2.comPort.MAV.param); diff --git a/GCSViews/ConfigurationView/ConfigFailSafe.resx b/GCSViews/ConfigurationView/ConfigFailSafe.resx index 042e795665..4c74c46cd8 100644 --- a/GCSViews/ConfigurationView/ConfigFailSafe.resx +++ b/GCSViews/ConfigurationView/ConfigFailSafe.resx @@ -274,7 +274,7 @@ mavlinkNumericUpDownlow_voltage - MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null PNL_low_bat @@ -295,7 +295,7 @@ NoControl - 3, 130 + 3, 105 199, 17 @@ -316,13 +316,13 @@ mavlinkCheckBoxlong_fs - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 - 5 + 6 True @@ -337,7 +337,7 @@ NoControl - 3, 113 + 3, 88 199, 17 @@ -358,13 +358,13 @@ mavlinkCheckBoxshort_fs - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 - 6 + 7 True @@ -379,7 +379,7 @@ NoControl - 3, 96 + 3, 71 199, 17 @@ -400,13 +400,13 @@ mavlinkCheckBoxgcs_fs - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 - 7 + 8 True @@ -421,7 +421,7 @@ NoControl - 3, 79 + 3, 54 199, 17 @@ -443,13 +443,13 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkCheckBoxthr_fs_action - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 - 8 + 9 Right @@ -476,13 +476,13 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkNumericUpDownfs_thr_value - MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null PNL_thr_fs_value - 0 + 1 Right @@ -509,13 +509,13 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkNumericUpDownthr_fs_value - MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null PNL_thr_fs_value - 1 + 2 True @@ -551,7 +551,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkCheckBoxthr_fs - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 @@ -587,7 +587,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkComboBox_fs_thr_enable - MissionPlanner.Controls.MavlinkComboBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkComboBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 @@ -626,7 +626,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkCheckBoxFS_GCS_ENABLE - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 @@ -665,7 +665,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkCheckBoxfs_gps_enable - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null groupBox1 @@ -673,45 +673,6 @@ Arducopter Other: if have gps, RTL, Otherwise Land 1 - - True - - - Top - - - False - - - NoControl - - - 3, 193 - - - 199, 17 - - - 150 - - - Battery Failsafe - - - False - - - mavlinkCheckBoxfs_batt_enable - - - MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null - - - groupBox1 - - - 2 - True @@ -722,13 +683,13 @@ Arducopter Other: if have gps, RTL, Otherwise Land 4, 3 - 67, 13 + 80, 13 154 - Battery MAH + Reserved MAH label5 @@ -758,7 +719,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land mavlinkNumericUpDownFS_BATT_MAH - MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5033.14547, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MavlinkNumericUpDown, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null pnlmah @@ -770,7 +731,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land Top - 3, 170 + 3, 187 199, 23 @@ -791,7 +752,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land groupBox1 - 3 + 2 True @@ -827,7 +788,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land Top - 3, 147 + 3, 164 199, 23 @@ -848,7 +809,7 @@ Arducopter Other: if have gps, RTL, Otherwise Land groupBox1 - 4 + 3 True @@ -881,13 +842,13 @@ Arducopter Other: if have gps, RTL, Otherwise Land PNL_thr_fs_value - 2 + 0 Top - 3, 54 + 3, 139 199, 25 @@ -905,7 +866,46 @@ Arducopter Other: if have gps, RTL, Otherwise Land groupBox1 - 9 + 4 + + + True + + + Top + + + False + + + NoControl + + + 3, 122 + + + 199, 17 + + + 150 + + + Battery Failsafe + + + False + + + mavlinkCheckBoxfs_batt_enable + + + MissionPlanner.Controls.MavlinkCheckBox, MissionPlanner, Version=1.1.5051.38332, Culture=neutral, PublicKeyToken=null + + + groupBox1 + + + 5 480, 174 diff --git a/GCSViews/ConfigurationView/ConfigFirmware.resx b/GCSViews/ConfigurationView/ConfigFirmware.resx index c83bc4736f..e1630e3ff7 100644 --- a/GCSViews/ConfigurationView/ConfigFirmware.resx +++ b/GCSViews/ConfigurationView/ConfigFirmware.resx @@ -123,10 +123,10 @@ - 187, 0 + 186, 0 - 170, 170 + 150, 150 @@ -148,10 +148,10 @@ NoControl - 363, 0 + 342, 0 - 170, 170 + 150, 150 2 @@ -172,10 +172,10 @@ NoControl - 539, 0 + 498, 0 - 170, 170 + 150, 150 3 @@ -196,10 +196,10 @@ NoControl - 363, 176 + 342, 176 - 170, 170 + 150, 150 4 @@ -220,10 +220,10 @@ NoControl - 539, 176 + 498, 176 - 170, 170 + 150, 150 5 @@ -247,7 +247,7 @@ NoControl - 8, 443 + 3, 443 37, 13 @@ -274,10 +274,10 @@ NoControl - 11, 417 + 3, 417 - 874, 23 + 821, 23 6 @@ -301,7 +301,7 @@ NoControl - 763, 443 + 711, 443 113, 13 @@ -328,10 +328,10 @@ NoControl - 187, 176 + 186, 176 - 170, 170 + 150, 150 17 @@ -352,7 +352,7 @@ NoControl - 327, 379 + 297, 381 190, 32 @@ -382,7 +382,7 @@ - 10, 362 + 3, 364 0, 0, 0, 0 @@ -409,7 +409,7 @@ NoControl - 149, 362 + 142, 364 0, 0, 0, 0 @@ -436,7 +436,7 @@ NoControl - 202, 362 + 195, 364 0, 0, 0, 0 @@ -463,7 +463,7 @@ NoControl - 251, 362 + 244, 364 0, 0, 0, 0 @@ -487,10 +487,10 @@ 13 - 715, 176 + 654, 176 - 170, 170 + 150, 150 24 @@ -508,10 +508,10 @@ 18 - 715, 0 + 654, 0 - 170, 170 + 150, 150 25 @@ -529,10 +529,10 @@ 17 - 11, 0 + 30, 0 - 170, 170 + 150, 150 0 @@ -553,7 +553,7 @@ True - 304, 349 + 274, 351 246, 13 @@ -577,7 +577,7 @@ 8 - 757, 387 + 684, 389 121, 21 @@ -604,7 +604,7 @@ True - 763, 391 + 690, 393 113, 13 @@ -634,7 +634,7 @@ NoControl - 763, 371 + 690, 373 110, 13 @@ -664,7 +664,7 @@ NoControl - 650, 392 + 601, 393 76, 13 @@ -694,7 +694,7 @@ NoControl - 650, 371 + 601, 373 83, 13 @@ -724,7 +724,7 @@ NoControl - 536, 371 + 493, 373 102, 13 @@ -754,7 +754,7 @@ NoControl - 536, 392 + 493, 394 81, 13 @@ -784,7 +784,7 @@ 6, 13 - 899, 461 + 827, 461 ConfigFirmware diff --git a/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs b/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs index 6ad71cc3ec..d9790b724d 100644 --- a/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs +++ b/GCSViews/ConfigurationView/ConfigFlightModes.Designer.cs @@ -250,12 +250,14 @@ private void InitializeComponent() // labelfm6 // this.labelfm6.AutoSize = true; + this.labelfm6.Dock = System.Windows.Forms.DockStyle.Fill; this.labelfm6.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.labelfm6.Location = new System.Drawing.Point(3, 140); this.labelfm6.Name = "labelfm6"; - this.labelfm6.Size = new System.Drawing.Size(71, 13); + this.labelfm6.Size = new System.Drawing.Size(88, 28); this.labelfm6.TabIndex = 131; this.labelfm6.Text = "Flight Mode 6"; + this.labelfm6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // CMB_fmode6 // @@ -271,12 +273,14 @@ private void InitializeComponent() // labelfm5 // this.labelfm5.AutoSize = true; + this.labelfm5.Dock = System.Windows.Forms.DockStyle.Fill; this.labelfm5.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.labelfm5.Location = new System.Drawing.Point(3, 112); this.labelfm5.Name = "labelfm5"; - this.labelfm5.Size = new System.Drawing.Size(71, 13); + this.labelfm5.Size = new System.Drawing.Size(88, 28); this.labelfm5.TabIndex = 129; this.labelfm5.Text = "Flight Mode 5"; + this.labelfm5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // CMB_fmode5 // @@ -292,12 +296,14 @@ private void InitializeComponent() // labelfm4 // this.labelfm4.AutoSize = true; + this.labelfm4.Dock = System.Windows.Forms.DockStyle.Fill; this.labelfm4.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.labelfm4.Location = new System.Drawing.Point(3, 84); this.labelfm4.Name = "labelfm4"; - this.labelfm4.Size = new System.Drawing.Size(71, 13); + this.labelfm4.Size = new System.Drawing.Size(88, 28); this.labelfm4.TabIndex = 127; this.labelfm4.Text = "Flight Mode 4"; + this.labelfm4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // CMB_fmode4 // @@ -313,12 +319,14 @@ private void InitializeComponent() // labelfm3 // this.labelfm3.AutoSize = true; + this.labelfm3.Dock = System.Windows.Forms.DockStyle.Fill; this.labelfm3.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.labelfm3.Location = new System.Drawing.Point(3, 56); this.labelfm3.Name = "labelfm3"; - this.labelfm3.Size = new System.Drawing.Size(71, 13); + this.labelfm3.Size = new System.Drawing.Size(88, 28); this.labelfm3.TabIndex = 125; this.labelfm3.Text = "Flight Mode 3"; + this.labelfm3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // CMB_fmode3 // @@ -334,12 +342,14 @@ private void InitializeComponent() // labelfm2 // this.labelfm2.AutoSize = true; + this.labelfm2.Dock = System.Windows.Forms.DockStyle.Fill; this.labelfm2.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.labelfm2.Location = new System.Drawing.Point(3, 28); this.labelfm2.Name = "labelfm2"; - this.labelfm2.Size = new System.Drawing.Size(71, 13); + this.labelfm2.Size = new System.Drawing.Size(88, 28); this.labelfm2.TabIndex = 123; this.labelfm2.Text = "Flight Mode 2"; + this.labelfm2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // CMB_fmode2 // @@ -355,12 +365,14 @@ private void InitializeComponent() // labelfm1 // this.labelfm1.AutoSize = true; + this.labelfm1.Dock = System.Windows.Forms.DockStyle.Fill; this.labelfm1.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.labelfm1.Location = new System.Drawing.Point(3, 0); this.labelfm1.Name = "labelfm1"; - this.labelfm1.Size = new System.Drawing.Size(71, 13); + this.labelfm1.Size = new System.Drawing.Size(88, 28); this.labelfm1.TabIndex = 121; this.labelfm1.Text = "Flight Mode 1"; + this.labelfm1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // CMB_fmode1 // diff --git a/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs b/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs index 75e783a172..c0c934e628 100644 --- a/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs +++ b/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs @@ -30,14 +30,14 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigRawParams)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - this.BUT_compare = new Controls.MyButton(); - this.BUT_rerequestparams = new Controls.MyButton(); - this.BUT_writePIDS = new Controls.MyButton(); - this.BUT_save = new Controls.MyButton(); - this.BUT_load = new Controls.MyButton(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + this.BUT_compare = new MissionPlanner.Controls.MyButton(); + this.BUT_rerequestparams = new MissionPlanner.Controls.MyButton(); + this.BUT_writePIDS = new MissionPlanner.Controls.MyButton(); + this.BUT_save = new MissionPlanner.Controls.MyButton(); + this.BUT_load = new MissionPlanner.Controls.MyButton(); this.Params = new System.Windows.Forms.DataGridView(); this.Command = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -46,62 +46,43 @@ private void InitializeComponent() this.Desc = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.label1 = new System.Windows.Forms.Label(); - this.BUT_find = new Controls.MyButton(); + this.BUT_find = new MissionPlanner.Controls.MyButton(); + this.but_iris = new MissionPlanner.Controls.MyButton(); ((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit(); this.SuspendLayout(); // // BUT_compare // resources.ApplyResources(this.BUT_compare, "BUT_compare"); - this.BUT_compare.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_compare.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_compare.Name = "BUT_compare"; - this.BUT_compare.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_compare.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_compare.UseVisualStyleBackColor = true; this.BUT_compare.Click += new System.EventHandler(this.BUT_compare_Click); // // BUT_rerequestparams // resources.ApplyResources(this.BUT_rerequestparams, "BUT_rerequestparams"); - this.BUT_rerequestparams.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_rerequestparams.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_rerequestparams.Name = "BUT_rerequestparams"; - this.BUT_rerequestparams.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_rerequestparams.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_rerequestparams.UseVisualStyleBackColor = true; this.BUT_rerequestparams.Click += new System.EventHandler(this.BUT_rerequestparams_Click); // // BUT_writePIDS // resources.ApplyResources(this.BUT_writePIDS, "BUT_writePIDS"); - this.BUT_writePIDS.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_writePIDS.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_writePIDS.Name = "BUT_writePIDS"; - this.BUT_writePIDS.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_writePIDS.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_writePIDS.UseVisualStyleBackColor = true; this.BUT_writePIDS.Click += new System.EventHandler(this.BUT_writePIDS_Click); // // BUT_save // resources.ApplyResources(this.BUT_save, "BUT_save"); - this.BUT_save.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_save.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_save.Name = "BUT_save"; - this.BUT_save.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_save.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_save.UseVisualStyleBackColor = true; this.BUT_save.Click += new System.EventHandler(this.BUT_save_Click); // // BUT_load // resources.ApplyResources(this.BUT_load, "BUT_load"); - this.BUT_load.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_load.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_load.Name = "BUT_load"; - this.BUT_load.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_load.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_load.UseVisualStyleBackColor = true; this.BUT_load.Click += new System.EventHandler(this.BUT_load_Click); // @@ -111,14 +92,14 @@ private void InitializeComponent() this.Params.AllowUserToDeleteRows = false; resources.ApplyResources(this.Params, "Params"); this.Params.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.Maroon; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.Color.Maroon; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle4.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.Params.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.Params.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Command, @@ -127,14 +108,14 @@ private void InitializeComponent() this.Options, this.Desc}); this.Params.Name = "Params"; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.ActiveCaption; - dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.ActiveCaption; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle6; this.Params.RowHeadersVisible = false; this.Params.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders; this.Params.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.Params_CellValueChanged); @@ -165,8 +146,8 @@ private void InitializeComponent() // Desc // this.Desc.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.Desc.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.Desc.DefaultCellStyle = dataGridViewCellStyle5; resources.ApplyResources(this.Desc, "Desc"); this.Desc.Name = "Desc"; this.Desc.ReadOnly = true; @@ -185,17 +166,21 @@ private void InitializeComponent() // BUT_find // resources.ApplyResources(this.BUT_find, "BUT_find"); - this.BUT_find.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_find.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_find.Name = "BUT_find"; - this.BUT_find.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_find.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_find.UseVisualStyleBackColor = true; this.BUT_find.Click += new System.EventHandler(this.BUT_find_Click); // + // but_iris + // + resources.ApplyResources(this.but_iris, "but_iris"); + this.but_iris.Name = "but_iris"; + this.but_iris.UseVisualStyleBackColor = true; + this.but_iris.Click += new System.EventHandler(this.but_iris_Click); + // // ConfigRawParams // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.but_iris); this.Controls.Add(this.BUT_find); this.Controls.Add(this.label1); this.Controls.Add(this.BUT_compare); @@ -228,5 +213,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn Options; private System.Windows.Forms.DataGridViewTextBoxColumn Desc; private Controls.MyButton BUT_find; + private Controls.MyButton but_iris; } } diff --git a/GCSViews/ConfigurationView/ConfigRawParams.cs b/GCSViews/ConfigurationView/ConfigRawParams.cs index b383f3f2e0..1aee821c71 100644 --- a/GCSViews/ConfigurationView/ConfigRawParams.cs +++ b/GCSViews/ConfigurationView/ConfigRawParams.cs @@ -9,6 +9,7 @@ using log4net; using MissionPlanner.Controls; using System.Collections.Generic; +using System.Net; namespace MissionPlanner.GCSViews.ConfigurationView { @@ -126,42 +127,47 @@ private void BUT_load_Click(object sender, EventArgs e) if (dr == DialogResult.OK) { - Hashtable param2 = loadParamFile(ofd.FileName); + loadparamsfromfile(ofd.FileName); + } + } + + void loadparamsfromfile(string fn) + { + Hashtable param2 = loadParamFile(fn); - foreach (string name in param2.Keys) + foreach (string name in param2.Keys) + { + string value = param2[name].ToString(); + // set param table as well + foreach (DataGridViewRow row in Params.Rows) { - string value = param2[name].ToString(); - // set param table as well - foreach (DataGridViewRow row in Params.Rows) + if (name == "SYSID_SW_MREV") + continue; + if (name == "WP_TOTAL") + continue; + if (name == "CMD_TOTAL") + continue; + if (name == "FENCE_TOTAL") + continue; + if (name == "SYS_NUM_RESETS") + continue; + if (name == "ARSPD_OFFSET") + continue; + if (name == "GND_ABS_PRESS") + continue; + if (name == "GND_TEMP") + continue; + if (name == "CMD_INDEX") + continue; + if (name == "LOG_LASTFILE") + continue; + if (name == "FORMAT_VERSION") + continue; + if (row.Cells[0].Value.ToString() == name) { - if (name == "SYSID_SW_MREV") - continue; - if (name == "WP_TOTAL") - continue; - if (name == "CMD_TOTAL") - continue; - if (name == "FENCE_TOTAL") - continue; - if (name == "SYS_NUM_RESETS") - continue; - if (name == "ARSPD_OFFSET") - continue; - if (name == "GND_ABS_PRESS") - continue; - if (name == "GND_TEMP") - continue; - if (name == "CMD_INDEX") - continue; - if (name == "LOG_LASTFILE") - continue; - if (name == "FORMAT_VERSION") - continue; - if (row.Cells[0].Value.ToString() == name) - { - if (row.Cells[1].Value.ToString() != value.ToString()) - row.Cells[1].Value = value; - break; - } + if (row.Cells[1].Value.ToString() != value.ToString()) + row.Cells[1].Value = value; + break; } } } @@ -488,5 +494,25 @@ private void BUT_find_Click(object sender, EventArgs e) } } } + + private void but_iris_Click(object sender, EventArgs e) + { + try + { + string filepath = Application.StartupPath + Path.DirectorySeparatorChar + "Iris.param"; + + if (Common.getFilefromNet("https://github.com/diydrones/ardupilot/raw/master/Tools/Frame_params/Iris.param", filepath)) + { + loadparamsfromfile(filepath); + + CustomMessageBox.Show("Loaded parameters, please make sure you write them!","Loaded"); + } + else + { + CustomMessageBox.Show("Error getting Iris param file"); + } + } + catch (Exception ex) { CustomMessageBox.Show("Error getting Iris param file" + ex.ToString()); } + } } } diff --git a/GCSViews/ConfigurationView/ConfigRawParams.resx b/GCSViews/ConfigurationView/ConfigRawParams.resx index e27e23afc0..07f4092fa9 100644 --- a/GCSViews/ConfigurationView/ConfigRawParams.resx +++ b/GCSViews/ConfigurationView/ConfigRawParams.resx @@ -112,26 +112,26 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Top, Right NoControl - + 631, 119 103, 19 - + 72 @@ -142,13 +142,13 @@ BUT_compare - Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this - 2 + 3 Top, Right @@ -172,13 +172,13 @@ BUT_rerequestparams - Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this - 3 + 4 Top, Right @@ -202,13 +202,13 @@ BUT_writePIDS - Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this - 4 + 5 Top, Right @@ -235,13 +235,13 @@ BUT_save - Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this - 5 + 6 Top, Right @@ -268,18 +268,18 @@ BUT_load - Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this - 6 + 7 Top, Bottom, Left, Right - + True @@ -288,7 +288,7 @@ 150 - + True @@ -297,7 +297,7 @@ 80 - + True @@ -306,13 +306,13 @@ 60 - + True Options - + True @@ -331,15 +331,15 @@ Params - System.Windows.Forms.DataGridView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this - 7 + 8 - + 17, 17 @@ -368,13 +368,13 @@ format with no scaling label1 - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this - 1 + 2 Top, Right @@ -398,15 +398,48 @@ format with no scaling BUT_find - Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this + 1 + + + Top, Right + + + NoControl + + + 631, 276 + + + 0, 0, 0, 0 + + + 104, 19 + + + 75 + + + Load Iris Defaults + + + but_iris + + + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + 0 - + True @@ -416,42 +449,42 @@ format with no scaling Command - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Value - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Units - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Options - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Desc - System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 toolTip1 - System.Windows.Forms.ToolTip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ConfigRawParams - System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/GCSViews/ConfigurationView/ConfigSimplePids.cs b/GCSViews/ConfigurationView/ConfigSimplePids.cs index 31676fb4cc..e97fc312a0 100644 --- a/GCSViews/ConfigurationView/ConfigSimplePids.cs +++ b/GCSViews/ConfigurationView/ConfigSimplePids.cs @@ -24,7 +24,7 @@ public partial class ConfigSimplePids: MyUserControl, IActivate int y = 10; - class configitem + class configitem: IDisposable { public string title; public string desc; @@ -39,6 +39,12 @@ class configitem public Label lbl_max = new Label(); // use increments + + public void Dispose() + { + lbl_max.Dispose(); + lbl_min.Dispose(); + } } class relationitem diff --git a/GCSViews/FlightData.cs b/GCSViews/FlightData.cs index aeae3d80da..634923c6b5 100644 --- a/GCSViews/FlightData.cs +++ b/GCSViews/FlightData.cs @@ -119,6 +119,19 @@ protected override void Dispose(bool disposing) } catch { } + if (polygons != null) + polygons.Dispose(); + if (routes != null) + routes.Dispose(); + if (route != null) + route.Dispose(); + if (polygon != null) + polygon.Dispose(); + if (marker != null) + marker.Dispose(); + if (aviwriter != null) + aviwriter.Dispose(); + if (disposing && (components != null)) { components.Dispose(); diff --git a/GCSViews/FlightPlanner.Designer.cs b/GCSViews/FlightPlanner.Designer.cs index 0e6f301b1c..cd89ac8eda 100644 --- a/GCSViews/FlightPlanner.Designer.cs +++ b/GCSViews/FlightPlanner.Designer.cs @@ -31,14 +31,14 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlightPlanner)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); this.CHK_altmode = new System.Windows.Forms.CheckBox(); this.Commands = new System.Windows.Forms.DataGridView(); this.Command = new System.Windows.Forms.DataGridViewComboBoxColumn(); @@ -96,6 +96,7 @@ private void InitializeComponent() this.splitter1 = new BSE.Windows.Forms.Splitter(); this.BUT_Add = new MissionPlanner.Controls.MyButton(); this.panelAction = new BSE.Windows.Forms.Panel(); + this.lnk_kml = new System.Windows.Forms.LinkLabel(); this.chk_grid = new System.Windows.Forms.CheckBox(); this.comboBoxMapType = new System.Windows.Forms.ComboBox(); this.panelMap = new System.Windows.Forms.Panel(); @@ -160,7 +161,7 @@ private void InitializeComponent() this.panelBASE = new System.Windows.Forms.Panel(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.lnk_kml = new System.Windows.Forms.LinkLabel(); + this.splineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.Commands)).BeginInit(); this.panel5.SuspendLayout(); this.panel1.SuspendLayout(); @@ -184,14 +185,14 @@ private void InitializeComponent() // this.Commands.AllowUserToAddRows = false; resources.ApplyResources(this.Commands, "Commands"); - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9; this.Commands.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Command, this.Param1, @@ -206,17 +207,17 @@ private void InitializeComponent() this.Down, this.Grad}); this.Commands.Name = "Commands"; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle5.Format = "N0"; - dataGridViewCellStyle5.NullValue = "0"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle5; - dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black; - this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle13.Format = "N0"; + dataGridViewCellStyle13.NullValue = "0"; + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle13; + dataGridViewCellStyle14.ForeColor = System.Drawing.Color.Black; + this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle14; this.Commands.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellContentClick); this.Commands.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellEndEdit); this.Commands.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.Commands_DataError); @@ -228,9 +229,9 @@ private void InitializeComponent() // // Command // - dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69))))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; - this.Command.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69))))); + dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White; + this.Command.DefaultCellStyle = dataGridViewCellStyle10; this.Command.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox; resources.ApplyResources(this.Command, "Command"); this.Command.Name = "Command"; @@ -296,7 +297,7 @@ private void InitializeComponent() // // Up // - this.Up.DefaultCellStyle = dataGridViewCellStyle3; + this.Up.DefaultCellStyle = dataGridViewCellStyle11; resources.ApplyResources(this.Up, "Up"); this.Up.Image = global::MissionPlanner.Properties.Resources.up; this.Up.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -304,8 +305,8 @@ private void InitializeComponent() // // Down // - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.Down.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.Down.DefaultCellStyle = dataGridViewCellStyle12; resources.ApplyResources(this.Down, "Down"); this.Down.Image = global::MissionPlanner.Properties.Resources.down; this.Down.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -435,8 +436,8 @@ private void InitializeComponent() // // dataGridViewImageColumn1 // - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle15; resources.ApplyResources(this.dataGridViewImageColumn1, "dataGridViewImageColumn1"); this.dataGridViewImageColumn1.Image = global::MissionPlanner.Properties.Resources.up; this.dataGridViewImageColumn1.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -444,8 +445,8 @@ private void InitializeComponent() // // dataGridViewImageColumn2 // - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle16; resources.ApplyResources(this.dataGridViewImageColumn2, "dataGridViewImageColumn2"); this.dataGridViewImageColumn2.Image = global::MissionPlanner.Properties.Resources.down; this.dataGridViewImageColumn2.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -652,6 +653,13 @@ private void InitializeComponent() this.panelAction.ToolTipTextExpandIconPanelCollapsed = null; this.panelAction.ToolTipTextExpandIconPanelExpanded = null; // + // lnk_kml + // + resources.ApplyResources(this.lnk_kml, "lnk_kml"); + this.lnk_kml.Name = "lnk_kml"; + this.lnk_kml.TabStop = true; + this.lnk_kml.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_kml_LinkClicked); + // // chk_grid // resources.ApplyResources(this.chk_grid, "chk_grid"); @@ -741,7 +749,8 @@ private void InitializeComponent() this.mapToolToolStripMenuItem, this.fileLoadSaveToolStripMenuItem, this.trackerHomeToolStripMenuItem, - this.flyToHereToolStripMenuItem}); + this.flyToHereToolStripMenuItem, + this.splineToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1"); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); @@ -1114,12 +1123,11 @@ private void InitializeComponent() this.timer1.Interval = 1200; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // lnk_kml + // splineToolStripMenuItem // - resources.ApplyResources(this.lnk_kml, "lnk_kml"); - this.lnk_kml.Name = "lnk_kml"; - this.lnk_kml.TabStop = true; - this.lnk_kml.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnk_kml_LinkClicked); + this.splineToolStripMenuItem.Name = "splineToolStripMenuItem"; + resources.ApplyResources(this.splineToolStripMenuItem, "splineToolStripMenuItem"); + this.splineToolStripMenuItem.Click += new System.EventHandler(this.splineToolStripMenuItem_Click); // // FlightPlanner // @@ -1274,5 +1282,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn Grad; private System.Windows.Forms.ToolStripMenuItem loadKMLFileToolStripMenuItem; private System.Windows.Forms.LinkLabel lnk_kml; + private System.Windows.Forms.ToolStripMenuItem splineToolStripMenuItem; } } \ No newline at end of file diff --git a/GCSViews/FlightPlanner.cs b/GCSViews/FlightPlanner.cs index fa5fea22ee..f90c91d1c9 100644 --- a/GCSViews/FlightPlanner.cs +++ b/GCSViews/FlightPlanner.cs @@ -43,6 +43,7 @@ public partial class FlightPlanner : MyUserControl, IDeactivate, IActivate bool isonline = true; bool sethome = false; bool polygongridmode = false; + bool splinemode = false; Hashtable param = new Hashtable(); bool grid = false; @@ -299,6 +300,7 @@ public FlightPlanner() InitializeComponent(); // config map + MainMap.MapProvider = GoogleSatelliteMapProvider.Instance; MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/"; // map events @@ -393,7 +395,10 @@ public FlightPlanner() { try { - comboBoxMapType.SelectedIndex = GMapProviders.List.FindIndex(x => (x.Name == MainV2.getConfig("MapType")) ); + var index = GMapProviders.List.FindIndex(x => (x.Name == MainV2.getConfig("MapType")) ); + + if (index != -1) + comboBoxMapType.SelectedIndex = index; } catch { } } @@ -1023,6 +1028,9 @@ private void writeKML() RegeneratePolygon(); + if (splinemode) + dospline(); + if (wppolygon != null && wppolygon.Points.Count > 0) { double homedist = 0; @@ -2431,7 +2439,7 @@ private void comboBoxMapType_SelectedValueChanged(object sender, EventArgs e) FlightData.mymap.MapProvider = (GMapProvider)comboBoxMapType.SelectedItem; MainV2.config["MapType"] = comboBoxMapType.Text; } - catch { CustomMessageBox.Show("Map change failed. try zomming out first."); } + catch { CustomMessageBox.Show("Map change failed. try zooming out first."); } } private void Commands_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) @@ -4768,7 +4776,7 @@ private void getRallyPointsToolStripMenuItem_Click(object sender, EventArgs e) try { PointLatLngAlt plla = MainV2.comPort.getRallyPoint(a, ref count); - rallypointoverlay.Markers.Add(new GMapMarkerRallyPt(new PointLatLng(plla.Lat, plla.Lng)) { ToolTipMode = MarkerTooltipMode.OnMouseOver, ToolTipText = "Rally Point" }); + rallypointoverlay.Markers.Add(new GMapMarkerRallyPt(new PointLatLng(plla.Lat, plla.Lng)) { Alt = (int)plla.Alt, ToolTipMode = MarkerTooltipMode.OnMouseOver, ToolTipText = "Rally Point" }); } catch { CustomMessageBox.Show("Failed to get rally point", "Error"); return; } } @@ -4784,11 +4792,11 @@ private void saveRallyPointsToolStripMenuItem_Click(object sender, EventArgs e) MainV2.comPort.setParam("RALLY_TOTAL", rallypointoverlay.Markers.Count ); - foreach (var pnt in rallypointoverlay.Markers) + foreach (GMapMarkerRallyPt pnt in rallypointoverlay.Markers) { try { - MainV2.comPort.setRallyPoint(count, new PointLatLngAlt(pnt.Position) { Alt = int.Parse(TXT_DefaultAlt.Text) }, (short)int.Parse(TXT_DefaultAlt.Text), 0, 0, (byte)(float)MainV2.comPort.MAV.param["RALLY_TOTAL"]); + MainV2.comPort.setRallyPoint(count, new PointLatLngAlt(pnt.Position) { Alt = pnt.Alt }, (short)pnt.Alt, 0, 0, (byte)(float)MainV2.comPort.MAV.param["RALLY_TOTAL"]); count++; } catch { CustomMessageBox.Show("Failed to save rally point", "Error"); return; } @@ -4797,15 +4805,29 @@ private void saveRallyPointsToolStripMenuItem_Click(object sender, EventArgs e) private void setRallyPointToolStripMenuItem_Click(object sender, EventArgs e) { - PointLatLngAlt rallypt = new PointLatLngAlt(MouseDownStart.Lat, MouseDownStart.Lng, int.Parse(TXT_DefaultAlt.Text), "Rally Point"); - rallypointoverlay.Markers.Add( - new GMapMarkerRallyPt(rallypt) - { - ToolTipMode = MarkerTooltipMode.OnMouseOver, - ToolTipText = "Rally Point", - Tag = rallypointoverlay.Markers.Count, - } - ); + string altstring = TXT_DefaultAlt.Text; + + InputBox.Show("Altitude", "Altitude", ref altstring); + + int alt = 0; + + if (int.TryParse(altstring, out alt)) + { + PointLatLngAlt rallypt = new PointLatLngAlt(MouseDownStart.Lat, MouseDownStart.Lng, alt * MainV2.comPort.MAV.cs.multiplierdist, "Rally Point"); + rallypointoverlay.Markers.Add( + new GMapMarkerRallyPt(rallypt) + { + ToolTipMode = MarkerTooltipMode.OnMouseOver, + ToolTipText = "Rally Point" + "\nAlt: " + alt, + Tag = rallypointoverlay.Markers.Count, + Alt = alt, + } + ); + } + else + { + CustomMessageBox.Show("Bad Altitude","error"); + } } private void clearRallyPointsToolStripMenuItem_Click(object sender, EventArgs e) @@ -4925,5 +4947,31 @@ private void lnk_kml_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) System.Diagnostics.Process.Start("http://127.0.0.1:56781/network.kml"); } + private void splineToolStripMenuItem_Click(object sender, EventArgs e) + { + splinemode = !splinemode; + + dospline(); + } + + void dospline() + { + if (pointlist.Count > 3 && pointlist[0] != pointlist[pointlist.Count - 1]) + pointlist.Add(pointlist[0]); + + MissionPlanner.Controls.Waypoints.Spline sp = new Controls.Waypoints.Spline(); + + List spline = sp.doit(pointlist, 10); + + List list = new List(); + spline.ForEach(x => { list.Add(x); }); + + polygonsoverlay.Routes.Clear(); + + polygonsoverlay.Routes.Add(new GMapRoute(list, "spline") { Stroke = Pens.Yellow }); + + polygonsoverlay.Polygons.Clear(); + } + } } diff --git a/GCSViews/FlightPlanner.resx b/GCSViews/FlightPlanner.resx index bb26de56ac..f74fd0f39e 100644 --- a/GCSViews/FlightPlanner.resx +++ b/GCSViews/FlightPlanner.resx @@ -513,6 +513,51 @@ Bottom, Right + + BUT_write + + + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + panel5 + + + 0 + + + BUT_read + + + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + panel5 + + + 1 + + + 8, 301 + + + 117, 63 + + + 29 + + + panel5 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelAction + + + 2 + NoControl @@ -567,29 +612,113 @@ 1 - - 8, 301 + + Bottom, Right - - 117, 63 + + label4 - - 29 + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - panel5 + + panel1 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0 - - panelAction + + label3 - + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 1 + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + 2 - - Bottom, Right + + Label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 3 + + + TXT_homealt + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 4 + + + TXT_homelng + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 5 + + + TXT_homelat + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 6 + + + 8, 365 + + + 117, 89 + + + 31 + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelAction + + + 3 True @@ -774,66 +903,258 @@ 6 - - 8, 365 + + Up - - 117, 89 + + 20 - - 31 + + Down - - panel1 + + 20 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + NoControl - - panelAction + + 0, 0 - + + 100, 23 + + + 47 + + + label6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelBASE + + + 4 + + + Bottom, Right + + + label16 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 0 + + + txt_mouse_mgrs + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 1 + + + label15 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 2 + + + txt_mouse_utmzone + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + 3 - - Up + + label14 - - 20 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Down + + panel2 + + + 4 + + + label12 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 5 + + + label13 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 6 + + + txt_mouse_utmy + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 7 + + + txt_mouse_utmx + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 8 + + + label7 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 9 + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 10 + + + label9 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 11 + + + label10 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 12 + + + TXT_mousealt + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 13 + + + TXT_mouselong + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 14 + + + TXT_mouselat + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 20 + + panel2 - - NoControl + + 15 - - 0, 0 + + 4, 25 - - 100, 23 + + 123, 212 - - 47 + + 38 - - label6 + + panel2 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - panelBASE + + panelAction - + 4 - - Bottom, Right - True @@ -1251,27 +1572,6 @@ 15 - - 4, 25 - - - 123, 212 - - - 38 - - - panel2 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panelAction - - - 4 - Bottom, Right @@ -1332,6 +1632,9 @@ 0 + + 172, 17 + NoControl @@ -1347,9 +1650,6 @@ Add Below - - 172, 17 - Add a line to the grid bellow @@ -1593,35 +1893,260 @@ Prev - - lbl_prevdist + + lbl_prevdist + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelMap + + + 2 + + + Top, Bottom, Left, Right + + + 17, 17 + + + 152, 22 + + + Delete WP + + + 152, 22 + + + Insert Wp + + + 152, 22 + + + Loiter + + + 152, 22 + + + Jump + + + 152, 22 + + + RTL + + + 152, 22 + + + Land + + + 152, 22 + + + Takeoff + + + 152, 22 + + + Set ROI + + + 152, 22 + + + Clear Mission + + + 149, 6 + + + 152, 22 + + + Draw Polygon + + + 152, 22 + + + Rally Points + + + 152, 22 + + + Geo-Fence + + + 152, 22 + + + Auto WP + + + 152, 22 + + + Map Tool + + + 152, 22 + + + File Load/Save + + + 152, 22 + + + Tracker Home + + + 152, 22 + + + Fly To Here + + + False + + + 152, 22 + + + View As Spline + + + 153, 428 + + + contextMenuStrip1 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0, 0 + + + 577, 320 + + + 45 + + + MainMap + + + MissionPlanner.Controls.myGMAP, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelMap + + + 3 + + + Top, Bottom, Right + + + NoControl + + + 586, 21 + + + Vertical + + + 45, 300 + + + 46 + + + trackBar1 + + + MissionPlanner.Controls.MyTrackBar, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelMap + + + 4 + + + Top, Right + + + True + + + NoControl + + + 583, 5 + + + 34, 13 + + + 47 + + + Zoom + + + label11 - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + panelMap - - 2 + + 5 - - Top, Bottom, Left, Right + + Fill - - 17, 17 - - - 150, 22 + + 0, 0 - - Delete WP + + 27, 27 - - 150, 22 + + 617, 327 - - Insert Wp + + 51 + + + panel6 + + + panelMap + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelBASE + + + 1 113, 22 @@ -1641,12 +2166,6 @@ Circles - - 150, 22 - - - Loiter - 102, 22 @@ -1659,45 +2178,6 @@ WP # - - 150, 22 - - - Jump - - - 150, 22 - - - RTL - - - 150, 22 - - - Land - - - 150, 22 - - - Takeoff - - - 150, 22 - - - Set ROI - - - 150, 22 - - - Clear Mission - - - 147, 6 - 174, 22 @@ -1722,12 +2202,6 @@ Load Polygon - - 150, 22 - - - Draw Polygon - 165, 22 @@ -1752,12 +2226,6 @@ Clear Rally Points - - 150, 22 - - - Rally Points - 177, 22 @@ -1797,12 +2265,6 @@ Save to File - - 150, 22 - - - Geo-Fence - 162, 22 @@ -1815,12 +2277,6 @@ Area - - 150, 22 - - - Auto WP - 167, 22 @@ -1863,12 +2319,6 @@ Reverse WPs - - 150, 22 - - - Map Tool - 168, 22 @@ -1893,150 +2343,6 @@ Load KML File - - 150, 22 - - - File Load/Save - - - 150, 22 - - - Tracker Home - - - 150, 22 - - - Fly To Here - - - False - - - 151, 384 - - - contextMenuStrip1 - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 0, 0 - - - 577, 320 - - - 45 - - - MainMap - - - MissionPlanner.Controls.myGMAP, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - panelMap - - - 3 - - - Top, Bottom, Right - - - NoControl - - - 586, 21 - - - Vertical - - - 45, 300 - - - 46 - - - trackBar1 - - - MissionPlanner.Controls.MyTrackBar, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - panelMap - - - 4 - - - Top, Right - - - True - - - NoControl - - - 583, 5 - - - 34, 13 - - - 47 - - - Zoom - - - label11 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panelMap - - - 5 - - - Fill - - - 0, 0 - - - 27, 27 - - - 617, 327 - - - 51 - - - panel6 - - - panelMap - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panelBASE - - - 1 - Fill @@ -2061,6 +2367,9 @@ 1 + + 172, 17 + 269, 17 @@ -2478,6 +2787,12 @@ System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + splineToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + FlightPlanner diff --git a/GCSViews/Simple.cs b/GCSViews/Simple.cs index 3b33df4166..4fdbf4b397 100644 --- a/GCSViews/Simple.cs +++ b/GCSViews/Simple.cs @@ -94,8 +94,25 @@ protected override void Dispose(bool disposing) { threadrun = 0; MainV2.comPort.logreadmode = false; - + System.Threading.Thread.Sleep(100); + + if (routes != null) + route.Dispose(); + if (routes != null) + routes.Dispose(); + if (swlog != null) + swlog.Dispose(); + if (polygon != null) + polygon.Dispose(); + if (polygons != null) + polygons.Dispose(); + if (marker != null) + marker.Dispose(); + + if (components != null) + components.Dispose(); + base.Dispose(disposing); } diff --git a/GCSViews/Simulation.cs b/GCSViews/Simulation.cs index 8685916210..54163cab95 100644 --- a/GCSViews/Simulation.cs +++ b/GCSViews/Simulation.cs @@ -20,7 +20,7 @@ // Written by Michael Oborne namespace MissionPlanner.GCSViews { - public partial class Simulation : MyUserControl, IActivate + public partial class Simulation : MyUserControl { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); MAVLinkInterface comPort = MainV2.comPort; @@ -242,9 +242,12 @@ public struct TDataFromAeroSimRC if (threadrun == 1) ConnectComPort_Click(new object(), new EventArgs()); + this.Dispose(false); + MavLink = null; XplanesSEND = null; SimulatorRECV = null; + SITLSEND = null; } public Simulation() @@ -252,10 +255,6 @@ public Simulation() InitializeComponent(); } - public void Activate() - { - } - private void Simulation_Load(object sender, EventArgs e) { timer_servo_graph.Stop(); diff --git a/GCSViews/Terminal.cs b/GCSViews/Terminal.cs index b9a9d06667..3b8471192c 100644 --- a/GCSViews/Terminal.cs +++ b/GCSViews/Terminal.cs @@ -591,6 +591,9 @@ private void BUT_logbrowse_Click(object sender, EventArgs e) private void BUT_RebootAPM_Click(object sender, EventArgs e) { + if (MainV2.comPort.BaseStream.IsOpen) + MainV2.comPort.BaseStream.Close(); + if (comPort.IsOpen) { BUT_disconnect.Enabled = true; diff --git a/GenOTP.cs b/GenOTP.cs index 354cc52ae4..f01e27a465 100644 --- a/GenOTP.cs +++ b/GenOTP.cs @@ -76,8 +76,6 @@ private void BUT_makeotp_Click(object sender, EventArgs e) // bw.Seek(32, SeekOrigin.Begin); bw.Write(signedhash); - - bw.Close(); } CustomMessageBox.Show("Done"); diff --git a/HIL/Vector3.cs b/HIL/Vector3.cs index 35a57421ad..db84d970ba 100644 --- a/HIL/Vector3.cs +++ b/HIL/Vector3.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using MissionPlanner.Utilities; namespace MissionPlanner.HIL { @@ -35,6 +36,11 @@ public Vector3(Vector3 copyme) self.z); } + public static implicit operator Vector3(PointLatLngAlt a) + { + return new Vector3(a.Lat,a.Lng,a.Alt); + } + public static Vector3 operator +(Vector3 self, Vector3 v) { diff --git a/HIL/XPlane.cs b/HIL/XPlane.cs index 94812f699a..b5ea9f55a0 100644 --- a/HIL/XPlane.cs +++ b/HIL/XPlane.cs @@ -7,7 +7,7 @@ namespace MissionPlanner.HIL { - public class XPlane : Hil + public class XPlane : Hil, IDisposable { Socket SimulatorRECV; UdpClient XplanesSEND; @@ -401,5 +401,11 @@ void setupXplane() catch (Exception e) { log.Info("Xplanes udp send error " + e.Message); } } + + public void Dispose() + { + if (SimulatorRECV != null) + SimulatorRECV.Dispose(); + } } } \ No newline at end of file diff --git a/Joystick.cs b/Joystick.cs index 0f64613d06..0bb92c59d3 100644 --- a/Joystick.cs +++ b/Joystick.cs @@ -9,7 +9,7 @@ namespace MissionPlanner { - public class Joystick + public class Joystick: IDisposable { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); Device joystick; @@ -697,5 +697,11 @@ ushort pickchannel(int chan, joystickaxis axis, bool rev, int expo) return (ushort)working; } + + public void Dispose() + { + if (joystick != null) + joystick.Dispose(); + } } } diff --git a/Log/Log.Designer.cs b/Log/Log.Designer.cs index b0975c1e37..a6eab47d28 100644 --- a/Log/Log.Designer.cs +++ b/Log/Log.Designer.cs @@ -30,15 +30,15 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Log)); this.TXT_seriallog = new System.Windows.Forms.TextBox(); - this.BUT_DLall = new Controls.MyButton(); - this.BUT_DLthese = new Controls.MyButton(); - this.BUT_clearlogs = new Controls.MyButton(); + this.BUT_DLall = new MissionPlanner.Controls.MyButton(); + this.BUT_DLthese = new MissionPlanner.Controls.MyButton(); + this.BUT_clearlogs = new MissionPlanner.Controls.MyButton(); this.CHK_logs = new System.Windows.Forms.CheckedListBox(); this.TXT_status = new System.Windows.Forms.TextBox(); - this.BUT_redokml = new Controls.MyButton(); - this.BUT_firstperson = new Controls.MyButton(); - this.BUT_dumpdf = new Controls.MyButton(); - this.BUT_bintolog = new Controls.MyButton(); + this.BUT_redokml = new MissionPlanner.Controls.MyButton(); + this.BUT_firstperson = new MissionPlanner.Controls.MyButton(); + this.BUT_dumpdf = new MissionPlanner.Controls.MyButton(); + this.BUT_bintolog = new MissionPlanner.Controls.MyButton(); this.CHK_arducopter = new System.Windows.Forms.RadioButton(); this.CHK_arduplane = new System.Windows.Forms.RadioButton(); this.CHK_ardurover = new System.Windows.Forms.RadioButton(); @@ -52,34 +52,22 @@ private void InitializeComponent() // // BUT_DLall // - this.BUT_DLall.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_DLall.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); resources.ApplyResources(this.BUT_DLall, "BUT_DLall"); this.BUT_DLall.Name = "BUT_DLall"; - this.BUT_DLall.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_DLall.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_DLall.UseVisualStyleBackColor = true; this.BUT_DLall.Click += new System.EventHandler(this.BUT_DLall_Click); // // BUT_DLthese // - this.BUT_DLthese.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_DLthese.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); resources.ApplyResources(this.BUT_DLthese, "BUT_DLthese"); this.BUT_DLthese.Name = "BUT_DLthese"; - this.BUT_DLthese.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_DLthese.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_DLthese.UseVisualStyleBackColor = true; this.BUT_DLthese.Click += new System.EventHandler(this.BUT_DLthese_Click); // // BUT_clearlogs // - this.BUT_clearlogs.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_clearlogs.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); resources.ApplyResources(this.BUT_clearlogs, "BUT_clearlogs"); this.BUT_clearlogs.Name = "BUT_clearlogs"; - this.BUT_clearlogs.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_clearlogs.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_clearlogs.UseVisualStyleBackColor = true; this.BUT_clearlogs.Click += new System.EventHandler(this.BUT_clearlogs_Click); // @@ -99,45 +87,29 @@ private void InitializeComponent() // // BUT_redokml // - this.BUT_redokml.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_redokml.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); resources.ApplyResources(this.BUT_redokml, "BUT_redokml"); this.BUT_redokml.Name = "BUT_redokml"; - this.BUT_redokml.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_redokml.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_redokml.UseVisualStyleBackColor = true; this.BUT_redokml.Click += new System.EventHandler(this.BUT_redokml_Click); // // BUT_firstperson // - this.BUT_firstperson.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_firstperson.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); resources.ApplyResources(this.BUT_firstperson, "BUT_firstperson"); this.BUT_firstperson.Name = "BUT_firstperson"; - this.BUT_firstperson.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_firstperson.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_firstperson.UseVisualStyleBackColor = true; this.BUT_firstperson.Click += new System.EventHandler(this.BUT_firstperson_Click); // // BUT_dumpdf // - this.BUT_dumpdf.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_dumpdf.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); resources.ApplyResources(this.BUT_dumpdf, "BUT_dumpdf"); this.BUT_dumpdf.Name = "BUT_dumpdf"; - this.BUT_dumpdf.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_dumpdf.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_dumpdf.UseVisualStyleBackColor = true; this.BUT_dumpdf.Click += new System.EventHandler(this.BUT_dumpdf_Click); // // BUT_bintolog // - this.BUT_bintolog.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_bintolog.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); resources.ApplyResources(this.BUT_bintolog, "BUT_bintolog"); this.BUT_bintolog.Name = "BUT_bintolog"; - this.BUT_bintolog.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); - this.BUT_bintolog.TextColor = 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); // diff --git a/Log/Log.cs b/Log/Log.cs index a27f5330d8..ebf9a6837f 100644 --- a/Log/Log.cs +++ b/Log/Log.cs @@ -849,7 +849,7 @@ private void Log_FormClosing(object sender, FormClosingEventArgs e) System.Threading.Thread.Sleep(500); if (comPort.IsOpen) { - //comPort.Close(); + comPort.Close(); } } diff --git a/Log/Log.resx b/Log/Log.resx index dbc62ebe04..f97d772a96 100644 --- a/Log/Log.resx +++ b/Log/Log.resx @@ -112,16 +112,20 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + Top, Bottom, Left, Right + + 135, 43 - + True @@ -135,7 +139,7 @@ TXT_seriallog - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -159,7 +163,7 @@ BUT_DLall - Controls.MyButton, MissionPlanner.lanner10, Version=1.1.4932.13202, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -183,7 +187,7 @@ BUT_DLthese - Controls.MyButton, MissionPlanner.lanner10, Version=1.1.4932.13202, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -207,7 +211,7 @@ BUT_clearlogs - Controls.MyButton, MissionPlanner.lanner10, Version=1.1.4932.13202, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -228,7 +232,7 @@ CHK_logs - System.Windows.Forms.CheckedListBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.CheckedListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -252,7 +256,7 @@ TXT_status - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -276,7 +280,7 @@ BUT_redokml - Controls.MyButton, MissionPlanner.lanner10, Version=1.1.4932.13202, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -300,7 +304,7 @@ BUT_firstperson - Controls.MyButton, MissionPlanner.lanner10, Version=1.1.4932.13202, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -308,7 +312,6 @@ 6 - NoControl @@ -328,7 +331,7 @@ BUT_dumpdf - Controls.MyButton, MissionPlanner.lanner10, Version=1.1.4932.13202, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -355,7 +358,7 @@ BUT_bintolog - Controls.MyButton, MissionPlanner.lanner10, Version=1.1.4932.13202, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -385,7 +388,7 @@ CHK_arducopter - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -415,7 +418,7 @@ CHK_arduplane - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -445,7 +448,7 @@ CHK_ardurover - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -472,7 +475,7 @@ label1 - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -480,7 +483,7 @@ 0 - + True @@ -572,6 +575,6 @@ Log - System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/Log/LogBrowse.cs b/Log/LogBrowse.cs index 5e73fbdbd5..4c3952b501 100644 --- a/Log/LogBrowse.cs +++ b/Log/LogBrowse.cs @@ -147,6 +147,7 @@ private void Form1_Load(object sender, EventArgs e) } else { + this.Close(); return; } } diff --git a/Log/MavlinkLog.cs b/Log/MavlinkLog.cs index ad8ec3e5ef..c2dd4433de 100644 --- a/Log/MavlinkLog.cs +++ b/Log/MavlinkLog.cs @@ -651,11 +651,15 @@ private void BUT_graphmavlog_Click(object sender, EventArgs e) 0x600000,0x006000,0x000060,0x606000,0x600060,0x006060, 0xA00000,0x00A000,0x0000A0,0xA0A000,0xA000A0,0x00A0A0, 0xE00000,0x00E000,0x0000E0,0xE0E000,0xE000E0,0x00E0E0, */ - }; + }; + Form selectform; private List GetLogFileValidFields(string logfile) { - Form selectform = SelectDataToGraphForm(); + if (selectform != null && !selectform.IsDisposed) + selectform.Close(); + + selectform = SelectDataToGraphForm(); Hashtable seenIt = new Hashtable(); @@ -967,7 +971,7 @@ public MethodInfo RunCode(CompilerResults results) } catch (Exception ex) { - Console.WriteLine("Error: An exception occurred while executing the script", ex); + Console.WriteLine("Error: An exception occurred while executing the script\n{0}", ex); } return null; } diff --git a/MainV2.Designer.cs b/MainV2.Designer.cs index 9125d439c8..2069ce207b 100644 --- a/MainV2.Designer.cs +++ b/MainV2.Designer.cs @@ -15,6 +15,7 @@ partial class MainV2 protected override void Dispose(bool disposing) { Console.WriteLine("mainv2_Dispose"); + PluginThreadrunner.Dispose(); if (disposing && (components != null)) { components.Dispose(); diff --git a/Maps/MyImageCache.cs b/Maps/MyImageCache.cs index 2d41abab51..6617e00a42 100644 --- a/Maps/MyImageCache.cs +++ b/Maps/MyImageCache.cs @@ -68,8 +68,6 @@ bool PureImageCache.PutImageToCache(byte[] tile, int type, GPoint pos, int zoom) using (BinaryWriter sw = new BinaryWriter(File.OpenWrite(file))) { sw.Write(tile.ToArray()); - - sw.Close(); } } catch (Exception ex) @@ -103,7 +101,6 @@ PureImage PureImageCache.GetImageFromCache(int type, GPoint pos, int zoom) { ret.Data = stm; } - sr.Close(); } } } diff --git a/Mavlink/MAVLink.cs b/Mavlink/MAVLink.cs index d48c4b3f37..a6fade9605 100644 --- a/Mavlink/MAVLink.cs +++ b/Mavlink/MAVLink.cs @@ -19,7 +19,7 @@ namespace MissionPlanner { - public class MAVLinkInterface: MAVLink, IDisposable + public class MAVLinkInterface: MAVLink, IDisposable { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public ICommsSerial BaseStream { get; set; } @@ -325,7 +325,8 @@ private void OpenBg(object PRsender, bool getparams, ProgressWorkerEventArgs pro BaseStream.DiscardInBuffer(); - Thread.Sleep(500); + // other boards seem to have issues if there is no delay? posible bootloader timeout issue + Thread.Sleep(1000); } byte[] buffer = new byte[0]; @@ -673,7 +674,7 @@ public bool setParam(string paramname, float value) while (true) { - if (!(start.AddMilliseconds(500) > DateTime.Now)) + if (!(start.AddMilliseconds(700) > DateTime.Now)) { if (retrys > 0) { @@ -1457,7 +1458,7 @@ public byte getWPCount() while (true) { - if (!(start.AddMilliseconds(500) > DateTime.Now)) + if (!(start.AddMilliseconds(700) > DateTime.Now)) { if (retrys > 0) { @@ -1858,7 +1859,7 @@ public MAV_MISSION_RESULT setWP(Locationwp loc, ushort index, MAV_FRAME frame, b while (true) { - if (!(start.AddMilliseconds(150) > DateTime.Now)) + if (!(start.AddMilliseconds(700) > DateTime.Now)) { if (retrys > 0) { @@ -2441,17 +2442,26 @@ public byte[] readPacket() if (buffer[5] == (byte)MAVLink.MAVLINK_MSG_ID.STATUSTEXT) // status text { + var msg = MAV.packets[(byte)MAVLink.MAVLINK_MSG_ID.STATUSTEXT].ByteArrayToStructure(6); + + byte sev = msg.severity; + string logdata = Encoding.ASCII.GetString(buffer, 7, buffer.Length - 7); int ind = logdata.IndexOf('\0'); if (ind != -1) logdata = logdata.Substring(0, ind); log.Info(DateTime.Now + " " + logdata); - if (MainV2.speechEngine != null && MainV2.config["speechenable"] != null && MainV2.config["speechenable"].ToString() == "True") + if (sev >= 3) { - //MainV2.talk.SpeakAsync(logdata); - } + MAV.cs.messageHigh = logdata; + MAV.cs.messageHighTime = DateTime.Now; + if (MainV2.speechEngine != null && MainV2.speechEngine.State == System.Speech.Synthesis.SynthesizerState.Ready && MainV2.config["speechenable"] != null && MainV2.config["speechenable"].ToString() == "True") + { + MainV2.speechEngine.SpeakAsync(logdata); + } + } } // set ap type @@ -2597,7 +2607,7 @@ public PointLatLngAlt getFencePoint(int no, ref int total) while (true) { - if (!(start.AddMilliseconds(500) > DateTime.Now)) + if (!(start.AddMilliseconds(700) > DateTime.Now)) { if (retrys > 0) { @@ -2675,7 +2685,7 @@ public PointLatLngAlt getRallyPoint(int no, ref int total) while (true) { - if (!(start.AddMilliseconds(500) > DateTime.Now)) + if (!(start.AddMilliseconds(700) > DateTime.Now)) { if (retrys > 0) { @@ -2981,6 +2991,10 @@ public override string ToString() public void Dispose() { + if (_bytesReceivedSubj != null) + _bytesReceivedSubj.Dispose(); + if (_bytesSentSubj != null) + _bytesSentSubj.Dispose(); this.Close(); } } diff --git a/MissionPlanner.csproj b/MissionPlanner.csproj index e7f2aed607..6c464e18bc 100644 --- a/MissionPlanner.csproj +++ b/MissionPlanner.csproj @@ -322,6 +322,8 @@ Command.cs + + diff --git a/Msi/installer.wxs b/Msi/installer.wxs index c9f2089d3b..503c227517 100644 --- a/Msi/installer.wxs +++ b/Msi/installer.wxs @@ -2,14 +2,14 @@ - + - - + + @@ -32,7 +32,7 @@ - + @@ -68,52 +68,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -138,11 +138,11 @@ - + - + @@ -153,20 +153,20 @@ - + - + - + @@ -180,7 +180,7 @@ - + @@ -192,13 +192,13 @@ - + - + @@ -209,7 +209,7 @@ - + @@ -220,12 +220,12 @@ - + - + @@ -239,28 +239,28 @@ - + - + - + - + - + @@ -269,17 +269,17 @@ - + - + - + @@ -289,22 +289,22 @@ - + - + - + - + @@ -411,7 +411,7 @@ - + Dimensions of the image, calculated once in constructor. - public IntPtr m_handle = IntPtr.Zero; + private IntPtr m_handle = IntPtr.Zero; private int m_videoWidth; private int m_videoHeight; private int m_stride; @@ -95,7 +95,6 @@ private void saveconfig() sw.WriteLine(txtAviFileName.Text); sw.WriteLine(txt_tlog.Text); sw.WriteLine(trackBar1.Value); - sw.Close(); } } catch { } @@ -110,7 +109,6 @@ private void loadconfig() txtAviFileName.Text = sr.ReadLine(); txt_tlog.Text = sr.ReadLine(); trackBar1.Value = int.Parse(sr.ReadLine()); - sr.Close(); } } catch { } diff --git a/Program.cs b/Program.cs index 4c460fc771..b18fef082f 100644 --- a/Program.cs +++ b/Program.cs @@ -336,27 +336,29 @@ static void handleException(Exception ex) // Set the ContentLength property of the WebRequest. request.ContentLength = byteArray.Length; // Get the request stream. - Stream dataStream = request.GetRequestStream(); - // Write the data to the request stream. - dataStream.Write(byteArray, 0, byteArray.Length); - // Close the Stream object. - dataStream.Close(); + using (Stream dataStream = request.GetRequestStream()) + { + // Write the data to the request stream. + dataStream.Write(byteArray, 0, byteArray.Length); + } // Get the response. - WebResponse response = request.GetResponse(); - // Display the status. - Console.WriteLine(((HttpWebResponse)response).StatusDescription); - // Get the stream containing content returned by the server. - dataStream = response.GetResponseStream(); - // Open the stream using a StreamReader for easy access. - StreamReader reader = new StreamReader(dataStream); - // Read the content. - string responseFromServer = reader.ReadToEnd(); - // Display the content. - Console.WriteLine(responseFromServer); - // Clean up the streams. - reader.Close(); - dataStream.Close(); - response.Close(); + using (WebResponse response = request.GetResponse()) + { + // Display the status. + Console.WriteLine(((HttpWebResponse)response).StatusDescription); + // Get the stream containing content returned by the server. + using (Stream dataStream = response.GetResponseStream()) + { + // Open the stream using a StreamReader for easy access. + using (StreamReader reader = new StreamReader(dataStream)) + { + // Read the content. + string responseFromServer = reader.ReadToEnd(); + // Display the content. + Console.WriteLine(responseFromServer); + } + } + } } catch { diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 62b9cfb10d..0a3cc84592 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.*")] -[assembly: AssemblyFileVersion("1.2.85")] +[assembly: AssemblyFileVersion("1.2.86")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/RAW_Sensor.Designer.cs b/RAW_Sensor.Designer.cs index d2a48d6f5d..91c25daeec 100644 --- a/RAW_Sensor.Designer.cs +++ b/RAW_Sensor.Designer.cs @@ -14,6 +14,8 @@ partial class RAW_Sensor /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { + if (sw != null) + sw.Dispose(); if (disposing && (components != null)) { components.Dispose(); diff --git a/Radio/3DRradio.Designer.cs b/Radio/3DRradio.Designer.cs index 852a8bcd5f..ad5bc60302 100644 --- a/Radio/3DRradio.Designer.cs +++ b/Radio/3DRradio.Designer.cs @@ -75,10 +75,10 @@ private void InitializeComponent() this.ATI = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); - this.BUT_savesettings = new Controls.MyButton(); - this.BUT_getcurrent = new Controls.MyButton(); + this.BUT_savesettings = new MissionPlanner.Controls.MyButton(); + this.BUT_getcurrent = new MissionPlanner.Controls.MyButton(); this.lbl_status = new System.Windows.Forms.Label(); - this.BUT_upload = new Controls.MyButton(); + this.BUT_upload = new MissionPlanner.Controls.MyButton(); this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); @@ -103,13 +103,15 @@ private void InitializeComponent() this.label18 = new System.Windows.Forms.Label(); this.SPLIT_remote = new System.Windows.Forms.SplitContainer(); this.CHK_advanced = new System.Windows.Forms.CheckBox(); - this.BUT_Syncoptions = new Controls.MyButton(); + this.BUT_Syncoptions = new MissionPlanner.Controls.MyButton(); this.ATI3 = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); - this.BUT_resettodefault = new Controls.MyButton(); + this.BUT_resettodefault = new MissionPlanner.Controls.MyButton(); + this.ATI2 = new System.Windows.Forms.TextBox(); + this.RTI2 = new System.Windows.Forms.TextBox(); this.SPLIT_local.Panel1.SuspendLayout(); this.SPLIT_local.Panel2.SuspendLayout(); this.SPLIT_local.SuspendLayout(); @@ -934,6 +936,7 @@ private void InitializeComponent() // // groupBox1 // + this.groupBox1.Controls.Add(this.ATI2); this.groupBox1.Controls.Add(this.SPLIT_local); this.groupBox1.Controls.Add(this.ATI3); this.groupBox1.Controls.Add(this.label11); @@ -946,6 +949,7 @@ private void InitializeComponent() // // groupBox2 // + this.groupBox2.Controls.Add(this.RTI2); this.groupBox2.Controls.Add(this.label9); this.groupBox2.Controls.Add(this.SPLIT_remote); this.groupBox2.Controls.Add(this.RTI); @@ -970,6 +974,18 @@ private void InitializeComponent() this.BUT_resettodefault.UseVisualStyleBackColor = true; this.BUT_resettodefault.Click += new System.EventHandler(this.BUT_resettodefault_Click); // + // ATI2 + // + resources.ApplyResources(this.ATI2, "ATI2"); + this.ATI2.Name = "ATI2"; + this.ATI2.ReadOnly = true; + // + // RTI2 + // + resources.ApplyResources(this.RTI2, "RTI2"); + this.RTI2.Name = "RTI2"; + this.RTI2.ReadOnly = true; + // // _3DRradio // resources.ApplyResources(this, "$this"); @@ -1089,5 +1105,7 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox S16; private System.Windows.Forms.Label label18; private System.Windows.Forms.ComboBox S15; + private System.Windows.Forms.TextBox ATI2; + private System.Windows.Forms.TextBox RTI2; } } \ No newline at end of file diff --git a/Radio/3DRradio.cs b/Radio/3DRradio.cs index 9bc6fbfb8b..50585375c4 100644 --- a/Radio/3DRradio.cs +++ b/Radio/3DRradio.cs @@ -40,20 +40,20 @@ public _3DRradio() RS3.DataSource = Enumerable.Range(0, 500).ToArray(); } - bool getFirmware(uploader.Uploader.Code device) + bool getFirmware(uploader.Uploader.Board device) { // was https://raw.github.com/tridge/SiK/master/Firmware/dst/radio.hm_trp.hex // now http://www.samba.org/tridge/UAV/3DR/radio.hm_trp.hex - if (device == uploader.Uploader.Code.DEVICE_ID_HM_TRP) + if (device == uploader.Uploader.Board.DEVICE_ID_HM_TRP) { return Common.getFilefromNet("http://www.samba.org/tridge/UAV/3DR/radio.hm_trp.hex", firmwarefile); } - else if (device == uploader.Uploader.Code.DEVICE_ID_RFD900) + else if (device == uploader.Uploader.Board.DEVICE_ID_RFD900) { return Common.getFilefromNet("http://rfdesign.com.au/firmware/radio.rfd900.hex", firmwarefile); } - else if (device == uploader.Uploader.Code.DEVICE_ID_RFD900A) + else if (device == uploader.Uploader.Board.DEVICE_ID_RFD900A) { int fixme; int fixme23; @@ -149,8 +149,8 @@ private void BUT_upload_Click(object sender, EventArgs e) catch { } } - global::uploader.Uploader.Code device = global::uploader.Uploader.Code.FAILED; - global::uploader.Uploader.Code freq = global::uploader.Uploader.Code.FAILED; + global::uploader.Uploader.Board device = global::uploader.Uploader.Board.FAILED; + global::uploader.Uploader.Frequency freq = global::uploader.Uploader.Frequency.FAILED; // get the device type and frequency in the bootloader uploader.getDevice(ref device, ref freq); @@ -466,19 +466,27 @@ private void BUT_getcurrent_Click(object sender, EventArgs e) RTI.Text = doCommand(comPort, "RTI"); - uploader.Uploader.Code freq = (uploader.Uploader.Code)Enum.Parse(typeof(uploader.Uploader.Code), doCommand(comPort, "ATI3")); - uploader.Uploader.Code board = (uploader.Uploader.Code)Enum.Parse(typeof(uploader.Uploader.Code), doCommand(comPort, "ATI2")); + uploader.Uploader.Frequency freq = (uploader.Uploader.Frequency)Enum.Parse(typeof(uploader.Uploader.Frequency), doCommand(comPort, "ATI3")); + uploader.Uploader.Board board = (uploader.Uploader.Board)Enum.Parse(typeof(uploader.Uploader.Board), doCommand(comPort, "ATI2")); ATI3.Text = freq.ToString(); + + ATI2.Text = board.ToString(); + try + { + RTI2.Text = ((uploader.Uploader.Board)Enum.Parse(typeof(uploader.Uploader.Board), doCommand(comPort, "RTI2"))).ToString(); + } + catch { } // 8 and 9 - if (freq == uploader.Uploader.Code.FREQ_915) { + if (freq == uploader.Uploader.Frequency.FREQ_915) + { S8.DataSource = Range(895000, 1000, 935000); RS8.DataSource = Range(895000, 1000, 935000); S9.DataSource = Range(895000, 1000, 935000); RS9.DataSource = Range(895000, 1000, 935000); } - else if (freq == uploader.Uploader.Code.FREQ_433) + else if (freq == uploader.Uploader.Frequency.FREQ_433) { S8.DataSource = Range(414000, 100, 454000); RS8.DataSource = Range(414000, 100, 454000); @@ -486,7 +494,7 @@ private void BUT_getcurrent_Click(object sender, EventArgs e) S9.DataSource = Range(414000, 100, 454000); RS9.DataSource = Range(414000, 100, 454000); } - else if (freq == uploader.Uploader.Code.FREQ_868) + else if (freq == uploader.Uploader.Frequency.FREQ_868) { S8.DataSource = Range(849000, 1000, 889000); RS8.DataSource = Range(849000, 1000, 889000); @@ -495,7 +503,7 @@ private void BUT_getcurrent_Click(object sender, EventArgs e) RS9.DataSource = Range(849000, 1000, 889000); } - if (board == uploader.Uploader.Code.DEVICE_ID_RFD900 || board == uploader.Uploader.Code.DEVICE_ID_RFD900A) + if (board == uploader.Uploader.Board.DEVICE_ID_RFD900 || board == uploader.Uploader.Board.DEVICE_ID_RFD900A) { S4.DataSource = Range(1, 1, 30); RS4.DataSource = Range(1, 1, 30); diff --git a/Radio/3DRradio.resx b/Radio/3DRradio.resx index 847db5b908..7b6f4a7a9f 100644 --- a/Radio/3DRradio.resx +++ b/Radio/3DRradio.resx @@ -140,6 +140,9 @@ 10 + + 17, 17 + False @@ -179,9 +182,6 @@ 4 - - 17, 17 - Serial baud rate in rounded kbps. So 57 means 57600. @@ -754,6 +754,9 @@ 14 + + 17, 17 + False @@ -1129,7 +1132,7 @@ 1 - 82, 38 + 59, 38 True @@ -1160,7 +1163,7 @@ which result in a valid packet CRC groupBox1 - 4 + 5 False @@ -2073,10 +2076,10 @@ red LED solid - in firmware update mode groupBox2 - 2 + 3 - 82, 12 + 59, 12 147, 20 @@ -2094,7 +2097,7 @@ red LED solid - in firmware update mode groupBox1 - 3 + 4 True @@ -2121,7 +2124,7 @@ red LED solid - in firmware update mode groupBox1 - 2 + 3 True @@ -2148,7 +2151,7 @@ red LED solid - in firmware update mode groupBox1 - 5 + 6 False @@ -2169,7 +2172,7 @@ red LED solid - in firmware update mode BUT_savesettings - Controls.MyButton, 3DRRadio, Version=0.0.4897.38272, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -2193,7 +2196,7 @@ red LED solid - in firmware update mode BUT_getcurrent - Controls.MyButton, 3DRRadio, Version=0.0.4897.38272, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -2238,7 +2241,7 @@ red LED solid - in firmware update mode BUT_upload - Controls.MyButton, 3DRRadio, Version=0.0.4897.38272, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -2929,7 +2932,7 @@ red LED solid - in firmware update mode groupBox1 - 0 + 1 True @@ -2983,7 +2986,7 @@ red LED solid - in firmware update mode groupBox2 - 1 + 2 True @@ -3037,7 +3040,7 @@ red LED solid - in firmware update mode BUT_Syncoptions - Controls.MyButton, 3DRRadio, Version=0.0.4897.38272, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this @@ -3046,7 +3049,7 @@ red LED solid - in firmware update mode 5 - 230, 12 + 207, 12 102, 20 @@ -3064,7 +3067,31 @@ red LED solid - in firmware update mode groupBox1 - 1 + 2 + + + 315, 12 + + + True + + + 61, 65 + + + 80 + + + ATI2 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 12, 48 @@ -3090,6 +3117,30 @@ red LED solid - in firmware update mode 4 + + 246, 12 + + + True + + + 61, 65 + + + 81 + + + RTI2 + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 0 + True @@ -3118,7 +3169,7 @@ red LED solid - in firmware update mode groupBox2 - 0 + 1 400, 48 @@ -3190,7 +3241,7 @@ red LED solid - in firmware update mode BUT_resettodefault - Controls.MyButton, 3DRRadio, Version=0.0.4897.38272, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.MyButton, MissionPlanner.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null $this diff --git a/Radio/Uploader.cs b/Radio/Uploader.cs index 57e5ae475c..218f22b561 100644 --- a/Radio/Uploader.cs +++ b/Radio/Uploader.cs @@ -37,19 +37,32 @@ public enum Code : byte PROG_MULTI_MAX = 32, // maximum number of bytes in a PROG_MULTI command READ_MULTI_MAX = 255, // largest read that can be requested - // device IDs XXX should come with the firmware image... - DEVICE_ID_RF50 = 0x4d, - DEVICE_ID_HM_TRP= 0x4e, + + }; + + public enum Board : byte + { + // device IDs XXX should come with the firmware image... + DEVICE_ID_RF50 = 0x4d, + DEVICE_ID_HM_TRP = 0x4e, DEVICE_ID_RFD900 = 0X42, DEVICE_ID_RFD900A = 0X43, - - // frequency code bytes XXX should come with the firmware image... - FREQ_NONE = 0xf0, - FREQ_433 = 0x43, - FREQ_470 = 0x47, - FREQ_868 = 0x86, - FREQ_915 = 0x91, - }; + + FAILED = 0x11, + } + + public enum Frequency : byte + { + // frequency code bytes XXX should come with the firmware image... + FREQ_NONE = 0xf0, + FREQ_433 = 0x43, + FREQ_470 = 0x47, + FREQ_868 = 0x86, + FREQ_915 = 0x91, + + FAILED = 0x11, + } + public Uploader () { @@ -75,7 +88,7 @@ public void upload (SerialPort on_port, IHex image_data) } catch (Exception e) { if (port.IsOpen) port.Close (); - throw e; + throw; } } @@ -312,33 +325,34 @@ private void cmdReboot () { send (Code.REBOOT); } - - private void checkDevice () - { - Code id, freq; - - send (Code.GET_DEVICE); - send (Code.EOC); - - id = (Code)recv (); - freq = (Code)recv (); - - // XXX should be getting valid board/frequency data from firmware file - if ((id != Code.DEVICE_ID_HM_TRP) && (id != Code.DEVICE_ID_RF50) && (id != Code.DEVICE_ID_RFD900) && (id != Code.DEVICE_ID_RFD900A)) - throw new Exception ("bootloader device ID mismatch - device:" + id.ToString()); - - getSync (); - } - public void getDevice(ref Code device, ref Code freq) + private void checkDevice() + { + Board id; + Frequency freq; + + send(Code.GET_DEVICE); + send(Code.EOC); + + id = (Board)recv(); + freq = (Frequency)recv(); + + // XXX should be getting valid board/frequency data from firmware file + if ((id != Board.DEVICE_ID_HM_TRP) && (id != Board.DEVICE_ID_RF50) && (id != Board.DEVICE_ID_RFD900) && (id != Board.DEVICE_ID_RFD900A)) + throw new Exception("bootloader device ID mismatch - device:" + id.ToString()); + + getSync(); + } + + public void getDevice(ref Board device, ref Frequency freq) { connect_and_sync(); send(Code.GET_DEVICE); send(Code.EOC); - device = (Code)recv(); - freq = (Code)recv(); + device = (Board)recv(); + freq = (Frequency)recv(); getSync(); } diff --git a/Resources/Hframe.png b/Resources/Hframe.png index eef7b02d03..8578a42d37 100644 Binary files a/Resources/Hframe.png and b/Resources/Hframe.png differ diff --git a/Resources/Hframelight.png b/Resources/Hframelight.png index 7c8ef05a09..0cccbf605f 100644 Binary files a/Resources/Hframelight.png and b/Resources/Hframelight.png differ diff --git a/Utilities/Firmware.cs b/Utilities/Firmware.cs index 31db1f8f5d..5df3c48fe9 100644 --- a/Utilities/Firmware.cs +++ b/Utilities/Firmware.cs @@ -553,21 +553,17 @@ public bool UploadFlash(string comport, string filename, BoardDetect.boards boar } byte[] FLASH = new byte[1]; - StreamReader sr = null; try { updateProgress(0, "Reading Hex File"); - sr = new StreamReader(filename); - FLASH = readIntelHEXv2(sr); - sr.Close(); + using (StreamReader sr = new StreamReader(filename)) + { + FLASH = readIntelHEXv2(sr); + } log.InfoFormat("\n\nSize: {0}\n\n", FLASH.Length); } catch (Exception ex) { - if (sr != null) - { - sr.Dispose(); - } updateProgress(0, "Failed read HEX"); CustomMessageBox.Show("Failed to read firmware.hex : " + ex.Message); return false; diff --git a/Utilities/GMapMarkerRallyPt.cs b/Utilities/GMapMarkerRallyPt.cs index 4cfd73d570..f6536c9d84 100644 --- a/Utilities/GMapMarkerRallyPt.cs +++ b/Utilities/GMapMarkerRallyPt.cs @@ -18,6 +18,8 @@ public class GMapMarkerRallyPt : GMapMarker //static Bitmap localcache1 = Resources.shadow50; static Bitmap localcache2 = Resources.marker_02; + public int Alt { get; set; } + public GMapMarkerRallyPt(PointLatLng p) : base(p) { diff --git a/Utilities/ParameterMetaDataParser.cs b/Utilities/ParameterMetaDataParser.cs index 8d737be9d5..093f4de591 100644 --- a/Utilities/ParameterMetaDataParser.cs +++ b/Utilities/ParameterMetaDataParser.cs @@ -333,18 +333,9 @@ private static string ReadDataFromAddress(string address) { // Store the data to return data = reader.ReadToEnd(); - - // Close the reader - reader.Close(); } - - // Close the datastream - dataStream.Close(); } } - - // Close the response - response.Close(); } cache[address] = data; diff --git a/Utilities/Update.cs b/Utilities/Update.cs index e9918d6052..d17f6b749d 100644 --- a/Utilities/Update.cs +++ b/Utilities/Update.cs @@ -72,7 +72,9 @@ public static void updateCheckMain(ProgressReporterDialogue frmProgressReporter) process.Start(); log.Info("Quitting existing process"); + frmProgressReporter.BeginInvoke((Action) delegate { Application.Exit(); + }); } catch (Exception ex) { @@ -108,56 +110,52 @@ public static void CheckForUpdate() // ((HttpWebRequest)webRequest).IfModifiedSince = File.GetLastWriteTimeUtc(path); - // Get the response. - var response = webRequest.GetResponse(); - // Display the status. - log.Debug("Response status: " + ((HttpWebResponse)response).StatusDescription); - // Get the stream containing content returned by the server. - bool updateFound = false; - if (File.Exists(path)) + // Get the response. + using (var response = webRequest.GetResponse()) { - var fi = new FileInfo(path); - - Version LocalVersion = new Version(); - Version WebVersion = new Version(); + // Display the status. + log.Debug("Response status: " + ((HttpWebResponse)response).StatusDescription); + // Get the stream containing content returned by the server. if (File.Exists(path)) { - using (Stream fs = File.OpenRead(path)) + var fi = new FileInfo(path); + + Version LocalVersion = new Version(); + Version WebVersion = new Version(); + + if (File.Exists(path)) { - using (StreamReader sr = new StreamReader(fs)) + using (Stream fs = File.OpenRead(path)) { - LocalVersion = new Version(sr.ReadLine()); - sr.Close(); + using (StreamReader sr = new StreamReader(fs)) + { + LocalVersion = new Version(sr.ReadLine()); + } } - fs.Close(); } - } - using (StreamReader sr = new StreamReader(response.GetResponseStream())) - { - WebVersion = new Version(sr.ReadLine()); - - sr.Close(); - } + using (StreamReader sr = new StreamReader(response.GetResponseStream())) + { + WebVersion = new Version(sr.ReadLine()); + } - log.Info("New file Check: local " + LocalVersion + " vs Remote " + WebVersion); + log.Info("New file Check: local " + LocalVersion + " vs Remote " + WebVersion); - if (LocalVersion < WebVersion) + if (LocalVersion < WebVersion) + { + updateFound = true; + } + } + else { updateFound = true; + log.Info("File does not exist: Getting " + path); + // get it } } - else - { - updateFound = true; - log.Info("File does not exist: Getting " + path); - // get it - } - - response.Close(); if (updateFound) { @@ -321,58 +319,56 @@ static void GetNewFile(ProgressReporterDialogue frmProgressReporter, string base // tell server we allow compress content request.Headers.Add("Accept-Encoding", "gzip,deflate"); // Get the response. - WebResponse response = request.GetResponse(); - // Display the status. - log.Info(((HttpWebResponse)response).StatusDescription); - // Get the stream containing content returned by the server. - Stream dataStream = response.GetResponseStream(); + using (WebResponse response = request.GetResponse()) + { + // Display the status. + log.Info(((HttpWebResponse)response).StatusDescription); + // Get the stream containing content returned by the server. + Stream dataStream = response.GetResponseStream(); - // update status - if (frmProgressReporter != null) - frmProgressReporter.UpdateProgressAndStatus(-1, "Getting " + file); + // update status + if (frmProgressReporter != null) + frmProgressReporter.UpdateProgressAndStatus(-1, "Getting " + file); - // from head - long bytes = response.ContentLength; + // from head + long bytes = response.ContentLength; - long contlen = bytes; + long contlen = bytes; - byte[] buf1 = new byte[4096]; + byte[] buf1 = new byte[4096]; - // if the file doesnt exist. just save it inplace - string fn = path + ".new"; + // if the file doesnt exist. just save it inplace + string fn = path + ".new"; - if (!File.Exists(path)) - fn = path; + if (!File.Exists(path)) + fn = path; - using (FileStream fs = new FileStream(fn, FileMode.Create)) - { + using (FileStream fs = new FileStream(fn, FileMode.Create)) + { - DateTime dt = DateTime.Now; + DateTime dt = DateTime.Now; - while (dataStream.CanRead) - { - try + while (dataStream.CanRead) { - if (dt.Second != DateTime.Now.Second) + try { - if (frmProgressReporter != null) - frmProgressReporter.UpdateProgressAndStatus((int)(((double)(contlen - bytes) / (double)contlen) * 100), "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes"); - dt = DateTime.Now; + if (dt.Second != DateTime.Now.Second) + { + if (frmProgressReporter != null) + frmProgressReporter.UpdateProgressAndStatus((int)(((double)(contlen - bytes) / (double)contlen) * 100), "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes"); + dt = DateTime.Now; + } } + catch { } + log.Debug(file + " " + bytes); + int len = dataStream.Read(buf1, 0, buf1.Length); + if (len == 0) + break; + bytes -= len; + fs.Write(buf1, 0, len); } - catch { } - log.Debug(file + " " + bytes); - int len = dataStream.Read(buf1, 0, buf1.Length); - if (len == 0) - break; - bytes -= len; - fs.Write(buf1, 0, len); } - fs.Close(); } - - response.Close(); - } catch (Exception ex) { fail = ex; attempt++; continue; } @@ -429,66 +425,69 @@ private static bool updateCheck(ProgressReporterDialogue frmProgressReporter, st // Get the request stream. Stream dataStream; //= request.GetRequestStream(); // Get the response. - WebResponse response = request.GetResponse(); - // Display the status. - log.Info(((HttpWebResponse)response).StatusDescription); - // Get the stream containing content returned by the server. - dataStream = response.GetResponseStream(); - // Open the stream using a StreamReader for easy access. - StreamReader reader = new StreamReader(dataStream); - // Read the content. - string responseFromServer = reader.ReadToEnd(); - // Display the content. - Regex regex = new Regex("href=\"([^\"]+)\"", RegexOptions.IgnoreCase); - - Uri baseuri = new Uri(baseurl, UriKind.Absolute); - - if (regex.IsMatch(responseFromServer)) + using (WebResponse response = request.GetResponse()) { - MatchCollection matchs = regex.Matches(responseFromServer); - for (int i = 0; i < matchs.Count; i++) + // Display the status. + log.Info(((HttpWebResponse)response).StatusDescription); + // Get the stream containing content returned by the server. + using (dataStream = response.GetResponseStream()) { - if (matchs[i].Groups[1].Value.ToString().Contains("..")) - continue; - if (matchs[i].Groups[1].Value.ToString().Contains("http")) - continue; - if (matchs[i].Groups[1].Value.ToString().StartsWith("?")) - continue; - if (matchs[i].Groups[1].Value.ToString().ToLower().Contains(".etag")) - continue; - - // + // Open the stream using a StreamReader for easy access. + using (StreamReader reader = new StreamReader(dataStream)) { - string url = System.Web.HttpUtility.UrlDecode(matchs[i].Groups[1].Value.ToString()); - Uri newuri = new Uri(baseuri, url); - files.Add(baseuri.MakeRelativeUri(newuri).ToString()); - } + // Read the content. + string responseFromServer = reader.ReadToEnd(); + // Display the content. + Regex regex = new Regex("href=\"([^\"]+)\"", RegexOptions.IgnoreCase); + Uri baseuri = new Uri(baseurl, UriKind.Absolute); - // dirs - if (matchs[i].Groups[1].Value.ToString().Contains("tree/master/")) - { - string url = System.Web.HttpUtility.UrlDecode(matchs[i].Groups[1].Value.ToString()) + "/"; - Uri newuri = new Uri(baseuri, url); - files.Add(baseuri.MakeRelativeUri(newuri).ToString()); + if (regex.IsMatch(responseFromServer)) + { + MatchCollection matchs = regex.Matches(responseFromServer); + for (int i = 0; i < matchs.Count; i++) + { + if (matchs[i].Groups[1].Value.ToString().Contains("..")) + continue; + if (matchs[i].Groups[1].Value.ToString().Contains("http")) + continue; + if (matchs[i].Groups[1].Value.ToString().StartsWith("?")) + continue; + if (matchs[i].Groups[1].Value.ToString().ToLower().Contains(".etag")) + continue; + + // + { + string url = System.Web.HttpUtility.UrlDecode(matchs[i].Groups[1].Value.ToString()); + Uri newuri = new Uri(baseuri, url); + files.Add(baseuri.MakeRelativeUri(newuri).ToString()); + } - } - // files - if (matchs[i].Groups[1].Value.ToString().Contains("blob/master/")) - { - string url = System.Web.HttpUtility.UrlDecode(matchs[i].Groups[1].Value.ToString()); - Uri newuri = new Uri(baseuri, url); - files.Add(System.Web.HttpUtility.UrlDecode(newuri.Segments[newuri.Segments.Length - 1])); + + // dirs + if (matchs[i].Groups[1].Value.ToString().Contains("tree/master/")) + { + string url = System.Web.HttpUtility.UrlDecode(matchs[i].Groups[1].Value.ToString()) + "/"; + Uri newuri = new Uri(baseuri, url); + files.Add(baseuri.MakeRelativeUri(newuri).ToString()); + + } + // files + if (matchs[i].Groups[1].Value.ToString().Contains("blob/master/")) + { + string url = System.Web.HttpUtility.UrlDecode(matchs[i].Groups[1].Value.ToString()); + Uri newuri = new Uri(baseuri, url); + files.Add(System.Web.HttpUtility.UrlDecode(newuri.Segments[newuri.Segments.Length - 1])); + } + } + } + + //Console.WriteLine(responseFromServer); + // Clean up the streams. } } } - //Console.WriteLine(responseFromServer); - // Clean up the streams. - reader.Close(); - dataStream.Close(); - response.Close(); - string dir = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + subdir; if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); @@ -538,119 +537,112 @@ private static bool updateCheck(ProgressReporterDialogue frmProgressReporter, st request.Headers.Add("Accept-Encoding", "gzip,deflate"); // Get the response. - response = request.GetResponse(); - // Display the status. - log.Info(((HttpWebResponse)response).StatusDescription); - // Get the stream containing content returned by the server. - dataStream = response.GetResponseStream(); - // Open the stream using a StreamReader for easy access. - - bool updateThisFile = false; - - if (File.Exists(path)) + using (WebResponse response = request.GetResponse()) { - FileInfo fi = new FileInfo(path); + // Display the status. + log.Info(((HttpWebResponse)response).StatusDescription); + // Get the stream containing content returned by the server. + using (dataStream = response.GetResponseStream()) + { + // Open the stream using a StreamReader for easy access. - //log.Info(response.Headers[HttpResponseHeader.ETag]); - string CurrentEtag = ""; + bool updateThisFile = false; - if (File.Exists(path + ".etag")) - { - using (Stream fs = File.OpenRead(path + ".etag")) + if (File.Exists(path)) { - using (StreamReader sr = new StreamReader(fs)) + FileInfo fi = new FileInfo(path); + + //log.Info(response.Headers[HttpResponseHeader.ETag]); + string CurrentEtag = ""; + + if (File.Exists(path + ".etag")) { - CurrentEtag = sr.ReadLine(); - sr.Close(); + using (Stream fs = File.OpenRead(path + ".etag")) + { + using (StreamReader sr = new StreamReader(fs)) + { + CurrentEtag = sr.ReadLine(); + } + } } - fs.Close(); - } - } - log.Debug("New file Check: " + fi.Length + " vs " + response.ContentLength + " " + response.Headers[HttpResponseHeader.ETag] + " vs " + CurrentEtag); + log.Debug("New file Check: " + fi.Length + " vs " + response.ContentLength + " " + response.Headers[HttpResponseHeader.ETag] + " vs " + CurrentEtag); - if (fi.Length != response.ContentLength || response.Headers[HttpResponseHeader.ETag] != CurrentEtag) - { - using (StreamWriter sw = new StreamWriter(path + ".etag.new")) - { - sw.WriteLine(response.Headers[HttpResponseHeader.ETag]); - sw.Close(); + if (fi.Length != response.ContentLength || response.Headers[HttpResponseHeader.ETag] != CurrentEtag) + { + using (StreamWriter sw = new StreamWriter(path + ".etag.new")) + { + sw.WriteLine(response.Headers[HttpResponseHeader.ETag]); + } + updateThisFile = true; + log.Info("NEW FILE " + file); + } } - updateThisFile = true; - log.Info("NEW FILE " + file); - } - } - else - { - updateThisFile = true; - log.Info("NEW FILE " + file); - using (StreamWriter sw = new StreamWriter(path + ".etag.new")) - { - sw.WriteLine(response.Headers[HttpResponseHeader.ETag]); - sw.Close(); - } - // get it - } - - if (updateThisFile) - { - if (!update) - { - //DialogResult dr = MessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo); - //if (dr == DialogResult.Yes) + else { - update = true; + updateThisFile = true; + log.Info("NEW FILE " + file); + using (StreamWriter sw = new StreamWriter(path + ".etag.new")) + { + sw.WriteLine(response.Headers[HttpResponseHeader.ETag]); + } + // get it } - //else + + if (updateThisFile) { - // return; - } - } - if (frmProgressReporter != null) - frmProgressReporter.UpdateProgressAndStatus(-1, "Getting " + file); + if (!update) + { + //DialogResult dr = MessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo); + //if (dr == DialogResult.Yes) + { + update = true; + } + //else + { + // return; + } + } + if (frmProgressReporter != null) + frmProgressReporter.UpdateProgressAndStatus(-1, "Getting " + file); - // from head - long bytes = response.ContentLength; + // from head + long bytes = response.ContentLength; - long contlen = bytes; + long contlen = bytes; - byte[] buf1 = new byte[4096]; + byte[] buf1 = new byte[4096]; - using (FileStream fs = new FileStream(path + ".new", FileMode.Create)) - { + using (FileStream fs = new FileStream(path + ".new", FileMode.Create)) + { - DateTime dt = DateTime.Now; + DateTime dt = DateTime.Now; - //dataStream.ReadTimeout = 30000; + //dataStream.ReadTimeout = 30000; - while (dataStream.CanRead) - { - try - { - if (dt.Second != DateTime.Now.Second) + while (dataStream.CanRead) { - if (frmProgressReporter != null) - frmProgressReporter.UpdateProgressAndStatus((int)(((double)(contlen - bytes) / (double)contlen) * 100), "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes"); - dt = DateTime.Now; + try + { + if (dt.Second != DateTime.Now.Second) + { + if (frmProgressReporter != null) + frmProgressReporter.UpdateProgressAndStatus((int)(((double)(contlen - bytes) / (double)contlen) * 100), "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes"); + dt = DateTime.Now; + } + } + catch { } + log.Debug(file + " " + bytes); + int len = dataStream.Read(buf1, 0, buf1.Length); + if (len == 0) + break; + bytes -= len; + fs.Write(buf1, 0, len); } } - catch { } - log.Debug(file + " " + bytes); - int len = dataStream.Read(buf1, 0, buf1.Length); - if (len == 0) - break; - bytes -= len; - fs.Write(buf1, 0, len); } - fs.Close(); } } - - - reader.Close(); - //dataStream.Close(); - response.Close(); - } catch (Exception ex) { fail = ex; attempt++; update = false; continue; } diff --git a/Utilities/httpserver.cs b/Utilities/httpserver.cs index 50f9d6f226..8c2a6719bd 100644 --- a/Utilities/httpserver.cs +++ b/Utilities/httpserver.cs @@ -438,18 +438,17 @@ public void DoAcceptTcpClientCallback(IAsyncResult ar) byte[] temp = asciiEncoding.GetBytes(header); stream.Write(temp, 0, temp.Length); - BinaryReader file = new BinaryReader(memstream); - byte[] buffer = new byte[1024]; - while (file.BaseStream.Position < file.BaseStream.Length) + using (BinaryReader file = new BinaryReader(memstream)) { + byte[] buffer = new byte[1024]; + while (file.BaseStream.Position < file.BaseStream.Length) + { - int leng = file.Read(buffer, 0, buffer.Length); + int leng = file.Read(buffer, 0, buffer.Length); - stream.Write(buffer, 0, leng); + stream.Write(buffer, 0, leng); + } } - file.Close(); - resi.Dispose(); - orig.Dispose(); } goto again; @@ -667,8 +666,6 @@ public void DoAcceptTcpClientCallback(IAsyncResult ar) "; temp = asciiEncoding.GetBytes(content); stream.Write(temp, 0, temp.Length); - - stream.Close(); } stream.Close(); @@ -676,11 +673,6 @@ public void DoAcceptTcpClientCallback(IAsyncResult ar) catch (Exception ee) { log.Error("Failed http ", ee); - try - { - client.Close(); - } - catch { } } } } diff --git a/Wizard/3ConnectAP.Designer.cs b/Wizard/3ConnectAP.Designer.cs index 9bf6393506..963c2c7b4b 100644 --- a/Wizard/3ConnectAP.Designer.cs +++ b/Wizard/3ConnectAP.Designer.cs @@ -33,7 +33,7 @@ private void InitializeComponent() this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.radialGradientBG1 = new Controls.GradientBG(); + this.radialGradientBG1 = new MissionPlanner.Controls.GradientBG(); this.panel4 = new System.Windows.Forms.Panel(); this.CMB_port = new System.Windows.Forms.ComboBox(); this.label7 = new System.Windows.Forms.Label(); @@ -143,7 +143,7 @@ private void InitializeComponent() this.CMB_port.FormattingEnabled = true; this.CMB_port.Location = new System.Drawing.Point(338, 44); this.CMB_port.Name = "CMB_port"; - this.CMB_port.Size = new System.Drawing.Size(153, 21); + this.CMB_port.Size = new System.Drawing.Size(163, 21); this.CMB_port.TabIndex = 4; this.CMB_port.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.CMB_port_DrawItem); this.CMB_port.Click += new System.EventHandler(this.CMB_port_Click); @@ -159,7 +159,7 @@ private void InitializeComponent() this.label7.Size = new System.Drawing.Size(327, 123); this.label7.TabIndex = 3; this.label7.Text = "Please select your comport from the list.\r\n\r\nThe correct comport will apear as \"A" + - "rduino Mega 2560\"\r\n\r\n"; + "rduino Mega 2560\" or \"PX4 FMU\"\r\n\r\n"; // // label8 // @@ -170,6 +170,7 @@ private void InitializeComponent() this.label8.Size = new System.Drawing.Size(198, 22); this.label8.TabIndex = 1; this.label8.Text = "SELECT COM PORT"; + this.label8.Click += new System.EventHandler(this.label8_Click); // // _3ConnectAP // diff --git a/Wizard/3ConnectAP.cs b/Wizard/3ConnectAP.cs index 080da2a580..4c57306828 100644 --- a/Wizard/3ConnectAP.cs +++ b/Wizard/3ConnectAP.cs @@ -19,6 +19,7 @@ public partial class _3ConnectAP : MyUserControl, IWizard, IActivate List> fwmap = new List>(); ProgressReporterDialogue pdr; string comport = ""; + private bool usebeta; public _3ConnectAP() { @@ -97,7 +98,7 @@ public int WizardValidate() pdr.RunBackgroundOperationAsync(); - if (pdr.doWorkArgs.CancelRequested || pdr.doWorkArgs.ErrorMessage != "") + if (pdr.doWorkArgs.CancelRequested || !string.IsNullOrEmpty(pdr.doWorkArgs.ErrorMessage)) return 0; if (!MainV2.comPort.BaseStream.IsOpen) @@ -131,7 +132,11 @@ void pdr_DoWork(object sender, Controls.ProgressWorkerEventArgs e, object passda Utilities.Firmware fw = new Utilities.Firmware(); fw.Progress += fw_Progress; - List swlist = fw.getFWList(); + string firmwareurl = ""; + if (usebeta) + firmwareurl = "https://raw.github.com/diydrones/binary/master/dev/firmware2.xml"; + + List swlist = fw.getFWList(firmwareurl); if (swlist.Count == 0) { @@ -167,7 +172,8 @@ void pdr_DoWork(object sender, Controls.ProgressWorkerEventArgs e, object passda { try { - fwdone = fw.update(comport, sw); + //fwdone = fw.update(comport, sw); + fwdone = true; } catch { } if (fwdone == false) @@ -241,9 +247,21 @@ private void CMB_port_Click(object sender, EventArgs e) private void pictureBox1_Click(object sender, EventArgs e) { + if (MainV2.comPort.BaseStream.IsOpen) + MainV2.comPort.BaseStream.Close(); + + MainV2.comPort.BaseStream.PortName = CMB_port.Text; + MainV2.comPort.BaseStream.BaudRate = 115200; + if (!MainV2.comPort.BaseStream.IsOpen) MainV2.comPort.Open(true); Wizard.instance.GoNext(1); } + + private void label8_Click(object sender, EventArgs e) + { + usebeta = true; + CustomMessageBox.Show("Using beta FW"); + } } } diff --git a/Wizard/3ConnectAP.resx b/Wizard/3ConnectAP.resx index 5ea0895e32..29dcb1b3a3 100644 --- a/Wizard/3ConnectAP.resx +++ b/Wizard/3ConnectAP.resx @@ -112,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/Wizard/6CompassCalib.Designer.cs b/Wizard/6CompassCalib.Designer.cs index bcee3f748d..1d5b4809b0 100644 --- a/Wizard/6CompassCalib.Designer.cs +++ b/Wizard/6CompassCalib.Designer.cs @@ -32,21 +32,21 @@ private void InitializeComponent() this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(_6CompassCalib)); this.panel1 = new System.Windows.Forms.Panel(); - this.BUT_MagCalibrationLive = new Controls.MyButton(); + this.BUT_MagCalibrationLive = new MissionPlanner.Controls.MyButton(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.radialGradientBG1 = new Controls.GradientBG(); + this.radialGradientBG1 = new MissionPlanner.Controls.GradientBG(); this.panel2 = new System.Windows.Forms.Panel(); + this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); - this.BUT_compassorient = new Controls.MyButton(); - this.pictureBoxMouseOver3 = new Controls.PictureBoxMouseOver(); - this.pictureBoxMouseOver2 = new Controls.PictureBoxMouseOver(); - this.pictureBoxMouseOver1 = new Controls.PictureBoxMouseOver(); + this.BUT_compassorient = new MissionPlanner.Controls.MyButton(); + this.pictureBoxMouseOver3 = new MissionPlanner.Controls.PictureBoxMouseOver(); + this.pictureBoxMouseOver2 = new MissionPlanner.Controls.PictureBoxMouseOver(); + this.pictureBoxMouseOver1 = new MissionPlanner.Controls.PictureBoxMouseOver(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.label6 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.radialGradientBG1.Image)).BeginInit(); this.panel2.SuspendLayout(); @@ -70,16 +70,12 @@ private void InitializeComponent() // // BUT_MagCalibrationLive // - this.BUT_MagCalibrationLive.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_MagCalibrationLive.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_MagCalibrationLive.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.BUT_MagCalibrationLive.Location = new System.Drawing.Point(115, 106); this.BUT_MagCalibrationLive.Name = "BUT_MagCalibrationLive"; - this.BUT_MagCalibrationLive.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); this.BUT_MagCalibrationLive.Size = new System.Drawing.Size(66, 27); this.BUT_MagCalibrationLive.TabIndex = 86; this.BUT_MagCalibrationLive.Text = "Live Calibration"; - this.BUT_MagCalibrationLive.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_MagCalibrationLive.UseVisualStyleBackColor = true; this.BUT_MagCalibrationLive.Click += new System.EventHandler(this.BUT_MagCalibration_Click); // @@ -165,6 +161,16 @@ private void InitializeComponent() this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(740, 219); this.panel2.TabIndex = 5; + this.panel2.Visible = false; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(210, 170); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(10, 13); + this.label6.TabIndex = 9; + this.label6.Text = "."; // // label5 // @@ -177,15 +183,11 @@ private void InitializeComponent() // // BUT_compassorient // - this.BUT_compassorient.BGGradBot = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(226)))), ((int)(((byte)(150))))); - this.BUT_compassorient.BGGradTop = System.Drawing.Color.FromArgb(((int)(((byte)(148)))), ((int)(((byte)(193)))), ((int)(((byte)(31))))); this.BUT_compassorient.Location = new System.Drawing.Point(115, 138); this.BUT_compassorient.Name = "BUT_compassorient"; - this.BUT_compassorient.Outline = System.Drawing.Color.FromArgb(((int)(((byte)(121)))), ((int)(((byte)(148)))), ((int)(((byte)(41))))); this.BUT_compassorient.Size = new System.Drawing.Size(75, 23); this.BUT_compassorient.TabIndex = 7; this.BUT_compassorient.Text = "Start"; - this.BUT_compassorient.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(87)))), ((int)(((byte)(4))))); this.BUT_compassorient.UseVisualStyleBackColor = true; this.BUT_compassorient.Click += new System.EventHandler(this.BUT_compassorient_Click); // @@ -259,15 +261,6 @@ private void InitializeComponent() // this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(210, 170); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(10, 13); - this.label6.TabIndex = 9; - this.label6.Text = "."; - // // _6CompassCalib // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/Wizard/6CompassCalib.resx b/Wizard/6CompassCalib.resx index 9549e622a9..d2a09089f0 100644 --- a/Wizard/6CompassCalib.resx +++ b/Wizard/6CompassCalib.resx @@ -112,15 +112,15 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Compass calibration is important, so your autopilot knows which direction it is pointing. Point every axis north (left,right,front,back,top,bottom) and rotate a full 360 around the left-right axis, for all 6 axis's - + 17, 17 \ No newline at end of file diff --git a/georefimage.cs b/georefimage.cs index 0d772dea0d..db09d63abb 100644 --- a/georefimage.cs +++ b/georefimage.cs @@ -480,10 +480,6 @@ public void dowork(string logFile, string dirWithImages, float offsetseconds, bo if (dooffset) { - swlockml.Close(); - swloctel.Close(); - swloctxt.Close(); - swlogloccsv.Close(); return; } @@ -518,9 +514,9 @@ public void dowork(string logFile, string dirWithImages, float offsetseconds, bo matchs++; - // int fixme; - // if (matchs < 150 || matchs > 170) - // break; ; + // int fixme; + // if (matchs < 150 || matchs > 170) + // break; ; SharpKml.Dom.Timestamp tstamp = new SharpKml.Dom.Timestamp(); @@ -623,24 +619,17 @@ public void dowork(string logFile, string dirWithImages, float offsetseconds, bo //Console.WriteLine(crap); } } - - - } - - + } Serializer serializer = new Serializer(); serializer.Serialize(kml); swlockml.Write(serializer.Xml); - swlockml.Close(); Utilities.httpserver.georefkml = serializer.Xml; Utilities.httpserver.georefimagepath = dirWithImages + Path.DirectorySeparatorChar; writeGPX(dirWithImages + Path.DirectorySeparatorChar + "location.gpx"); - swlogloccsv.Close(); - // flightmission GenFlightMission(swloctrim); @@ -648,9 +637,6 @@ public void dowork(string logFile, string dirWithImages, float offsetseconds, bo swloctrim.WriteEndElement(); // job swloctrim.WriteEndDocument(); - swloctxt.Close(); - swloctel.Close(); - TXT_outputlog.AppendText("Done " + matchs + " matchs"); } @@ -921,7 +907,6 @@ private void writeGPX(string filename) xw.WriteEndElement(); xw.WriteEndElement(); - xw.Close(); } } @@ -1300,7 +1285,6 @@ private void BUT_browsedir_Click(object sender, EventArgs e) { TXT_offsetseconds.Text = match.Groups[1].Value; } - sr.Close(); } } catch { }