diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index 8ec9135bc3..8581ec4862 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -245,7 +245,19 @@ + + UserControl + + + MainSwitcher.cs + + + UserControl + + + ConfigAP_Limits.cs + UserControl @@ -641,6 +653,9 @@ HSI.cs + + MainSwitcher.cs + ProgressReporterDialogue.cs @@ -824,6 +839,9 @@ ConfigArdurover.cs + + ConfigAP_Limits.cs + Setup.cs diff --git a/Tools/ArdupilotMegaPlanner/Controls/AGauge.cs b/Tools/ArdupilotMegaPlanner/Controls/AGauge.cs index eca7341440..9221e63906 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/AGauge.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/AGauge.cs @@ -1486,6 +1486,7 @@ System.ComponentModel.Description("Enables or disables the range selected by Nee #region base member overrides protected override void OnPaintBackground(PaintEventArgs pevent) { + base.OnPaintBackground(pevent); } protected override void OnPaint(PaintEventArgs pe) @@ -1498,6 +1499,8 @@ System.ComponentModel.Description("Enables or disables the range selected by Nee if (!ThisReallyVisible()) return; + base.OnPaint(pe); + float scale = 1; // scale it diff --git a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.cs b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.cs index 0564ce64df..1ae5b2bc97 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageView.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Utilities; namespace ArdupilotMega.Controls.BackstageView { @@ -162,7 +163,7 @@ namespace ArdupilotMega.Controls.BackstageView _pages.Add(page); CreateLinkButton(page); - this.pnlPages.Controls.Add(page.Page); + //this.pnlPages.Controls.Add(page.Page); if (_activePage == null) { @@ -253,16 +254,23 @@ namespace ArdupilotMega.Controls.BackstageView { x.Page.Visible = false; }); + this.pnlPages.Controls.Remove(_activePage.Page); // deactivate button _activePage.Page.Visible = false; var oldButton = this.pnlMenu.Controls.OfType().Single(b => b.Tag == _activePage); oldButton.IsSelected = false; + + ThemeManager.ApplyThemeTo(associatedPage.Page); + // ensure fields have been init associatedPage.Page.DoLoad(new EventArgs()); // show it associatedPage.Page.Visible = true; + // add control + this.pnlPages.Controls.Add(associatedPage.Page); + var newButton = this.pnlMenu.Controls.OfType().Single(b => b.Tag == associatedPage); newButton.IsSelected = true; diff --git a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs index c0de4128d2..471c701595 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/BackstageView/BackstageViewButton.cs @@ -94,10 +94,10 @@ namespace ArdupilotMega.Controls.BackstageView g.DrawString(Text, new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold), new SolidBrush(SelectedTextColor), 10, 6); - g.FillPolygon(arrowBrush, arrowPoints); - var pencilBrush = new Pen(this.PencilBorderColor); + g.DrawLine(pencilBrush, Width - 1, 0, Width - 1, Height - 1); + g.FillPolygon(arrowBrush, arrowPoints); g.DrawPolygon(pencilBrush, arrowPoints); diff --git a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs index c792a4cf7a..e28715c258 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/HUD.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/HUD.cs @@ -252,7 +252,7 @@ namespace ArdupilotMega.Controls { //GL.Enable(EnableCap.AlphaTest) - + // Console.WriteLine("hud paint"); if (!started) return; diff --git a/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs b/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs index 2799df1b71..c5393c2c9c 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/MyLabel.cs @@ -74,12 +74,18 @@ namespace ArdupilotMega.Controls protected override void OnPaint(PaintEventArgs e) { + + TextRenderer.DrawText(e.Graphics, label, this.Font, new Point(0, 0), ForeColor); + /* + //return; + stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Center; s = new SolidBrush(ForeColor); e.Graphics.DrawString(label, this.Font, s, new PointF(0, this.Height / 2.0f), stringFormat); + */ } protected override void OnPaintBackground(PaintEventArgs pevent) diff --git a/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs b/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs index ff11f878de..58b2fdd223 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/ProgressReporterDialogue.cs @@ -185,8 +185,8 @@ namespace ArdupilotMega.Controls if (this.InvokeRequired) { - - this.Invoke((MethodInvoker) delegate + // invoke async + this.BeginInvoke((MethodInvoker) delegate { lblProgressMessage.Text = status; diff --git a/Tools/ArdupilotMegaPlanner/Controls/RangeControl.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/RangeControl.Designer.cs index 59307b12b4..790d83b71f 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/RangeControl.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/RangeControl.Designer.cs @@ -99,7 +99,7 @@ this.myLabel1.Location = new System.Drawing.Point(4, 4); this.myLabel1.Name = "myLabel1"; this.myLabel1.resize = false; - this.myLabel1.Size = new System.Drawing.Size(301, 23); + this.myLabel1.Size = new System.Drawing.Size(471, 23); this.myLabel1.TabIndex = 0; this.myLabel1.Text = "myLabel1"; // diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index ea47821c9b..4a43983cea 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -131,7 +131,7 @@ namespace ArdupilotMega public float nav_bearing { get; set; } public float target_bearing { get; set; } public float wp_dist { get { return (_wpdist * multiplierdist); } set { _wpdist = value; } } - public float alt_error { get { return _alt_error * multiplierdist; } set { _alt_error = value; } } + public float alt_error { get { return _alt_error * multiplierdist; } set { _alt_error = value; _targetalt = (float)Math.Round(alt + alt_error, 0); } } public float ber_error { get { return (target_bearing - yaw); } set { } } public float aspd_error { get { return _aspd_error * multiplierspeed; } set { _aspd_error = value; } } public float xtrack_error { get; set; } @@ -141,9 +141,10 @@ namespace ArdupilotMega float _wpdist; float _aspd_error; float _alt_error; + float _targetalt; - public float targetaltd100 { get { return ((alt + alt_error) / 100) % 10; } } - public float targetalt { get { return (float)Math.Round(alt + alt_error, 0); } } + public float targetaltd100 { get { return (_targetalt / 100) % 10; } } + public float targetalt { get { return _targetalt; } } //airspeed_error = (airspeed_error - airspeed); public float targetairspeed { get { return (float)Math.Round(airspeed + aspd_error / 100, 0); } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs index 106cef0171..9a5ed1adbc 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationPlane.cs @@ -66,8 +66,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView { try { -#if MAVLINK10 - int fixme; // needs to be accel only +#if MAVLINK10 MainV2.comPort.doCommand(MAVLink.MAV_CMD.PREFLIGHT_CALIBRATION,1,1,1,0,0,0,0); #else MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs index f853157048..050eebb298 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigFriendlyParams.cs @@ -198,7 +198,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView catch (Exception exp) { log.Error(exp); } // just to cleanup any errors } - _params.ForEach(x => + _params.OrderBy(x => x.Key).ForEach(x => { if(!String.IsNullOrEmpty(x.Key)) { diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs index 7879a3636b..602e7bce28 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/Setup.cs @@ -16,12 +16,17 @@ namespace ArdupilotMega.GCSViews.ConfigurationView public Setup() { InitializeComponent(); + } + + + private void Setup_Load(object sender, EventArgs e) + { if (MainV2.comPort.BaseStream.IsOpen) { AddPagesForConnectedState(); } - + // These pages work when not connected to an APM AddBackstageViewPage(new ArdupilotMega._3DRradio(), "3DR Radio"); AddBackstageViewPage(new ArdupilotMega.Antenna.Tracker(), "Antenna Tracker"); @@ -36,7 +41,6 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } - // Add the pages that can only be shown when we are connected to an APM private void AddPagesForConnectedState() { @@ -75,6 +79,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView AddBackstageViewPage(configpanel, "ArduCopter Pids"); AddBackstageViewPage(new ConfigArducopter(), "ArduCopter Config"); + AddBackstageViewPage(new ConfigAP_Limits(), "GeoFence"); } /****************************** ArduPlane **************************/ else if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) @@ -100,11 +105,6 @@ namespace ArdupilotMega.GCSViews.ConfigurationView } - private void Setup_Load(object sender, EventArgs e) - { - - } - private void Setup_FormClosing(object sender, FormClosingEventArgs e) { backstageView.Close(); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index 180d40729b..c13a03fdc6 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -298,6 +298,7 @@ namespace ArdupilotMega.GCSViews lbl_status.Text = "Detecting APM Version"; this.Refresh(); + Application.DoEvents(); board = ArduinoDetect.DetectBoard(MainV2.comPortName); @@ -373,6 +374,7 @@ namespace ArdupilotMega.GCSViews lbl_status.Text = "Downloading from Internet"; this.Refresh(); + Application.DoEvents(); dataStream.ReadTimeout = 30000; @@ -397,6 +399,7 @@ namespace ArdupilotMega.GCSViews progress.Value = 100; this.Refresh(); + Application.DoEvents(); log.Info("Downloaded"); } catch (Exception ex) { lbl_status.Text = "Failed download"; CustomMessageBox.Show("Failed to download new firmware : " + ex.ToString()); return; } @@ -412,6 +415,7 @@ namespace ArdupilotMega.GCSViews { lbl_status.Text = "Reading Hex File"; this.Refresh(); + Application.DoEvents(); sr = new StreamReader(filename); FLASH = readIntelHEXv2(sr); sr.Close(); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs index b1f5756470..0e3be7e4ae 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs @@ -1271,11 +1271,6 @@ namespace ArdupilotMega.GCSViews private void BUT_log2kml_Click(object sender, EventArgs e) { - if (DialogResult.Cancel == Common.MessageShowAgain("Tlog to KML Firmware Version", "When converting logs, ensure your Firmware version is set correctly.\n(Near your com port selection.)")) - { - return; - } - Form frm = new MavlinkLog(); ThemeManager.ApplyThemeTo(frm); frm.ShowDialog(); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx index b8ab7b9ecc..245f70bf34 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.resx @@ -226,7 +226,7 @@ hud1 - ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null SubMainLeft.Panel1 @@ -265,7 +265,7 @@ BUT_script - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -298,7 +298,7 @@ BUT_joystick - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -328,7 +328,7 @@ BUT_quickmanual - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -358,7 +358,7 @@ BUT_quickrtl - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -388,7 +388,7 @@ BUT_quickauto - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -442,7 +442,7 @@ BUT_setwp - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -493,7 +493,7 @@ BUT_setmode - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -523,7 +523,7 @@ BUT_clear_track - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -574,7 +574,7 @@ BUT_Homealt - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -604,7 +604,7 @@ BUT_RAWSensor - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -634,7 +634,7 @@ BUTrestartmission - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -664,7 +664,7 @@ BUTactiondo - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabActions @@ -718,7 +718,7 @@ Gvspeed - AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabGauges @@ -748,7 +748,7 @@ Gheading - ArdupilotMega.Controls.HSI, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.HSI, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabGauges @@ -778,7 +778,7 @@ Galt - AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabGauges @@ -811,7 +811,7 @@ Gspeed - AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabGauges @@ -895,7 +895,7 @@ lbl_playbackspeed - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabTLogs @@ -922,7 +922,7 @@ lbl_logpercent - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabTLogs @@ -949,7 +949,7 @@ NUM_playbackspeed - ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabTLogs @@ -976,7 +976,7 @@ BUT_log2kml - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabTLogs @@ -1030,7 +1030,7 @@ BUT_playlog - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabTLogs @@ -1057,7 +1057,7 @@ BUT_loadtelem - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null tabTLogs @@ -1246,7 +1246,7 @@ lbl_hdop - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null splitContainer1.Panel2 @@ -1279,7 +1279,7 @@ lbl_sats - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null splitContainer1.Panel2 @@ -1309,7 +1309,7 @@ lbl_winddir - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null splitContainer1.Panel2 @@ -1339,7 +1339,7 @@ lbl_windvel - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null splitContainer1.Panel2 @@ -1511,7 +1511,7 @@ gMapControl1 - ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null splitContainer1.Panel2 @@ -1574,7 +1574,7 @@ TXT_lat - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null panel1 @@ -1631,7 +1631,7 @@ label1 - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null panel1 @@ -1661,7 +1661,7 @@ TXT_long - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null panel1 @@ -1691,7 +1691,7 @@ TXT_alt - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null panel1 @@ -1892,7 +1892,7 @@ label6 - ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null $this @@ -1988,6 +1988,6 @@ FlightData - System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4576.33626, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs index 524e96127b..6cfcf061af 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs @@ -119,16 +119,18 @@ this.clearPolygonToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.clearMissionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.geoFenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.GeoFenceuploadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.GeoFencedownloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setReturnLocationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadFromFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.trackBar1 = new ArdupilotMega.Controls.MyTrackBar(); this.label11 = new System.Windows.Forms.Label(); 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.saveToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.Commands)).BeginInit(); this.panel5.SuspendLayout(); this.panel1.SuspendLayout(); @@ -827,6 +829,8 @@ // geoFenceToolStripMenuItem // this.geoFenceToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItem1, + this.toolStripSeparator4, this.GeoFenceuploadToolStripMenuItem, this.GeoFencedownloadToolStripMenuItem, this.setReturnLocationToolStripMenuItem, @@ -835,6 +839,16 @@ this.geoFenceToolStripMenuItem.Name = "geoFenceToolStripMenuItem"; resources.ApplyResources(this.geoFenceToolStripMenuItem, "geoFenceToolStripMenuItem"); // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + resources.ApplyResources(this.toolStripMenuItem1, "toolStripMenuItem1"); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + resources.ApplyResources(this.toolStripSeparator4, "toolStripSeparator4"); + // // GeoFenceuploadToolStripMenuItem // this.GeoFenceuploadToolStripMenuItem.Name = "GeoFenceuploadToolStripMenuItem"; @@ -859,6 +873,12 @@ resources.ApplyResources(this.loadFromFileToolStripMenuItem, "loadFromFileToolStripMenuItem"); this.loadFromFileToolStripMenuItem.Click += new System.EventHandler(this.loadFromFileToolStripMenuItem_Click); // + // saveToFileToolStripMenuItem + // + this.saveToFileToolStripMenuItem.Name = "saveToFileToolStripMenuItem"; + resources.ApplyResources(this.saveToFileToolStripMenuItem, "saveToFileToolStripMenuItem"); + this.saveToFileToolStripMenuItem.Click += new System.EventHandler(this.saveToFileToolStripMenuItem_Click); + // // trackBar1 // resources.ApplyResources(this.trackBar1, "trackBar1"); @@ -895,12 +915,6 @@ this.timer1.Interval = 1000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // saveToFileToolStripMenuItem - // - this.saveToFileToolStripMenuItem.Name = "saveToFileToolStripMenuItem"; - resources.ApplyResources(this.saveToFileToolStripMenuItem, "saveToFileToolStripMenuItem"); - this.saveToFileToolStripMenuItem.Click += new System.EventHandler(this.saveToFileToolStripMenuItem_Click); - // // FlightPlanner // resources.ApplyResources(this, "$this"); @@ -1016,10 +1030,12 @@ private ArdupilotMega.Controls.MyButton BUT_loadkml; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ToolStripMenuItem geoFenceToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem GeoFenceuploadToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem GeoFencedownloadToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem setReturnLocationToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem loadFromFileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveToFileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem GeoFenceuploadToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx index f70e995ead..779b17c456 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx @@ -556,7 +556,7 @@ BUT_write - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panel5 @@ -583,7 +583,7 @@ BUT_read - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panel5 @@ -610,7 +610,7 @@ SaveFile - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panel5 @@ -637,7 +637,7 @@ BUT_loadwpfile - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panel5 @@ -1261,7 +1261,7 @@ BUT_loadkml - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelWaypoints @@ -1291,7 +1291,7 @@ BUT_zoomto - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelWaypoints @@ -1321,7 +1321,7 @@ BUT_Camera - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelWaypoints @@ -1351,7 +1351,7 @@ BUT_grid - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelWaypoints @@ -1381,7 +1381,7 @@ BUT_Prefetch - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelWaypoints @@ -1411,7 +1411,7 @@ button1 - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelWaypoints @@ -1441,7 +1441,7 @@ BUT_Add - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelWaypoints @@ -1686,6 +1686,15 @@ Clear Mission + + 177, 22 + + + Complex + + + 174, 6 + 177, 22 @@ -1889,7 +1898,7 @@ MainMap - GMap.NET.WindowsForms.GMapControl, GMap.NET.WindowsForms, Version=1.5.5.5, Culture=neutral, PublicKeyToken=b85b9027b614afef + ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelMap @@ -1919,7 +1928,7 @@ trackBar1 - ArdupilotMega.MyTrackBar, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null panelMap @@ -2200,6 +2209,18 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + toolStripMenuItem1 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + toolStripSeparator4 + + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + GeoFenceuploadToolStripMenuItem @@ -2224,6 +2245,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + saveToFileToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + toolTip1 @@ -2236,16 +2263,10 @@ System.Windows.Forms.Timer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - saveToFileToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - FlightPlanner - System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs index b15b86e722..670b290262 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs @@ -572,6 +572,9 @@ namespace ArdupilotMega.GCSViews DateTime lastdata = DateTime.MinValue; + // set enable hil status flag - sends base_mode = 0 + MainV2.comPort.setMode(new MAVLink.mavlink_set_mode_t() { target_system = MainV2.comPort.sysid }, MAVLink.MAV_MODE_FLAG.HIL_ENABLED); + while (threadrun == 1) { if (comPort.BaseStream.IsOpen == false) { break; } @@ -580,6 +583,7 @@ namespace ArdupilotMega.GCSViews { try { + if (CHK_quad.Checked && !RAD_aerosimrc.Checked)// || chkSensor.Checked && RAD_JSBSim.Checked) { comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER, 0); // request servoout diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs index eacae4685d..78d16a6ff0 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.Designer.cs @@ -93,6 +93,7 @@ this.Controls.Add(this.BUTsetupshow); this.Controls.Add(this.TXT_terminal); this.Name = "Terminal"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Terminal_FormClosing); this.Load += new System.EventHandler(this.Terminal_Load); this.ResumeLayout(false); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs index 9a868cf2de..a17f360d49 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.cs @@ -26,8 +26,7 @@ namespace ArdupilotMega.GCSViews public Terminal() { - while (threadrun == true) - threadrun = false; + threadrun = false; InitializeComponent(); } @@ -153,6 +152,8 @@ namespace ArdupilotMega.GCSViews comPort.Close(); } System.Threading.Thread.Sleep(400); + + MainV2.giveComport = false; } private void TXT_terminal_KeyPress(object sender, KeyPressEventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx index af41b2749b..bd885a8bf8 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Terminal.resx @@ -166,7 +166,7 @@ BUTsetupshow - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.17884, Culture=neutral, PublicKeyToken=null $this @@ -190,7 +190,7 @@ BUTradiosetup - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.17884, Culture=neutral, PublicKeyToken=null $this @@ -214,7 +214,7 @@ BUTtests - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.17884, Culture=neutral, PublicKeyToken=null $this @@ -238,7 +238,7 @@ Logs - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.17884, Culture=neutral, PublicKeyToken=null $this @@ -262,7 +262,7 @@ BUT_logbrowse - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.17884, Culture=neutral, PublicKeyToken=null $this @@ -283,6 +283,6 @@ Terminal - System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4579.17884, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/MainV2.Designer.cs b/Tools/ArdupilotMegaPlanner/MainV2.Designer.cs index 8464250b7e..ed83ecc2cd 100644 --- a/Tools/ArdupilotMegaPlanner/MainV2.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/MainV2.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainV2)); - this.MyView = new System.Windows.Forms.Panel(); + this.MyView = new ArdupilotMega.Controls.MainSwitcher(); this.MainMenu = new System.Windows.Forms.MenuStrip(); this.MenuFlightData = new System.Windows.Forms.ToolStripButton(); this.MenuFlightPlanner = new System.Windows.Forms.ToolStripButton(); @@ -227,7 +227,7 @@ #endregion - private System.Windows.Forms.Panel MyView; + private ArdupilotMega.Controls.MainSwitcher MyView; private System.Windows.Forms.MenuStrip MainMenu; private System.Windows.Forms.ToolStripButton MenuFlightData; private System.Windows.Forms.ToolStripButton MenuFlightPlanner; diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs index e26e68ba60..a4a9da14b4 100644 --- a/Tools/ArdupilotMegaPlanner/MainV2.cs +++ b/Tools/ArdupilotMegaPlanner/MainV2.cs @@ -132,11 +132,10 @@ namespace ArdupilotMega /// GCSViews.FlightData FlightData; GCSViews.FlightPlanner FlightPlanner; - //GCSViews.Configuration Configuration; - GCSViews.ConfigurationView.Setup Configuration; + //GCSViews.ConfigurationView.Setup Configuration; GCSViews.Simulation Simulation; - GCSViews.Firmware Firmware; - GCSViews.Terminal Terminal; + //GCSViews.Firmware Firmware; + //GCSViews.Terminal Terminal; private Form connectionStatsForm; private ConnectionStats _connectionStats; @@ -157,7 +156,7 @@ namespace ArdupilotMega strVersion = "mav " + MAVLink.MAVLINK_WIRE_PROTOCOL_VERSION; - splash.Text = "APM Planner " + Application.ProductVersion + " " + strVersion + " By Michael Oborne"; + splash.Text = "Mission Planner " + Application.ProductVersion + " " + strVersion; splash.Refresh(); @@ -246,9 +245,9 @@ namespace ArdupilotMega { FlightData = new GCSViews.FlightData(); FlightPlanner = new GCSViews.FlightPlanner(); - //Configuration = new GCSViews.Configuration(); + //Configuration = new GCSViews.ConfigurationView.Setup(); Simulation = new GCSViews.Simulation(); - Firmware = new GCSViews.Firmware(); + //Firmware = new GCSViews.Firmware(); //Terminal = new GCSViews.Terminal(); // preload @@ -426,114 +425,36 @@ namespace ArdupilotMega private void MenuFlightData_Click(object sender, EventArgs e) { - MyView.Controls.Clear(); - - GCSViews.Terminal.threadrun = false; - - UserControl temp = FlightData; - - ThemeManager.ApplyThemeTo(temp); - - temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - - temp.Location = new Point(0, MainMenu.Height); - - temp.Dock = DockStyle.Fill; - - MyView.Controls.Add(temp); + MyView.ShowScreen("FlightData"); if (MainV2.config["FlightSplitter"] != null) - ((GCSViews.FlightData)temp).MainHcopy.SplitterDistance = int.Parse(MainV2.config["FlightSplitter"].ToString()); + { + FlightData.MainHcopy.SplitterDistance = int.Parse(MainV2.config["FlightSplitter"].ToString()) - 1; + FlightData.MainHcopy.SplitterDistance = int.Parse(MainV2.config["FlightSplitter"].ToString()); + } } private void MenuFlightPlanner_Click(object sender, EventArgs e) { - MyView.Controls.Clear(); - - GCSViews.Terminal.threadrun = false; - - UserControl temp = FlightPlanner; - - ThemeManager.ApplyThemeTo(temp); - - temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - - temp.Location = new Point(0, MainMenu.Height); - - temp.Dock = DockStyle.Fill; - // refresh ap/ac specific items FlightPlanner.updateCMDParams(); - MyView.Controls.Add(temp); + MyView.ShowScreen("FlightPlanner"); } private void MenuConfiguration_Click(object sender, EventArgs e) { - MyView.Controls.Clear(); - - GCSViews.Terminal.threadrun = false; - - // dispose of old else memory leak - if (Configuration != null) - { - try - { - Configuration.Dispose(); - } - catch { } - } - - //Configuration = new GCSViews.Configuration(); - Configuration = new GCSViews.ConfigurationView.Setup(); - - UserControl temp = Configuration; - - ThemeManager.ApplyThemeTo(temp); - - temp.Location = new Point(0, 0); - - temp.Dock = DockStyle.Fill; - - temp.Size = MyView.Size; - - MyView.Controls.Add(temp); + MyView.ShowScreen("Config"); } private void MenuSimulation_Click(object sender, EventArgs e) { - MyView.Controls.Clear(); - - GCSViews.Terminal.threadrun = false; - - UserControl temp = Simulation; - - ThemeManager.ApplyThemeTo(temp); - - temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - - temp.Location = new Point(0, MainMenu.Height); - - temp.Dock = DockStyle.Fill; - - MyView.Controls.Add(temp); + MyView.ShowScreen("Simulation"); } private void MenuFirmware_Click(object sender, EventArgs e) { - MyView.Controls.Clear(); - - GCSViews.Terminal.threadrun = false; - - UserControl temp = Firmware; - - ThemeManager.ApplyThemeTo(temp); - - temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - - temp.Dock = DockStyle.Fill; - - MyView.Controls.Add(temp); + MyView.ShowScreen("Firmware"); } private void MenuTerminal_Click(object sender, EventArgs e) @@ -543,34 +464,7 @@ namespace ArdupilotMega MenuConnect_Click(sender, e); } - giveComport = true; - - MyView.Controls.Clear(); - - this.MenuConnect.BackgroundImage = global::ArdupilotMega.Properties.Resources.disconnect; - - // dispose of old else memory leak - if (Terminal != null) - { - try - { - Terminal.Dispose(); - } - catch { } - } - - Terminal = new GCSViews.Terminal(); - - UserControl temp = Terminal; - - ThemeManager.ApplyThemeTo(temp); - - temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - - temp.Dock = DockStyle.Fill; - - MyView.Controls.Add(temp); - + MyView.ShowScreen("Terminal"); } private void MenuConnect_Click(object sender, EventArgs e) @@ -1066,7 +960,7 @@ namespace ArdupilotMega { if ((string)this.MenuConnect.BackgroundImage.Tag != "Disconnect") { - this.Invoke((MethodInvoker)delegate + this.BeginInvoke((MethodInvoker)delegate { this.MenuConnect.BackgroundImage = global::ArdupilotMega.Properties.Resources.disconnect; this.MenuConnect.BackgroundImage.Tag = "Disconnect"; @@ -1078,15 +972,25 @@ namespace ArdupilotMega { if ((string)this.MenuConnect.BackgroundImage.Tag != "Connect") { - this.Invoke((MethodInvoker)delegate + this.BeginInvoke((MethodInvoker)delegate { this.MenuConnect.BackgroundImage = global::ArdupilotMega.Properties.Resources.connect; this.MenuConnect.BackgroundImage.Tag = "Connect"; _connectionControl.IsConnected(false); - if (_connectionStats != null) + if (_connectionStats != null) + { _connectionStats.StopUpdates(); + } }); } + + if (comPort.logreadmode) + { + this.BeginInvoke((MethodInvoker)delegate + { + _connectionControl.IsConnected(true); + }); + } } connectButtonUpdate = DateTime.Now; } @@ -1144,22 +1048,6 @@ namespace ArdupilotMega speechcustomtime = DateTime.Now; } - if ((DateTime.Now - comPort.lastvalidpacket).TotalSeconds > 10) - { - MainV2.cs.linkqualitygcs = 0; - } - - if ((DateTime.Now - comPort.lastvalidpacket).TotalSeconds >= 1) - { - if (linkqualitytime.Second != DateTime.Now.Second) - { - MainV2.cs.linkqualitygcs = (ushort)(MainV2.cs.linkqualitygcs * 0.8f); - linkqualitytime = DateTime.Now; - - GCSViews.FlightData.myhud.Invalidate(); - } - } - if (speechEnable && speechEngine != null && (MainV2.comPort.logreadmode || comPort.BaseStream.IsOpen)) { float warnalt = float.MaxValue; @@ -1181,6 +1069,23 @@ namespace ArdupilotMega continue; } + if ((DateTime.Now - comPort.lastvalidpacket).TotalSeconds > 10) + { + MainV2.cs.linkqualitygcs = 0; + } + + if ((DateTime.Now - comPort.lastvalidpacket).TotalSeconds >= 1) + { + if (linkqualitytime.Second != DateTime.Now.Second) + { + MainV2.cs.linkqualitygcs = (ushort)(MainV2.cs.linkqualitygcs * 0.8f); + linkqualitytime = DateTime.Now; + + int fixme; + //GCSViews.FlightData.myhud.Invalidate(); + } + } + if (heatbeatSend.Second != DateTime.Now.Second) { // Console.WriteLine("remote lost {0}", cs.packetdropremote); @@ -1281,7 +1186,15 @@ namespace ArdupilotMega private void MainV2_Load(object sender, EventArgs e) { - // init button depressed + MyView.AddScreen(new MainSwitcher.Screen("FlightData",FlightData,true)); + MyView.AddScreen(new MainSwitcher.Screen("FlightPlanner", FlightPlanner, true)); + MyView.AddScreen(new MainSwitcher.Screen("Config", new GCSViews.ConfigurationView.Setup(), false)); + MyView.AddScreen(new MainSwitcher.Screen("Simulation", Simulation, true)); + MyView.AddScreen(new MainSwitcher.Screen("Firmware", new GCSViews.Firmware(), false)); + MyView.AddScreen(new MainSwitcher.Screen("Terminal", new GCSViews.Terminal(), false)); + MyView.AddScreen(new MainSwitcher.Screen("Help", new GCSViews.Help(), false)); + + // init button depressed - ensures correct action MenuFlightData_Click(sender, e); // for long running tasks using own threads. @@ -1671,21 +1584,7 @@ namespace ArdupilotMega private void MenuHelp_Click(object sender, EventArgs e) { - MyView.Controls.Clear(); - - UserControl temp = new GCSViews.Help(); - - ThemeManager.ApplyThemeTo(temp); - - temp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; - - temp.Dock = DockStyle.Fill; - - MyView.Controls.Add(temp); - - temp.ForeColor = Color.White; - - temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28); + MyView.ShowScreen("Help"); } @@ -2230,7 +2129,7 @@ namespace ArdupilotMega config["language"] = ci.Name; //System.Threading.Thread.CurrentThread.CurrentCulture = ci; - HashSet views = new HashSet { FlightData, FlightPlanner, Simulation, Firmware }; + HashSet views = new HashSet { FlightData, FlightPlanner, Simulation }; foreach (Control view in MyView.Controls) views.Add(view); diff --git a/Tools/ArdupilotMegaPlanner/Mavlink/IMAVLink.cs b/Tools/ArdupilotMegaPlanner/Mavlink/IMAVLink.cs index 5f0d79aba2..b074f5e0ce 100644 --- a/Tools/ArdupilotMegaPlanner/Mavlink/IMAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/Mavlink/IMAVLink.cs @@ -100,6 +100,7 @@ namespace ArdupilotMega void sendPacket(object indata); bool setFencePoint(byte index, PointLatLngAlt plla, byte fencepointcount); void setMode(string modein); + void setMode(ArdupilotMega.MAVLink.mavlink_set_mode_t mode, ArdupilotMega.MAVLink.MAV_MODE_FLAG base_mode = 0); void setMountConfigure(ArdupilotMega.MAVLink.MAV_MOUNT_MODE mountmode, bool stabroll, bool stabpitch, bool stabyaw); void setMountControl(double pa, double pb, double pc, bool islatlng); bool setParam(string paramname, float value); diff --git a/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs b/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs index 630bdd72f0..c8022f437f 100644 --- a/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs @@ -2002,9 +2002,7 @@ namespace ArdupilotMega if (translateMode(modein, ref mode)) { - generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); - System.Threading.Thread.Sleep(10); - generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); + setMode(mode); } } catch { System.Windows.Forms.MessageBox.Show("Failed to change Modes"); } @@ -2031,6 +2029,15 @@ namespace ArdupilotMega #endif } + public void setMode(mavlink_set_mode_t mode, MAV_MODE_FLAG base_mode = 0) + { + mode.base_mode |= (byte)base_mode; + + generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); + System.Threading.Thread.Sleep(10); + generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); + } + /// /// used for last bad serial characters /// @@ -2605,6 +2612,7 @@ namespace ArdupilotMega mavlinkversion = hb.mavlink_version; aptype = (MAV_TYPE)hb.type; + setAPType(); } return temp; diff --git a/Tools/ArdupilotMegaPlanner/MavlinkLog.cs b/Tools/ArdupilotMegaPlanner/MavlinkLog.cs index 603b09f25f..4cb741ee82 100644 --- a/Tools/ArdupilotMegaPlanner/MavlinkLog.cs +++ b/Tools/ArdupilotMegaPlanner/MavlinkLog.cs @@ -835,10 +835,10 @@ namespace ArdupilotMega string code = @" public double stage(object inp) { - return getAltAboveHome((MAVLink09.mavlink_gps_raw_t) inp); + return getAltAboveHome((MAVLink.mavlink_gps_raw_int_t) inp); } - public double getAltAboveHome(MAVLink09.mavlink_gps_raw_t gps) + public double getAltAboveHome(MAVLink.mavlink_gps_raw_int_t gps) { if (customforusenumber == -1 && gps.fix_type != 2) customforusenumber = gps.alt; @@ -870,12 +870,17 @@ namespace ArdupilotMega // from here PointPairList result = (PointPairList)this.datappl[field]; - object assemblyInstance = results.CompiledAssembly.CreateInstance("ExpressionEvaluator.Calculator"); - - foreach (double time in temp.Keys) + try { - result.Add(time, (double)mi.Invoke(assemblyInstance, new object[] { temp[time] })); + + object assemblyInstance = results.CompiledAssembly.CreateInstance("ExpressionEvaluator.Calculator"); + + foreach (double time in temp.Keys) + { + result.Add(time, (double)mi.Invoke(assemblyInstance, new object[] { temp[time] })); + } } + catch { } } else { @@ -976,16 +981,16 @@ namespace ArdupilotMega PointPairList list = ((PointPairList)this.datappl[field]); - PointPairList listfix = ((PointPairList)this.datappl["fix_type mavlink_gps_raw_t"]); - PointPairList listx = ((PointPairList)this.datappl["lat mavlink_gps_raw_t"]); - PointPairList listy = ((PointPairList)this.datappl["lon mavlink_gps_raw_t"]); - PointPairList listz = ((PointPairList)this.datappl["alt mavlink_gps_raw_t"]); + PointPairList listfix = ((PointPairList)this.datappl["fix_type mavlink_gps_raw_int_t"]); + PointPairList listx = ((PointPairList)this.datappl["lat mavlink_gps_raw_int_t"]); + PointPairList listy = ((PointPairList)this.datappl["lon mavlink_gps_raw_int_t"]); + PointPairList listz = ((PointPairList)this.datappl["alt mavlink_gps_raw_int_t"]); for (int a = 0; a < listfix.Count; a++) { - if (listfix[a].Y == 2) + if (listfix[a].Y == 3) { - home = new PointLatLngAlt(listx[a].Y, listy[a].Y, listz[a].Y,"Home"); + home = new PointLatLngAlt(listx[a].Y / 10000000.0, listy[a].Y / 10000000.0, listz[a].Y / 1000.0, "Home"); break; } } @@ -995,7 +1000,7 @@ namespace ArdupilotMega for (int a = 0; a < listx.Count; a++) { - double ans = home.GetDistance(new PointLatLngAlt(listx[a].Y, listy[a].Y, listz[a].Y, "Point")); + double ans = home.GetDistance(new PointLatLngAlt(listx[a].Y / 10000000.0, listy[a].Y / 10000000.0, listz[a].Y / 1000.0, "Point")); //Console.WriteLine("{0} {1} {2} {3}", ans, listx[a].Y, listy[a].Y, listz[a].Y); diff --git a/Tools/ArdupilotMegaPlanner/Msi/installer.wxs b/Tools/ArdupilotMegaPlanner/Msi/installer.wxs index 74fa01726a..9d98bce9f7 100644 --- a/Tools/ArdupilotMegaPlanner/Msi/installer.wxs +++ b/Tools/ArdupilotMegaPlanner/Msi/installer.wxs @@ -2,14 +2,14 @@ - + - - + + @@ -31,7 +31,7 @@ - + @@ -90,162 +90,163 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - + + + + - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + @@ -289,26 +290,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/Tools/ArdupilotMegaPlanner/Program.cs b/Tools/ArdupilotMegaPlanner/Program.cs index 34864ba0dd..27cb31cf7b 100644 --- a/Tools/ArdupilotMegaPlanner/Program.cs +++ b/Tools/ArdupilotMegaPlanner/Program.cs @@ -29,7 +29,7 @@ namespace ArdupilotMega Application.ThreadException += Application_ThreadException; - // Application.Idle += Application_Idle; + Application.Idle += Application_Idle; int wt = 0, ct = 0; ThreadPool.GetMaxThreads(out wt, out ct); @@ -96,8 +96,11 @@ namespace ArdupilotMega static void Application_Idle(object sender, EventArgs e) { - System.Threading.Thread.Sleep(10); - Console.Write("Idle\r"); + //System.Threading.Thread.Sleep(10); + //Console.Write("Idle\n"); + + System.Threading.Thread.Sleep(20); + Application.DoEvents(); } static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index ce4fd18665..7d56cdc5df 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs +++ b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ using System.Resources; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.*")] -[assembly: AssemblyFileVersion("1.1.97")] +[assembly: AssemblyFileVersion("1.1.98")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Resources/Welcome_to_Michael_Oborne.rtf b/Tools/ArdupilotMegaPlanner/Resources/Welcome_to_Michael_Oborne.rtf index e465a9a5f9..c05fd36201 100644 Binary files a/Tools/ArdupilotMegaPlanner/Resources/Welcome_to_Michael_Oborne.rtf and b/Tools/ArdupilotMegaPlanner/Resources/Welcome_to_Michael_Oborne.rtf differ diff --git a/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs b/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs index adce15298b..79ff1d4c3d 100644 --- a/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs +++ b/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataParser.cs @@ -238,7 +238,13 @@ namespace ArdupilotMega.Utilities } } if (!returnDict.ContainsKey(key)) + { returnDict.Add(key, metaDict); + } + else + { + log.Error("Duplicate Key " + key); + } } } }