APM Planner 1.1.99

Convert to IActivate, IDeactivate scheme, thanks andrew
add support for rfcomm* interfaces on linux
fix guage off screen draw mono issue.
remove use of BackStageViewContentPanel
andrews spacer changes - not using dues to screen space issue
change configpanel constructor to load xml directly
remove IMavlink Interface
fix hsi off screen draw issue on mono
modify hud to use sprite fonts, instead of drawing via GDI+
modify progress reporter to use a 10hz timer to update screen, using invoke/begininvoke fails on mono at 50hz (over 100ms per call).
fix targetalt and target airspeed jumping issue.
lots of cleanup on tab switching, ie stoping timers/other
3dr radio status led update
update ardurover car icon
speedup georef image screen. tested on over 1000 images.
This commit is contained in:
Michael Oborne 2012-07-22 15:51:05 +08:00
parent 80cf794c86
commit 8bebf0c394
86 changed files with 1779 additions and 1137 deletions

View File

@ -253,7 +253,6 @@
this.Controls.Add(this.label1);
this.Controls.Add(this.CMB_interface);
this.Name = "Tracker";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Tracker_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.TRK_pantrim)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.TRK_tilttrim)).EndInit();
this.ResumeLayout(false);

View File

@ -12,7 +12,7 @@ using ArdupilotMega.Utilities;
namespace ArdupilotMega.Antenna
{
public partial class Tracker : BackStageViewContentPanel
public partial class Tracker : UserControl, IDeactivate
{
System.Threading.Thread t12;
static bool threadrun = false;
@ -217,7 +217,7 @@ namespace ArdupilotMega.Antenna
}
private void Tracker_FormClosing(object sender, FormClosingEventArgs e)
public void Deactivate()
{
saveconfig();
}

View File

@ -308,7 +308,6 @@
<DependentUpon>ConfigArdurover.cs</DependentUpon>
</Compile>
<Compile Include="Presenter\ICommand.cs" />
<Compile Include="Mavlink\IMAVLink.cs" />
<Compile Include="Utilities\CaptureMJPEG.cs" />
<Compile Include="Utilities\CollectionExtensions.cs" />
<Compile Include="Utilities\ParameterMetaDataConstants.cs" />
@ -1208,6 +1207,8 @@
<None Include="Resources\iconWarning48.png" />
<None Include="Resources\cameraGimalPitch1.png" />
<None Include="Resources\cameraGimalRoll1.png" />
<None Include="Resources\frames_plus.png" />
<None Include="Resources\frames_x.png" />
<Content Include="Resources\MAVCmd.zh-Hans.txt" />
<None Include="Resources\MAVParam.txt" />
<Content Include="Resources\MAVParam.zh-Hans.txt" />

View File

@ -48,6 +48,7 @@ namespace ArdupilotMega.Comms
allPorts.AddRange(Directory.GetFiles("/dev/serial/by-id/", "*"));
allPorts.AddRange(Directory.GetFiles("/dev/", "ttyACM*"));
allPorts.AddRange(Directory.GetFiles("/dev/", "ttyUSB*"));
allPorts.AddRange(Directory.GetFiles("/dev/", "rfcomm*"));
}
string[] ports = System.IO.Ports.SerialPort.GetPortNames()

View File

@ -1410,6 +1410,8 @@ System.ComponentModel.Description("Enables or disables the range selected by Nee
}
}
#endregion
#region helper
@ -1471,22 +1473,37 @@ System.ComponentModel.Description("Enables or disables the range selected by Nee
}
#endregion
/// <summary>
/// Override to prevent offscreen drawing the control - mono mac
/// </summary>
public new void Invalidate()
{
if (!ThisReallyVisible())
{
return;
}
base.Invalidate();
}
public override void Refresh()
{
base.Refresh();
}
/// <summary>
/// this is to fix a mono off screen drawing issue
/// </summary>
/// <returns></returns>
public bool ThisReallyVisible()
{
if (Parent != null)
return this.Bounds.IntersectsWith(Parent.ClientRectangle);
return true;
Control ctl = Control.FromHandle(this.Handle);
return ctl.Visible;
}
#region base member overrides
protected override void OnPaintBackground(PaintEventArgs pevent)
{
base.OnPaintBackground(pevent);
}
protected override void OnPaint(PaintEventArgs pe)
@ -1497,9 +1514,11 @@ System.ComponentModel.Description("Enables or disables the range selected by Nee
}
if (!ThisReallyVisible())
return;
{
Console.WriteLine(this.Visible);
base.OnPaint(pe);
return;
}
float scale = 1;

View File

@ -5,7 +5,31 @@ using System.Windows.Forms;
namespace ArdupilotMega.Controls.BackstageView
{
public class BackStageViewContentPanel : UserControl
/// <summary>
/// The implementor executes some logic on activation, for e.g when moving
/// from not selected to selected in a tab control
/// </summary>
public interface IActivate
{
// Should be idempotent
void Activate();
}
/// <summary>
/// The implementor executes some logic on deactivation, for e.g when moving
/// from selected to not selected in a tab control
/// </summary>
public interface IDeactivate
{
// Should be idempotent
void Deactivate();
}
/// <summary>
/// Base class for user controls that wish to participate as a backstage view
/// </summary>
[Obsolete("This doesn't do much any more, and should be replaced by indicating lifecycle features with IActivate etc")]
public class BackStageViewContentPanel : UserControl, IActivate, IDeactivate
{
public event FormClosingEventHandler FormClosing;
@ -25,5 +49,15 @@ namespace ArdupilotMega.Controls.BackstageView
// this is now done on page load via parent control
// base.OnLoad(e);
}
public void Activate()
{
DoLoad(EventArgs.Empty);
}
public void Deactivate()
{
Close();
}
}
}

View File

@ -37,10 +37,10 @@
this.pnlPages.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlPages.Location = new System.Drawing.Point(150, 0);
this.pnlPages.Location = new System.Drawing.Point(152, 0);
this.pnlPages.MinimumSize = new System.Drawing.Size(100, 0);
this.pnlPages.Name = "pnlPages";
this.pnlPages.Size = new System.Drawing.Size(297, 192);
this.pnlPages.Size = new System.Drawing.Size(291, 192);
this.pnlPages.TabIndex = 0;
//
// pnlMenu
@ -49,7 +49,7 @@
| System.Windows.Forms.AnchorStyles.Left)));
this.pnlMenu.Location = new System.Drawing.Point(0, 0);
this.pnlMenu.Name = "pnlMenu";
this.pnlMenu.Size = new System.Drawing.Size(150, 192);
this.pnlMenu.Size = new System.Drawing.Size(152, 192);
this.pnlMenu.TabIndex = 1;
//
// BackstageView

View File

@ -9,6 +9,12 @@ using ArdupilotMega.Utilities;
namespace ArdupilotMega.Controls.BackstageView
{
/// <summary>
/// A Control to somewhat emulate the 'backstage view' as in MS Office 2010
/// </summary>
/// <remarks>
/// 'Tabs' are added as a control in a <see cref="BackstageViewPage"/>
/// </remarks>
public partial class BackstageView : UserControl
{
private Color _buttonsAreaBgColor = Color.White;
@ -18,13 +24,14 @@ namespace ArdupilotMega.Controls.BackstageView
private Color _highlightColor1 = Color.DarkBlue;
private Color _highlightColor2 = Color.Blue;
private readonly List<BackstageViewPage> _pages= new List<BackstageViewPage>();
private readonly List<BackstageViewItem> _items = new List<BackstageViewItem>();
private BackstageViewPage _activePage;
private const int ButtonSpacing = 30;
private const int ButtonHeight = 30;
public BackstageViewPage SelectedPage { get { return _activePage; } }
public List<BackstageViewPage> Pages { get { return _pages; } }
public List<BackstageViewPage> Pages { get { return _items.OfType<BackstageViewPage>().ToList(); } }
public BackstageView()
{
@ -38,12 +45,6 @@ namespace ArdupilotMega.Controls.BackstageView
pnlMenu.GradColor = this.BackColor;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
}
public override Color BackColor
{
get
@ -53,7 +54,7 @@ namespace ArdupilotMega.Controls.BackstageView
set
{
base.BackColor = value;
UpdateButtons();
UpdateButtonAppearance();
pnlMenu.GradColor = this.BackColor;
}
}
@ -68,7 +69,7 @@ namespace ArdupilotMega.Controls.BackstageView
_buttonsAreaPencilColor = value;
pnlMenu.PencilBorderColor = _buttonsAreaPencilColor;
pnlMenu.Invalidate();
UpdateButtons();
UpdateButtonAppearance();
Invalidate();
}
}
@ -96,7 +97,7 @@ namespace ArdupilotMega.Controls.BackstageView
set
{
_selectedTextColor = value;
UpdateButtons();
UpdateButtonAppearance();
}
}
@ -108,7 +109,7 @@ namespace ArdupilotMega.Controls.BackstageView
set
{
_unSelectedTextColor = value;
UpdateButtons();
UpdateButtonAppearance();
Invalidate();
}
}
@ -121,7 +122,7 @@ namespace ArdupilotMega.Controls.BackstageView
set
{
_highlightColor1 = value;
UpdateButtons();
UpdateButtonAppearance();
Invalidate();
}
}
@ -134,36 +135,33 @@ namespace ArdupilotMega.Controls.BackstageView
set
{
_highlightColor2 = value;
UpdateButtons();
UpdateButtonAppearance();
Invalidate();
}
}
private void UpdateButtons()
/// <summary>
/// Add a page (tab) to this backstage view. Will be added at the end/bottom
/// </summary>
public void AddPage(UserControl userControl, string headerText)
{
foreach (var backstageViewButton in pnlMenu.Controls.OfType<BackstageViewButton>())
var page = new BackstageViewPage(userControl, headerText)
{
backstageViewButton.HighlightColor2 = _highlightColor2;
backstageViewButton.HighlightColor1 = _highlightColor1;
backstageViewButton.UnSelectedTextColor = _unSelectedTextColor;
backstageViewButton.SelectedTextColor = _selectedTextColor;
backstageViewButton.ContentPageColor = this.BackColor;
backstageViewButton.PencilBorderColor = _buttonsAreaPencilColor;
backstageViewButton.Invalidate();
}
Page =
{
Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
Location = new Point(pnlMenu.Width, 0),
Dock = DockStyle.Fill
}
};
public void AddPage(BackstageViewPage page)
{
page.Page.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
page.Page.Location = new Point(pnlMenu.Width, 0);
page.Page.Dock = DockStyle.Fill;
_items.Add(page);
_pages.Add(page);
CreateLinkButton(page);
//this.pnlPages.Controls.Add(page.Page);
page.Page.Visible = false;
this.pnlPages.Controls.Add(page.Page);
if (_activePage == null)
{
@ -173,13 +171,22 @@ namespace ArdupilotMega.Controls.BackstageView
}
}
/// <summary>
/// Add a spacer to this backstage view. Will be added at the end/bottom
/// </summary>
/// <param name="spacerheight">the amount to space by</param>
public void AddSpacer(int spacerheight)
{
_items.Add(new BackstageViewSpacer(spacerheight));
}
private void CreateLinkButton(BackstageViewPage page)
{
var lnkButton = new BackstageViewButton
{
Text = page.LinkText,
Tag = page,
Top = _pages.IndexOf(page) * ButtonSpacing,
Top = _items.TakeWhile(i => i != page).Sum(i => i.Spacing),
Width = this.pnlMenu.Width,
Height = ButtonHeight,
ContentPageColor = this.BackColor,
@ -195,12 +202,32 @@ namespace ArdupilotMega.Controls.BackstageView
lnkButton.DoubleClick += lnkButton_DoubleClick;
}
void lnkButton_DoubleClick(object sender, EventArgs e)
private void UpdateButtonAppearance()
{
foreach (var backstageViewButton in pnlMenu.Controls.OfType<BackstageViewButton>())
{
backstageViewButton.HighlightColor2 = _highlightColor2;
backstageViewButton.HighlightColor1 = _highlightColor1;
backstageViewButton.UnSelectedTextColor = _unSelectedTextColor;
backstageViewButton.SelectedTextColor = _selectedTextColor;
backstageViewButton.ContentPageColor = this.BackColor;
backstageViewButton.PencilBorderColor = _buttonsAreaPencilColor;
backstageViewButton.Invalidate();
}
}
/*
* Experimental - double clicking a button will spawn it out into a new form
* Care must be given to lifecycle here - two pages can now be interacted with
* 'simultaneously'
*/
private void lnkButton_DoubleClick(object sender, EventArgs e)
{
var backstageViewButton = ((BackstageViewButton)sender);
var associatedPage = backstageViewButton.Tag as BackstageViewPage;
Form popoutForm = new Form();
var popoutForm = new Form();
popoutForm.FormClosing += popoutForm_FormClosing;
int maxright = 0, maxdown = 0;
@ -214,7 +241,7 @@ namespace ArdupilotMega.Controls.BackstageView
// set the height to 0, so we can derive the header height in the next step
popoutForm.Height = 0;
popoutForm.Size = new System.Drawing.Size(maxright + 20, maxdown + 20 + popoutForm.Height);
popoutForm.Size = new Size(maxright + 20, maxdown + 20 + popoutForm.Height);
popoutForm.Controls.Add(associatedPage.Page);
popoutForm.Tag = associatedPage;
@ -226,19 +253,18 @@ namespace ArdupilotMega.Controls.BackstageView
popoutForm.Show(this);
}
void popoutForm_FormClosing(object sender, FormClosingEventArgs e)
private void popoutForm_FormClosing(object sender, FormClosingEventArgs e)
{
// get the page back
var temp = ((Form)sender).Tag as BackstageViewPage;
// add back to where it belongs
this.pnlPages.Controls.Add(temp.Page);
// clear the controls, so we dont dispose the good control
// clear the controls, so we dont dispose the good control when it closes
((Form)sender).Controls.Clear();
}
private void ButtonClick(object sender, EventArgs e)
{
var backstageViewButton = ((BackstageViewButton) sender);
@ -248,28 +274,35 @@ namespace ArdupilotMega.Controls.BackstageView
public void ActivatePage(BackstageViewPage associatedPage)
{
// deactivate the old page
_activePage.Page.Close();
Pages.ForEach(x =>
// Deactivate old page
if (_activePage.Page is IDeactivate)
{
x.Page.Visible = false;
});
this.pnlPages.Controls.Remove(_activePage.Page);
((IDeactivate)(_activePage.Page)).Deactivate();
}
// deactivate the old page - obsolete way of notifying activation
//_activePage.Page.Close();
foreach (var p in Pages)
p.Page.Visible = false;
// deactivate button
_activePage.Page.Visible = false;
var oldButton = this.pnlMenu.Controls.OfType<BackstageViewButton>().Single(b => b.Tag == _activePage);
oldButton.IsSelected = false;
// ensure fields have been init - obsolete way of notifying activation
//associatedPage.Page.DoLoad(new EventArgs());
ThemeManager.ApplyThemeTo(associatedPage.Page);
// new way of notifying activation. Goal is to get rid of BackStageViewContentPanel
// so plain old user controls can be added
if (associatedPage.Page is IActivate)
{
((IActivate)(associatedPage.Page)).Activate();
}
// 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<BackstageViewButton>().Single(b => b.Tag == associatedPage);
newButton.IsSelected = true;
@ -279,22 +312,70 @@ namespace ArdupilotMega.Controls.BackstageView
public void Close()
{
foreach (BackstageViewPage page in _pages)
foreach (var page in _items)
{
page.Page.Close();
if (((BackstageViewPage)page).Page is IDeactivate)
{
((IDeactivate)((BackstageViewPage)(page)).Page).Deactivate();
}
else
{
((BackstageViewPage)page).Page.Dispose();
}
}
}
public class BackstageViewPage
public abstract class BackstageViewItem
{
public BackstageViewPage(BackStageViewContentPanel page, string linkText)
public abstract int Spacing { get; }
}
/// <summary>
/// Place-holder for a bit of blank space in a <see cref="BackstageView"/>
/// Used to visually seperate logically related groups of link buttons
/// </summary>
public class BackstageViewSpacer : BackstageViewItem
{
private int _spacing;
public BackstageViewSpacer(int spacerheight)
{
_spacing = spacerheight;
}
// How much (vertical) space the thing takes up in the button menu
public override int Spacing
{
get { return _spacing; }
}
}
/// <summary>
/// Data structure to hold information about a 'tab' in the <see cref="BackstageView"/>
/// </summary>
public class BackstageViewPage : BackstageViewItem
{
public BackstageViewPage(UserControl page, string linkText)
{
Page = page;
LinkText = linkText;
}
public BackStageViewContentPanel Page { get; set; }
/// <summary>
/// The user content of the tab
/// </summary>
public UserControl Page { get; set; }
/// <summary>
/// The text to go in the 'tab header'
/// </summary>
public string LinkText { get; set; }
public override int Spacing
{
get { return ButtonSpacing; }
}
}
}

View File

@ -13,7 +13,7 @@ using ArdupilotMega.Utilities;
namespace ArdupilotMega.Controls
{
public partial class ConfigPanel : BackStageViewContentPanel
public partial class ConfigPanel : UserControl
{
/// <summary>
/// store temp pending changes
@ -22,9 +22,11 @@ namespace ArdupilotMega.Controls
// store linked param options
Hashtable _linkedParams = new Hashtable();
public ConfigPanel()
public ConfigPanel(string XMLFile)
{
InitializeComponent();
LoadXML(XMLFile);
}
/// <summary>

View File

@ -11,10 +11,10 @@ namespace ArdupilotMega.Controls
{
public partial class ConnectionStats : UserControl
{
private readonly IMAVLink _mavlink;
private readonly MAVLink _mavlink;
private CompositeDisposable _subscriptionsDisposable;
public ConnectionStats(IMAVLink comPort)
public ConnectionStats(MAVLink comPort)
: this()
{
_mavlink = comPort;

View File

@ -52,7 +52,7 @@ namespace System.Windows.Forms
var msgBoxFrm = new Form
{
FormBorderStyle = FormBorderStyle.FixedDialog,
ShowInTaskbar = false,
ShowInTaskbar = true,
StartPosition = FormStartPosition.CenterScreen,
Text = caption,
MaximizeBox = false,
@ -60,7 +60,7 @@ namespace System.Windows.Forms
Width = textSize.Width + 50,
Height = textSize.Height + 100,
TopMost = true,
TopLevel = true,
TopLevel = true
};
Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
@ -103,6 +103,8 @@ namespace System.Windows.Forms
}
catch { }
Console.WriteLine("CustomMessageBox 1");
if (System.Windows.Forms.Application.OpenForms.Count > 0)
{
msgBoxFrm.StartPosition = FormStartPosition.Manual;
@ -110,13 +112,17 @@ namespace System.Windows.Forms
// center of first form
msgBoxFrm.Location = new Point(parentForm.Location.X + parentForm.Width / 2 - msgBoxFrm.Width / 2,
parentForm.Location.Y + parentForm.Height / 2 - msgBoxFrm.Height / 2);
DialogResult test = msgBoxFrm.ShowDialog();
Console.WriteLine("CustomMessageBox 2a");
DialogResult test = msgBoxFrm.ShowDialog(null);
}
else
{
DialogResult test = msgBoxFrm.ShowDialog();
Console.WriteLine("CustomMessageBox 2b");
DialogResult test = msgBoxFrm.ShowDialog(null);
}
Console.WriteLine("CustomMessageBox 3");
DialogResult answer = _state;
return answer;

View File

@ -31,6 +31,29 @@ namespace ArdupilotMega.Controls
set { _navbearing = value; }
}
/// <summary>
/// Override to prevent offscreen drawing the control - mono mac
/// </summary>
public new void Invalidate()
{
if (!ThisReallyVisible())
{
return;
}
base.Invalidate();
}
/// <summary>
/// this is to fix a mono off screen drawing issue
/// </summary>
/// <returns></returns>
public bool ThisReallyVisible()
{
Control ctl = Control.FromHandle(this.Handle);
return ctl.Visible;
}
public HSI()
{
InitializeComponent();

View File

@ -182,10 +182,38 @@ namespace ArdupilotMega.Controls
public override void Refresh()
{
if (!ThisReallyVisible())
{
return;
}
//base.Refresh();
OnPaint(new PaintEventArgs(this.CreateGraphics(),this.ClientRectangle));
}
/// <summary>
/// Override to prevent offscreen drawing the control - mono mac
/// </summary>
public new void Invalidate()
{
if (!ThisReallyVisible())
{
return;
}
base.Invalidate();
}
/// <summary>
/// this is to fix a mono off screen drawing issue
/// </summary>
/// <returns></returns>
public bool ThisReallyVisible()
{
//Control ctl = Control.FromHandle(this.Handle);
return this.Visible;
}
protected override void OnLoad(EventArgs e)
{
if (opengl)
@ -245,9 +273,11 @@ namespace ArdupilotMega.Controls
started = true;
}
object lockit = new object();
bool inOnPaint = false;
string otherthread = "";
protected override void OnPaint(PaintEventArgs e)
{
//GL.Enable(EnableCap.AlphaTest)
@ -270,6 +300,9 @@ namespace ArdupilotMega.Controls
return;
}
lock (lockit)
{
if (inOnPaint)
{
log.Info("Was in onpaint Hud th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread);
@ -280,6 +313,8 @@ namespace ArdupilotMega.Controls
inOnPaint = true;
}
starttime = DateTime.Now;
try
@ -701,6 +736,8 @@ namespace ArdupilotMega.Controls
graphicsObjectGDIP.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
}
graphicsObjectGDIP.InterpolationMode = InterpolationMode.Bilinear;
graphicsObject.Clear(Color.Gray);
@ -1310,7 +1347,7 @@ namespace ArdupilotMega.Controls
graphicsObject.DrawLine(redPen, scrollbg.Left, scrollbg.Top - (int)(fontsize * 2.2) - 2, scrollbg.Left + 50, scrollbg.Top - (int)(fontsize * 2.2) - 2 - 20);
}
drawstring(graphicsObject, _datetime.ToString("HH:mm:ss"), font, fontsize, whiteBrush, scrollbg.Left - 20, scrollbg.Top - fontsize - 2 - 20);
drawstring(graphicsObject, _datetime.ToString("HH:mm:ss"), font, fontsize, whiteBrush, scrollbg.Left - 30, scrollbg.Top - fontsize - 2 - 20);
// battery
@ -1558,27 +1595,86 @@ namespace ArdupilotMega.Controls
if (text == null || text == "")
return;
char[] chars = text.ToCharArray();
float maxy = 0;
foreach (char cha in chars)
{
int charno = (int)cha;
int charid = charno + (128 * (int)fontsize);
if (charbitmaps[charid] == null)
{
charbitmaps[charid] = new Bitmap(128, 128, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
charbitmaps[charid].MakeTransparent(Color.Transparent);
//charbitmaptexid
float maxx = this.Width / 150; // for space
// create bitmap
using (Graphics gfx = Graphics.FromImage(charbitmaps[charid]))
{
pth.Reset();
if (text != null)
pth.AddString(cha + "", font.FontFamily, 0, fontsize + 5, new Point((int)0, (int)0), StringFormat.GenericTypographic);
gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
gfx.DrawPath(P, pth);
//Draw the face
gfx.FillPath(brush, pth);
if (pth.PointCount > 0)
{
foreach (PointF pnt in pth.PathPoints)
{
if (pnt.X > maxx)
maxx = pnt.X;
if (pnt.Y > maxy)
maxy = pnt.Y;
}
}
}
charwidth[charid] = (int)(maxx + 2);
}
// draw it
float scale = 1.0f;
DrawImage(charbitmaps[charid], (int)x, (int)y, charbitmaps[charid].Width, charbitmaps[charid].Height);
x += charwidth[charid] * scale;
/*
pth.Reset();
if (text != null)
pth.AddString(text, font.FontFamily, 0, fontsize + 5, new Point((int)x, (int)y), StringFormat.GenericTypographic);
//Draw the edge
// this uses lots of cpu time
//e.SmoothingMode = SmoothingMode.HighSpeed;
if (e == null || P == null || pth == null || pth.PointCount == 0)
return;
//if (!ArdupilotMega.MainV2.MONO)
e.DrawPath(P, pth);
//Draw the face
e.FillPath(brush, pth);
*/
}
//pth.Dispose();
}
protected override void OnHandleCreated(EventArgs e)
@ -1646,6 +1742,8 @@ namespace ArdupilotMega.Controls
{
if (opengl)
{
MakeCurrent();
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(0, Width, Height, 0, -1, 1);

View File

@ -35,12 +35,7 @@ namespace ArdupilotMega.Controls
throw new ArgumentOutOfRangeException();
_opacity = value;
Console.WriteLine("Opacity:" + _opacity);
Invalidate();
Invalidate();
Invalidate();
Invalidate();
}
}

View File

@ -1,51 +1,73 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace ArdupilotMega.Controls
{
/// <summary>
/// A seperator that is fundamentally made from two lines the top 'Primary' and the
/// bottom 'Secondary' Thus the height is always 2 pixels
/// In addition, the opacity can be modulated for the left, middle and right most
/// points, and the color blended between. That way the seperator can be made to
/// fade out to the left or right or both, and more subtle UI effects made etc
/// </summary>
public partial class LineSeparator : UserControl
{
[Description("Primary Color of the secondary line"), Category("Appearance")]
[DefaultValue(typeof(Color), "DarkGray")]
public Color PrimaryColor { get; set; }
[Description("Secondary Color of the secondary line"), Category("Appearance")]
[DefaultValue(typeof(Color), "White")]
public Color SecondaryColor { get; set; }
[Description("Opacity at the left most point"), Category("Appearance")]
[DefaultValue(typeof(float), "1.0")]
public float Opacity1 { get; set; }
[Description("Opacity at the mid point"), Category("Appearance")]
[DefaultValue(typeof(float), "1.0")]
public float Opacity2 { get; set; }
[Description("Opacity at the right most point"), Category("Appearance")]
[DefaultValue(typeof(float), "1.0")]
public float Opacity3 { get; set; }
public LineSeparator()
{
this.PrimaryColor = Color.DarkGray;
this.SecondaryColor = Color.White;
this.Opacity1 = Opacity2 = Opacity3 = 1f;
this.Height = 2;
this.Paint += new PaintEventHandler(LineSeparator_Paint);
this.Paint += LineSeparator_Paint;
this.MaximumSize = new Size(2000, 2);
this.MinimumSize = new Size(0, 2);
//this.Width = 350;
}
private void LineSeparator_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.DrawLine(
Pens.DarkGray, new Point(0, 0), new Point(this.Width, 0));
g.DrawLine(
Pens.White, new Point(0, 1), new Point(this.Width, 1));
DrawLine(PrimaryColor, 0, e.Graphics);
DrawLine(SecondaryColor, 1, e.Graphics);
}
private void DrawLine(Color baseColor, int y, Graphics g)
{
var c1 = Color.FromArgb((int)(Opacity1 * 255), baseColor.R, baseColor.G, baseColor.B);
var c2 = Color.FromArgb((int)(Opacity2 * 255), baseColor.R, baseColor.G, baseColor.B);
var c3 = Color.FromArgb((int)(Opacity3 * 255), baseColor.R, baseColor.G, baseColor.B);
var point1 = new Point(0, y);
var point2 = new Point(Width / 2, y);
var point = new Point(Width, y);
var b1 = new LinearGradientBrush(point1, point2, c1, c2);
var b2 = new LinearGradientBrush(point2, point, c2, c3);
g.DrawLine(new Pen(b1), point1, point2);
g.DrawLine(new Pen(b2), point2, point);
}
}
}

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using ArdupilotMega.Utilities;
using ArdupilotMega.Controls.BackstageView;
namespace ArdupilotMega.Controls
{
@ -43,6 +44,11 @@ namespace ArdupilotMega.Controls
// check if we need to remove the current control
if (!current.Persistent)
{
if (current.Control is IDeactivate)
{
((IDeactivate)(current.Control)).Deactivate();
}
// cleanup
current.Control.Close();
@ -63,6 +69,11 @@ namespace ArdupilotMega.Controls
nextscreen.Visible = true;
if (nextscreen.Control is IActivate)
{
((IActivate)(nextscreen.Control)).Activate();
}
this.Controls.Add(nextscreen.Control);
ThemeManager.ApplyThemeTo(nextscreen.Control);

View File

@ -66,6 +66,21 @@ namespace ArdupilotMega.Controls
return true;
}
public override void Refresh()
{
base.Refresh();
}
protected override void OnParentBindingContextChanged(EventArgs e)
{
base.OnParentBindingContextChanged(e);
}
protected override void OnVisibleChanged(EventArgs e)
{
base.OnVisibleChanged(e);
}
SolidBrush s = new SolidBrush(Color.White);
SolidBrush b = new SolidBrush(Color.Black);
@ -75,9 +90,7 @@ namespace ArdupilotMega.Controls
protected override void OnPaint(PaintEventArgs e)
{
TextRenderer.DrawText(e.Graphics, label, this.Font, new Point(0, 0), ForeColor);
/*
//return;
// TextRenderer.DrawText(e.Graphics, label, this.Font, new Point(0, 0), ForeColor);
stringFormat.Alignment = StringAlignment.Near;
stringFormat.LineAlignment = StringAlignment.Center;
@ -85,7 +98,7 @@ namespace ArdupilotMega.Controls
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)

View File

@ -11,6 +11,10 @@ namespace System.Windows.Forms
/// </summary>
public class MyUserControl : System.Windows.Forms.UserControl
{
/// <summary>
/// implement an on closing event to tidy up enviroment.
/// Using preedefined refrence as can easerly change betwen form and user control this way.
/// </summary>
public event FormClosingEventHandler FormClosing;
public void Close(object sender, FormClosingEventArgs e)

View File

@ -17,6 +17,9 @@ namespace ArdupilotMega.Controls
private Exception workerException;
public ProgressWorkerEventArgs doWorkArgs;
internal int _progress = -1;
internal string _status = "";
public delegate void DoWorkEventHandler(object sender, ProgressWorkerEventArgs e);
// This is the event that will be raised on the BG thread
@ -48,7 +51,7 @@ namespace ArdupilotMega.Controls
// mono fix - ensure the dialog is running
while (this.IsHandleCreated == false)
System.Threading.Thread.Sleep(5);
System.Threading.Thread.Sleep(1);
try
{
@ -59,10 +62,18 @@ namespace ArdupilotMega.Controls
// The background operation thew an exception.
// Examine the work args, if there is an error, then display that and the exception details
// Otherwise display 'Unexpected error' and exception details
timer1.Stop();
ShowDoneWithError(e, doWorkArgs.ErrorMessage);
return;
}
// stop the timer
timer1.Stop();
// run once more to do final message and progressbar
this.Invoke((MethodInvoker)delegate
{
timer1_Tick(null, null);
});
if (doWorkArgs.CancelRequested && doWorkArgs.CancelAcknowledged)
{
@ -183,24 +194,9 @@ namespace ArdupilotMega.Controls
if (doWorkArgs.CancelRequested && !doWorkArgs.CancelAcknowledged)
return;
if (this.InvokeRequired)
{
// invoke async
this.BeginInvoke((MethodInvoker) delegate
{
_progress = progress;
_status = status;
lblProgressMessage.Text = status;
if (progress == -1)
{
this.progressBar1.Style = ProgressBarStyle.Marquee;
}
else
{
this.progressBar1.Style = ProgressBarStyle.Continuous;
this.progressBar1.Value = progress;
}
});
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@ -212,6 +208,25 @@ namespace ArdupilotMega.Controls
CustomMessageBox.Show(message,"Exception Details",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
/// <summary>
/// prevent using invokes on main update status call "UpdateProgressAndStatus", as this is slow on mono
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timer1_Tick(object sender, EventArgs e)
{
lblProgressMessage.Text = _status;
if (_progress == -1)
{
this.progressBar1.Style = ProgressBarStyle.Marquee;
}
else
{
this.progressBar1.Style = ProgressBarStyle.Continuous;
this.progressBar1.Value = _progress;
}
}
}
public class ProgressWorkerEventArgs : EventArgs

View File

@ -33,12 +33,14 @@ namespace ArdupilotMega.Controls
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.lblProgressMessage = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.imgWarning = new System.Windows.Forms.PictureBox();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btnClose = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.imgWarning)).BeginInit();
this.SuspendLayout();
//
@ -94,7 +96,7 @@ namespace ArdupilotMega.Controls
this.linkLabel1.Visible = false;
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// btn_Close
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(213, 109);
this.btnClose.Name = "btnClose";
@ -104,6 +106,11 @@ namespace ArdupilotMega.Controls
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btn_Close_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// ProgressReporterDialogue
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -123,6 +130,7 @@ namespace ArdupilotMega.Controls
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Progress";
this.TopMost = true;
((System.ComponentModel.ISupportInitialize)(this.imgWarning)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -137,5 +145,6 @@ namespace ArdupilotMega.Controls
private PictureBox imgWarning;
private LinkLabel linkLabel1;
private Button btnClose;
private Timer timer1;
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -11,9 +11,6 @@ namespace ArdupilotMega.Controls
var bgcolor = c.BackColor;
int alpha = 255 - ((int)(opacity * 255));
Console.WriteLine("Alpha:" + alpha);
var opacityColor = Color.FromArgb(alpha, bgcolor.R, bgcolor.G, bgcolor.B);
using (var brush = new SolidBrush(opacityColor))
{

View File

@ -78,6 +78,7 @@ namespace ArdupilotMega
public float mz { get; set; }
public float magfield { get { return (float)Math.Sqrt(Math.Pow(mx, 2) + Math.Pow(my, 2) + Math.Pow(mz, 2)); } }
public float accelsq { get { return (float)Math.Sqrt(Math.Pow(ax, 2) + Math.Pow(ay, 2) + Math.Pow(az, 2)) / 980.665f; } }
// calced turn rate
public float turnrate { get { if (groundspeed <= 1) return 0; return (roll * 9.8f) / groundspeed; } }
@ -131,9 +132,9 @@ 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; _targetalt = (float)Math.Round(alt + alt_error, 0); } }
public float alt_error { get { return _alt_error * multiplierdist; } set { if (_alt_error == value) return; _alt_error = value; _targetalt = _targetalt * 0.5f + (float)Math.Round(alt + alt_error, 0) * 0.5f; Console.WriteLine(_targetalt); } }
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 aspd_error { get { return _aspd_error * multiplierspeed; } set { if (_aspd_error == value) return; _aspd_error = value; _targetairspeed = _targetairspeed * 0.5f + (float)Math.Round(airspeed + aspd_error / 100, 0) * 0.5f; } }
public float xtrack_error { get; set; }
public float wpno { get; set; }
public string mode { get; set; }
@ -142,12 +143,13 @@ namespace ArdupilotMega
float _aspd_error;
float _alt_error;
float _targetalt;
float _targetairspeed;
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); } }
public float targetairspeed { get { return _targetairspeed; } }
//message
@ -352,7 +354,7 @@ namespace ArdupilotMega
UpdateCurrentSettings(bs, false, MainV2.comPort);
}
*/
public void UpdateCurrentSettings(System.Windows.Forms.BindingSource bs, bool updatenow, IMAVLink mavinterface)
public void UpdateCurrentSettings(System.Windows.Forms.BindingSource bs, bool updatenow, MAVLink mavinterface)
{
if (DateTime.Now > lastupdate.AddMilliseconds(19) || updatenow) // 50 hz
{
@ -430,24 +432,6 @@ namespace ArdupilotMega
//MAVLink.packets[MAVLink.MAVLINK_MSG_ID_HWSTATUS] = null;
}
bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT];
if (bytearray != null)
{
var nav = bytearray.ByteArrayToStructure<MAVLink.mavlink_nav_controller_output_t>(6);
nav_roll = nav.nav_roll;
nav_pitch = nav.nav_pitch;
nav_bearing = nav.nav_bearing;
target_bearing = nav.target_bearing;
wp_dist = nav.wp_dist;
alt_error = nav.alt_error;
aspd_error = nav.aspd_error;
xtrack_error = nav.xtrack_error;
//MAVLink.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT] = null;
}
#if MAVLINK10
@ -849,6 +833,26 @@ namespace ArdupilotMega
}
#endif
bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT];
if (bytearray != null)
{
var nav = bytearray.ByteArrayToStructure<MAVLink.mavlink_nav_controller_output_t>(6);
nav_roll = nav.nav_roll;
nav_pitch = nav.nav_pitch;
nav_bearing = nav.nav_bearing;
target_bearing = nav.target_bearing;
wp_dist = nav.wp_dist;
alt_error = nav.alt_error;
aspd_error = nav.aspd_error;
xtrack_error = nav.xtrack_error;
//MAVLink.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT] = null;
}
bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_RAW];
if (bytearray != null)
{
@ -964,7 +968,7 @@ namespace ArdupilotMega
//System.Diagnostics.Debug.WriteLine(DateTime.Now.Millisecond);
//Console.WriteLine(DateTime.Now.Millisecond);
bs.DataSource = this;
//Console.WriteLine(DateTime.Now.Millisecond + " 1 " + updatenow);
// Console.WriteLine(DateTime.Now.Millisecond + " 1 " + updatenow + " " + System.Threading.Thread.CurrentThread.Name);
bs.ResetBindings(false);
//Console.WriteLine(DateTime.Now.Millisecond + " done ");
}

View File

@ -259,7 +259,6 @@
this.Controls.Add(this.LIM_ENABLED);
this.Controls.Add(this.LNK_wiki);
this.Name = "ConfigAP_Limits";
this.Load += new System.EventHandler(this.ConfigAP_Limits_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox5.ResumeLayout(false);

View File

@ -13,7 +13,7 @@ using System.Diagnostics;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigAP_Limits : BackStageViewContentPanel
public partial class ConfigAP_Limits : UserControl, IActivate
{
public ConfigAP_Limits()
{
@ -73,7 +73,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
ProcessChange(sender, e);
}
private void ConfigAP_Limits_Load(object sender, EventArgs e)
public void Activate()
{
PopulateData();
}

View File

@ -83,7 +83,6 @@
this.Controls.Add(this.BUT_levelplane);
this.Name = "ConfigAccelerometerCalibrationPlane";
this.toolTip1.SetToolTip(this, resources.GetString("$this.ToolTip"));
this.Load += new System.EventHandler(this.ConfigAccelerometerCalibration_Load);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -11,7 +11,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigAccelerometerCalibrationPlane : BackStageViewContentPanel
public partial class ConfigAccelerometerCalibrationPlane : UserControl, IActivate
{
bool startup = false;
@ -20,7 +20,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
InitializeComponent();
}
private void ConfigAccelerometerCalibration_Load(object sender, EventArgs e)
public void Activate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{

View File

@ -1,4 +1,6 @@
namespace ArdupilotMega.GCSViews.ConfigurationView
using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
partial class ConfigAccelerometerCalibrationQuad
{
@ -29,52 +31,77 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigAccelerometerCalibrationQuad));
this.label28 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.pictureBoxQuadX = new System.Windows.Forms.PictureBox();
this.pictureBoxQuad = new System.Windows.Forms.PictureBox();
this.BUT_levelac2 = new ArdupilotMega.Controls.MyButton();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.radioButton_Plus = new System.Windows.Forms.RadioButton();
this.radioButton_X = new System.Windows.Forms.RadioButton();
this.label5 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.lbl_frame = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.pictureBoxPlus = new ArdupilotMega.Controls.PictureBoxWithPseudoOpacity();
this.pictureBoxX = new ArdupilotMega.Controls.PictureBoxWithPseudoOpacity();
this.BUT_levelac2 = new ArdupilotMega.Controls.MyButton();
this.label4 = new System.Windows.Forms.Label();
this.lineSeparator3 = new ArdupilotMega.Controls.LineSeparator();
this.lineSeparator2 = new ArdupilotMega.Controls.LineSeparator();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlus)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxX)).BeginInit();
this.SuspendLayout();
//
// label28
// radioButton_Plus
//
resources.ApplyResources(this.label28, "label28");
this.label28.Name = "label28";
resources.ApplyResources(this.radioButton_Plus, "radioButton_Plus");
this.radioButton_Plus.Name = "radioButton_Plus";
this.radioButton_Plus.TabStop = true;
this.radioButton_Plus.UseVisualStyleBackColor = true;
this.radioButton_Plus.CheckedChanged += new System.EventHandler(this.RadioButtonPlusCheckedChanged);
//
// label15
// radioButton_X
//
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
resources.ApplyResources(this.radioButton_X, "radioButton_X");
this.radioButton_X.Name = "radioButton_X";
this.radioButton_X.TabStop = true;
this.radioButton_X.UseVisualStyleBackColor = true;
this.radioButton_X.CheckedChanged += new System.EventHandler(this.RadioButtonPlusCheckedChanged);
//
// pictureBoxQuadX
// label5
//
this.pictureBoxQuadX.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBoxQuadX.Image = global::ArdupilotMega.Properties.Resources.quadx;
resources.ApplyResources(this.pictureBoxQuadX, "pictureBoxQuadX");
this.pictureBoxQuadX.Name = "pictureBoxQuadX";
this.pictureBoxQuadX.TabStop = false;
this.pictureBoxQuadX.Click += new System.EventHandler(this.pictureBoxQuadX_Click);
resources.ApplyResources(this.label5, "label5");
this.label5.ForeColor = System.Drawing.Color.WhiteSmoke;
this.label5.Name = "label5";
//
// pictureBoxQuad
// label1
//
this.pictureBoxQuad.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBoxQuad.Image = global::ArdupilotMega.Properties.Resources.quad;
resources.ApplyResources(this.pictureBoxQuad, "pictureBoxQuad");
this.pictureBoxQuad.Name = "pictureBoxQuad";
this.pictureBoxQuad.TabStop = false;
this.pictureBoxQuad.Click += new System.EventHandler(this.pictureBoxQuad_Click);
resources.ApplyResources(this.label1, "label1");
this.label1.ForeColor = System.Drawing.Color.WhiteSmoke;
this.label1.Name = "label1";
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// pictureBoxPlus
//
this.pictureBoxPlus.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBoxPlus.Image = global::ArdupilotMega.Properties.Resources.frames_plus;
resources.ApplyResources(this.pictureBoxPlus, "pictureBoxPlus");
this.pictureBoxPlus.Name = "pictureBoxPlus";
this.pictureBoxPlus.TabStop = false;
this.pictureBoxPlus.Click += new System.EventHandler(this.pictureBox_Click);
//
// pictureBoxX
//
this.pictureBoxX.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBoxX.Image = global::ArdupilotMega.Properties.Resources.frames_x;
resources.ApplyResources(this.pictureBoxX, "pictureBoxX");
this.pictureBoxX.Name = "pictureBoxX";
this.pictureBoxX.TabStop = false;
this.pictureBoxX.Click += new System.EventHandler(this.pictureBox_Click);
//
// BUT_levelac2
//
@ -83,75 +110,54 @@
this.BUT_levelac2.UseVisualStyleBackColor = true;
this.BUT_levelac2.Click += new System.EventHandler(this.BUT_levelac2_Click);
//
// pictureBox1
// label4
//
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Image = global::ArdupilotMega.Properties.Resources.frames_06;
resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBoxQuadX_Click);
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// pictureBox2
// lineSeparator3
//
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox2.Image = global::ArdupilotMega.Properties.Resources.hexa;
resources.ApplyResources(this.pictureBox2, "pictureBox2");
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.TabStop = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBoxQuad_Click);
resources.ApplyResources(this.lineSeparator3, "lineSeparator3");
this.lineSeparator3.MaximumSize = new System.Drawing.Size(2000, 2);
this.lineSeparator3.MinimumSize = new System.Drawing.Size(0, 2);
this.lineSeparator3.Name = "lineSeparator3";
this.lineSeparator3.Opacity1 = 0.6F;
this.lineSeparator3.Opacity2 = 0.7F;
this.lineSeparator3.Opacity3 = 0.1F;
this.lineSeparator3.PrimaryColor = System.Drawing.Color.Black;
this.lineSeparator3.SecondaryColor = System.Drawing.Color.Gainsboro;
//
// pictureBox3
// lineSeparator2
//
this.pictureBox3.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox3.Image = global::ArdupilotMega.Properties.Resources.octox;
resources.ApplyResources(this.pictureBox3, "pictureBox3");
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.TabStop = false;
this.pictureBox3.Click += new System.EventHandler(this.pictureBoxQuadX_Click);
//
// pictureBox4
//
this.pictureBox4.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox4.Image = global::ArdupilotMega.Properties.Resources.octo;
resources.ApplyResources(this.pictureBox4, "pictureBox4");
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.TabStop = false;
this.pictureBox4.Click += new System.EventHandler(this.pictureBoxQuad_Click);
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// lbl_frame
//
resources.ApplyResources(this.lbl_frame, "lbl_frame");
this.lbl_frame.Name = "lbl_frame";
resources.ApplyResources(this.lineSeparator2, "lineSeparator2");
this.lineSeparator2.MaximumSize = new System.Drawing.Size(2000, 2);
this.lineSeparator2.MinimumSize = new System.Drawing.Size(0, 2);
this.lineSeparator2.Name = "lineSeparator2";
this.lineSeparator2.Opacity1 = 0.6F;
this.lineSeparator2.Opacity2 = 0.7F;
this.lineSeparator2.Opacity3 = 0.1F;
this.lineSeparator2.PrimaryColor = System.Drawing.Color.Black;
this.lineSeparator2.SecondaryColor = System.Drawing.Color.Gainsboro;
//
// ConfigAccelerometerCalibrationQuad
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lbl_frame);
this.Controls.Add(this.lineSeparator2);
this.Controls.Add(this.lineSeparator3);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox3);
this.Controls.Add(this.pictureBox4);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.label28);
this.Controls.Add(this.label15);
this.Controls.Add(this.pictureBoxQuadX);
this.Controls.Add(this.pictureBoxQuad);
this.Controls.Add(this.label5);
this.Controls.Add(this.radioButton_X);
this.Controls.Add(this.radioButton_Plus);
this.Controls.Add(this.pictureBoxPlus);
this.Controls.Add(this.pictureBoxX);
this.Controls.Add(this.BUT_levelac2);
this.Name = "ConfigAccelerometerCalibrationQuad";
this.Load += new System.EventHandler(this.ConfigAccelerometerCalibration_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlus)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxX)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -159,16 +165,17 @@
#endregion
private System.Windows.Forms.Label label28;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.PictureBox pictureBoxQuadX;
private System.Windows.Forms.PictureBox pictureBoxQuad;
private PictureBoxWithPseudoOpacity pictureBoxX;
private ArdupilotMega.Controls.MyButton BUT_levelac2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox4;
private PictureBoxWithPseudoOpacity pictureBoxPlus;
private System.Windows.Forms.RadioButton radioButton_Plus;
private System.Windows.Forms.RadioButton radioButton_X;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lbl_frame;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private LineSeparator lineSeparator3;
private LineSeparator lineSeparator2;
}
}

View File

@ -1,90 +1,118 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Windows.Forms;
using ArdupilotMega.Controls.BackstageView;
using ArdupilotMega.Controls;
using log4net;
using Transitions;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigAccelerometerCalibrationQuad : BackStageViewContentPanel
public partial class ConfigAccelerometerCalibrationQuad : UserControl, IActivate, IDeactivate
{
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const float DisabledOpacity = 0.2F;
private const float EnabledOpacity = 1.0F;
public ConfigAccelerometerCalibrationQuad()
{
InitializeComponent();
}
private void pictureBoxQuadX_Click(object sender, EventArgs e)
{
try
{
MainV2.comPort.setParam("FRAME", 1f);
CustomMessageBox.Show("Set to x");
lbl_frame.Text = "X";
}
catch { CustomMessageBox.Show("Set frame failed"); }
}
private void BUT_levelac2_Click(object sender, EventArgs e)
{
try
{
#if MAVLINK10
Log.Info("Sending level command (mavlink 1.0)");
int fixme; // needs to be accel only
MainV2.comPort.doCommand(MAVLink.MAV_CMD.PREFLIGHT_CALIBRATION,1,1,1,1,1,1,1);
#else
log.Info("Sending level command (mavlink 0.9)");
MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC);
#endif
BUT_levelac2.Text = "Complete";
}
catch
catch(Exception ex)
{
Log.Error("Exception on level", ex);
CustomMessageBox.Show("Failed to level : ac2 2.0.37+ is required");
}
}
private void pictureBoxQuad_Click(object sender, EventArgs e)
private void pictureBox_Click(object sender, EventArgs e)
{
try
{
MainV2.comPort.setParam("FRAME", 0f);
CustomMessageBox.Show("Set to +");
lbl_frame.Text = "+";
}
catch { CustomMessageBox.Show("Set frame failed"); }
if (sender == pictureBoxPlus)
radioButton_Plus.Checked = true;
else
radioButton_X.Checked = true;
}
private void ConfigAccelerometerCalibration_Load(object sender, EventArgs e)
private void SetPlus()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
this.Enabled = false;
return;
FadePicBoxes(DisabledOpacity, EnabledOpacity);
SetFrameParam(true);
}
else
private void SetX()
{
if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
FadePicBoxes(EnabledOpacity, DisabledOpacity);
SetFrameParam(false);
}
private void SetFrameParam(bool isPlus)
{
this.Enabled = true;
}
else
{
this.Enabled = false;
return;
}
}
var f = isPlus ? 0f : 1f;
try
{
lbl_frame.Text = ((float)MainV2.comPort.param["FRAME"] == 0) ? "+" : "X";
MainV2.comPort.setParam("FRAME", f);
}
catch { lbl_frame.Text = "Invalid Frame"; }
catch
{
CustomMessageBox.Show("Set frame failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void FadePicBoxes(float xOpacity, float plusOpacity)
{
var fade = new Transition(new TransitionType_Linear(400));
fade.add(pictureBoxX, "Opacity", xOpacity);
fade.add(pictureBoxPlus, "Opacity", plusOpacity);
fade.run();
}
public void Activate()
{
if ((float)MainV2.comPort.param["FRAME"] == 0)
{
this.radioButton_Plus.Checked = true;
pictureBoxX.Opacity = DisabledOpacity;
pictureBoxPlus.Opacity = EnabledOpacity;
}
else
{
this.radioButton_X.Checked = true;
pictureBoxX.Opacity = EnabledOpacity;
pictureBoxPlus.Opacity = DisabledOpacity;
}
radioButton_Plus.CheckedChanged += RadioButtonPlusCheckedChanged;
}
public void Deactivate()
{
radioButton_Plus.CheckedChanged -= RadioButtonPlusCheckedChanged;
}
void RadioButtonPlusCheckedChanged(object sender, EventArgs e)
{
if (radioButton_X.Checked)
SetX();
else
SetPlus();
}
}
}

View File

@ -118,271 +118,115 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label28.AutoSize" type="System.Boolean, mscorlib">
<data name="radioButton_Plus.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label28.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<data name="radioButton_Plus.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="label28.Location" type="System.Drawing.Point, System.Drawing">
<value>194, 8</value>
<data name="radioButton_Plus.Location" type="System.Drawing.Point, System.Drawing">
<value>76, 96</value>
</data>
<data name="label28.Size" type="System.Drawing.Size, System.Drawing">
<value>239, 13</value>
<data name="radioButton_Plus.Size" type="System.Drawing.Size, System.Drawing">
<value>14, 13</value>
</data>
<data name="label28.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
<data name="radioButton_Plus.TabIndex" type="System.Int32, mscorlib">
<value>23</value>
</data>
<data name="label28.Text" xml:space="preserve">
<value>Level your MultiCopter to set default accel offsets</value>
<data name="&gt;&gt;radioButton_Plus.Name" xml:space="preserve">
<value>radioButton_Plus</value>
</data>
<data name="&gt;&gt;label28.Name" xml:space="preserve">
<value>label28</value>
<data name="&gt;&gt;radioButton_Plus.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label28.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label28.Parent" xml:space="preserve">
<data name="&gt;&gt;radioButton_Plus.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label28.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label15.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label15.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label15.Location" type="System.Drawing.Point, System.Drawing">
<value>254, 94</value>
</data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>102, 13</value>
</data>
<data name="label15.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="label15.Text" xml:space="preserve">
<value>Frame Setup (+ or x)</value>
</data>
<data name="&gt;&gt;label15.Name" xml:space="preserve">
<value>label15</value>
</data>
<data name="&gt;&gt;label15.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label15.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label15.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="pictureBoxQuadX.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBoxQuadX.Location" type="System.Drawing.Point, System.Drawing">
<value>71, 285</value>
</data>
<data name="pictureBoxQuadX.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 150</value>
</data>
<data name="pictureBoxQuadX.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="pictureBoxQuadX.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="&gt;&gt;pictureBoxQuadX.Name" xml:space="preserve">
<value>pictureBoxQuadX</value>
</data>
<data name="&gt;&gt;pictureBoxQuadX.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBoxQuadX.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBoxQuadX.ZOrder" xml:space="preserve">
<data name="&gt;&gt;radioButton_Plus.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="pictureBoxQuad.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<data name="radioButton_X.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="radioButton_X.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBoxQuad.Location" type="System.Drawing.Point, System.Drawing">
<value>71, 115</value>
<data name="radioButton_X.Location" type="System.Drawing.Point, System.Drawing">
<value>76, 197</value>
</data>
<data name="pictureBoxQuad.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 150</value>
<data name="radioButton_X.Size" type="System.Drawing.Size, System.Drawing">
<value>14, 13</value>
</data>
<data name="pictureBoxQuad.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
<data name="radioButton_X.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
</data>
<data name="pictureBoxQuad.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
<data name="&gt;&gt;radioButton_X.Name" xml:space="preserve">
<value>radioButton_X</value>
</data>
<data name="&gt;&gt;pictureBoxQuad.Name" xml:space="preserve">
<value>pictureBoxQuad</value>
<data name="&gt;&gt;radioButton_X.Type" xml:space="preserve">
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBoxQuad.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBoxQuad.Parent" xml:space="preserve">
<data name="&gt;&gt;radioButton_X.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBoxQuad.ZOrder" xml:space="preserve">
<value>9</value>
<data name="&gt;&gt;radioButton_X.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="BUT_levelac2.Location" type="System.Drawing.Point, System.Drawing">
<value>269, 38</value>
<data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="BUT_levelac2.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
<data name="label5.Font" type="System.Drawing.Font, System.Drawing">
<value>Microsoft Sans Serif, 12pt</value>
</data>
<data name="BUT_levelac2.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
</data>
<data name="BUT_levelac2.Text" xml:space="preserve">
<value>Level</value>
</data>
<data name="&gt;&gt;BUT_levelac2.Name" xml:space="preserve">
<value>BUT_levelac2</value>
</data>
<data name="&gt;&gt;BUT_levelac2.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4503.13960, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_levelac2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_levelac2.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="pictureBox1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<data name="label5.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>227, 285</value>
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 282</value>
</data>
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 150</value>
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
<value>191, 20</value>
</data>
<data name="pictureBox1.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
<data name="label5.TabIndex" type="System.Int32, mscorlib">
<value>65</value>
</data>
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
<value>18</value>
<data name="label5.Text" xml:space="preserve">
<value>Accelerometer Calibration</value>
</data>
<data name="&gt;&gt;pictureBox1.Name" xml:space="preserve">
<value>pictureBox1</value>
<data name="&gt;&gt;label5.Name" xml:space="preserve">
<value>label5</value>
</data>
<data name="&gt;&gt;pictureBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;label5.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox1.Parent" xml:space="preserve">
<data name="&gt;&gt;label5.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBox1.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="pictureBox2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox2.Location" type="System.Drawing.Point, System.Drawing">
<value>227, 115</value>
</data>
<data name="pictureBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 150</value>
</data>
<data name="pictureBox2.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="pictureBox2.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
</data>
<data name="&gt;&gt;pictureBox2.Name" xml:space="preserve">
<value>pictureBox2</value>
</data>
<data name="&gt;&gt;pictureBox2.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBox2.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="pictureBox3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox3.Location" type="System.Drawing.Point, System.Drawing">
<value>383, 285</value>
</data>
<data name="pictureBox3.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 150</value>
</data>
<data name="pictureBox3.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="pictureBox3.TabIndex" type="System.Int32, mscorlib">
<value>20</value>
</data>
<data name="&gt;&gt;pictureBox3.Name" xml:space="preserve">
<value>pictureBox3</value>
</data>
<data name="&gt;&gt;pictureBox3.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBox3.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="pictureBox4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox4.Location" type="System.Drawing.Point, System.Drawing">
<value>383, 115</value>
</data>
<data name="pictureBox4.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 150</value>
</data>
<data name="pictureBox4.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="pictureBox4.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
</data>
<data name="&gt;&gt;pictureBox4.Name" xml:space="preserve">
<value>pictureBox4</value>
</data>
<data name="&gt;&gt;pictureBox4.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBox4.ZOrder" xml:space="preserve">
<value>3</value>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label1.Font" type="System.Drawing.Font, System.Drawing">
<value>Microsoft Sans Serif, 12pt</value>
</data>
<data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>262, 74</value>
<value>16, 13</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>57, 13</value>
<value>102, 20</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>21</value>
<value>66</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Currently : </value>
<value>Frame Setup</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
@ -394,36 +238,216 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>1</value>
<value>5</value>
</data>
<data name="lbl_frame.AutoSize" type="System.Boolean, mscorlib">
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lbl_frame.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lbl_frame.Location" type="System.Drawing.Point, System.Drawing">
<value>323, 74</value>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>39, 96</value>
</data>
<data name="lbl_frame.Size" type="System.Drawing.Size, System.Drawing">
<value>13, 13</value>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>31, 13</value>
</data>
<data name="lbl_frame.TabIndex" type="System.Int32, mscorlib">
<value>22</value>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>68</value>
</data>
<data name="lbl_frame.Text" xml:space="preserve">
<value>+</value>
<data name="label2.Text" xml:space="preserve">
<value>'Plus'</value>
</data>
<data name="&gt;&gt;lbl_frame.Name" xml:space="preserve">
<value>lbl_frame</value>
<data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value>
</data>
<data name="&gt;&gt;lbl_frame.Type" xml:space="preserve">
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lbl_frame.Parent" xml:space="preserve">
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;lbl_frame.ZOrder" xml:space="preserve">
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>52, 197</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>18, 13</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>69</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>'X'</value>
</data>
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="pictureBoxPlus.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBoxPlus.Location" type="System.Drawing.Point, System.Drawing">
<value>116, 65</value>
</data>
<data name="pictureBoxPlus.Size" type="System.Drawing.Size, System.Drawing">
<value>248, 81</value>
</data>
<data name="pictureBoxPlus.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="pictureBoxPlus.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
</data>
<data name="&gt;&gt;pictureBoxPlus.Name" xml:space="preserve">
<value>pictureBoxPlus</value>
</data>
<data name="&gt;&gt;pictureBoxPlus.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.PictureBoxWithPseudoOpacity, ArdupilotMegaPlanner10, Version=1.1.4581.34461, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;pictureBoxPlus.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBoxPlus.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="pictureBoxX.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBoxX.Location" type="System.Drawing.Point, System.Drawing">
<value>116, 164</value>
</data>
<data name="pictureBoxX.Size" type="System.Drawing.Size, System.Drawing">
<value>248, 85</value>
</data>
<data name="pictureBoxX.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="pictureBoxX.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="&gt;&gt;pictureBoxX.Name" xml:space="preserve">
<value>pictureBoxX</value>
</data>
<data name="&gt;&gt;pictureBoxX.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.PictureBoxWithPseudoOpacity, ArdupilotMegaPlanner10, Version=1.1.4581.34461, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;pictureBoxX.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBoxX.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="BUT_levelac2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="BUT_levelac2.Location" type="System.Drawing.Point, System.Drawing">
<value>378, 318</value>
</data>
<data name="BUT_levelac2.Size" type="System.Drawing.Size, System.Drawing">
<value>102, 23</value>
</data>
<data name="BUT_levelac2.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
</data>
<data name="BUT_levelac2.Text" xml:space="preserve">
<value>Calibrate Now</value>
</data>
<data name="&gt;&gt;BUT_levelac2.Name" xml:space="preserve">
<value>BUT_levelac2</value>
</data>
<data name="&gt;&gt;BUT_levelac2.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4581.34461, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_levelac2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_levelac2.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>85, 323</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>279, 13</value>
</data>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>70</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Level your Multicopter to set default accelerometer offsets</value>
</data>
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="lineSeparator3.Location" type="System.Drawing.Point, System.Drawing">
<value>20, 36</value>
</data>
<data name="lineSeparator3.Size" type="System.Drawing.Size, System.Drawing">
<value>460, 2</value>
</data>
<data name="lineSeparator3.TabIndex" type="System.Int32, mscorlib">
<value>80</value>
</data>
<data name="&gt;&gt;lineSeparator3.Name" xml:space="preserve">
<value>lineSeparator3</value>
</data>
<data name="&gt;&gt;lineSeparator3.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.LineSeparator, ArdupilotMegaPlanner10, Version=1.1.4581.34461, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lineSeparator3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;lineSeparator3.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="lineSeparator2.Location" type="System.Drawing.Point, System.Drawing">
<value>20, 300</value>
</data>
<data name="lineSeparator2.Size" type="System.Drawing.Size, System.Drawing">
<value>460, 2</value>
</data>
<data name="lineSeparator2.TabIndex" type="System.Int32, mscorlib">
<value>81</value>
</data>
<data name="&gt;&gt;lineSeparator2.Name" xml:space="preserve">
<value>lineSeparator2</value>
</data>
<data name="&gt;&gt;lineSeparator2.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.LineSeparator, ArdupilotMegaPlanner10, Version=1.1.4581.34461, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lineSeparator2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;lineSeparator2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -433,12 +457,12 @@
<value>6, 13</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>621, 460</value>
<value>495, 363</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>ConfigAccelerometerCalibrationQuad</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner, Version=1.1.4503.13960, Culture=neutral, PublicKeyToken=null</value>
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -303,6 +303,11 @@
// THR_RATE_IMAX
//
resources.ApplyResources(this.THR_RATE_IMAX, "THR_RATE_IMAX");
this.THR_RATE_IMAX.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.THR_RATE_IMAX.Name = "THR_RATE_IMAX";
//
// THR_RATE_I
@ -896,7 +901,6 @@
this.Controls.Add(this.groupBox24);
this.Controls.Add(this.groupBox25);
this.Name = "ConfigArducopter";
this.Load += new System.EventHandler(this.ConfigArducopter_Load);
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).EndInit();
this.groupBox5.ResumeLayout(false);

View File

@ -12,7 +12,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigArducopter : BackStageViewContentPanel
public partial class ConfigArducopter : UserControl, IActivate
{
Hashtable changes = new Hashtable();
static Hashtable tooltips = new Hashtable();
@ -34,7 +34,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
public string desc;
}
private void ConfigArducopter_Load(object sender, EventArgs e)
public void Activate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
@ -203,6 +203,12 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
thisctl.Minimum = -180;
}
if (thisctl.Name.ToUpper().EndsWith("THR_RATE_IMAX"))
{
thisctl.Maximum = 1000; // is a pwm
thisctl.Minimum = 0;
}
thisctl.Enabled = true;
thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
@ -412,7 +418,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
((Control)sender).Enabled = true;
this.DoLoad(new EventArgs());
this.Activate();
}

View File

@ -135,7 +135,7 @@
<value>myLabel3</value>
</data>
<data name="&gt;&gt;myLabel3.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4564.20854, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.13688, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;myLabel3.Parent" xml:space="preserve">
<value>$this</value>
@ -201,7 +201,7 @@
<value>myLabel2</value>
</data>
<data name="&gt;&gt;myLabel2.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4564.20854, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.13688, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;myLabel2.Parent" xml:space="preserve">
<value>$this</value>
@ -312,7 +312,7 @@
<value>myLabel1</value>
</data>
<data name="&gt;&gt;myLabel1.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4564.20854, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.13688, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;myLabel1.Parent" xml:space="preserve">
<value>$this</value>
@ -2506,7 +2506,7 @@
<value>BUT_writePIDS</value>
</data>
<data name="&gt;&gt;BUT_writePIDS.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4564.20854, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.13688, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_writePIDS.Parent" xml:space="preserve">
<value>$this</value>
@ -2536,7 +2536,7 @@
<value>BUT_rerequestparams</value>
</data>
<data name="&gt;&gt;BUT_rerequestparams.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4564.20854, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.13688, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_rerequestparams.Parent" xml:space="preserve">
<value>$this</value>
@ -2782,6 +2782,6 @@
<value>ConfigArducopter</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner10, Version=1.1.4564.20854, Culture=neutral, PublicKeyToken=null</value>
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -824,7 +824,6 @@
this.Controls.Add(this.groupBox9);
this.Controls.Add(this.groupBox8);
this.Name = "ConfigArduplane";
this.Load += new System.EventHandler(this.ConfigArduplane_Load);
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.THR_FS_VALUE)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.THR_MAX)).EndInit();

View File

@ -12,7 +12,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigArduplane : BackStageViewContentPanel
public partial class ConfigArduplane : UserControl, IActivate
{
Hashtable changes = new Hashtable();
static Hashtable tooltips = new Hashtable();
@ -23,7 +23,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
InitializeComponent();
}
private void ConfigArduplane_Load(object sender, EventArgs e)
public void Activate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
@ -318,7 +318,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
((Control)sender).Enabled = true;
this.DoLoad(new EventArgs());
this.Activate();
}
}

View File

@ -509,7 +509,6 @@
this.Controls.Add(this.groupBox14);
this.Controls.Add(this.groupBox11);
this.Name = "ConfigArdurover";
this.Load += new System.EventHandler(this.ConfigArduplane_Load);
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.THR_FS_VALUE)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.THR_MAX)).EndInit();

View File

@ -12,7 +12,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigArdurover : BackStageViewContentPanel
public partial class ConfigArdurover : UserControl, IActivate
{
Hashtable changes = new Hashtable();
static Hashtable tooltips = new Hashtable();
@ -23,7 +23,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
InitializeComponent();
}
private void ConfigArduplane_Load(object sender, EventArgs e)
public void Activate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
@ -318,7 +318,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
((Control)sender).Enabled = true;
this.DoLoad(new EventArgs());
this.Activate();
}
}

View File

@ -186,7 +186,6 @@
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
@ -204,7 +203,6 @@
this.Controls.Add(this.CMB_batmontype);
this.Controls.Add(this.pictureBox5);
this.Name = "ConfigBatteryMonitoring";
this.Load += new System.EventHandler(this.ConfigBatteryMonitoring_Load);
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();

View File

@ -11,7 +11,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigBatteryMonitoring : BackStageViewContentPanel
public partial class ConfigBatteryMonitoring : UserControl, IActivate, IDeactivate
{
bool startup = false;
@ -278,18 +278,13 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
}
}
private void ConfigBatteryMonitoring_Load(object sender, EventArgs e)
public void Deactivate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
this.Enabled = false;
return;
}
else
{
this.Enabled = true;
timer1.Stop();
}
public void Activate()
{
startup = true;
bool not_supported = false;
if (MainV2.comPort.param["BATT_MONITOR"] != null)
@ -345,6 +340,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
}
startup = false;
timer1.Start();
}
int getIndex(ComboBox ctl, int no)

View File

@ -682,6 +682,6 @@ Then subtract 0.3v from that value and enter it in field #1 at left.
<value>ConfigBatteryMonitoring</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner10, Version=1.1.4564.19603, Culture=neutral, PublicKeyToken=null</value>
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -574,7 +574,6 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
this.Controls.Add(this.pictureBox1);
this.Name = "ConfigCameraStab";
this.Size = new System.Drawing.Size(674, 432);
this.Load += new System.EventHandler(this.ConfigCameraStab_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.presenterBindingSource)).EndInit();

View File

@ -10,7 +10,7 @@ using Transitions;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigCameraStab : BackStageViewContentPanel
public partial class ConfigCameraStab : UserControl, IActivate
{
private ConfigCameraStabPresenter _presenter;
private Transition[] _ErrorTransition;
@ -23,7 +23,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
LBL_Error.Opacity = 0.0F;
}
private void ConfigCameraStab_Load(object sender, EventArgs ev)
public void Activate()
{
_presenter = new ConfigCameraStabPresenter(MainV2.comPort);
presenterBindingSource.DataSource = _presenter;

View File

@ -279,7 +279,6 @@
this.Controls.Add(this.CMB_fmode1);
this.Controls.Add(this.BUT_SaveModes);
this.Name = "ConfigFlightModes";
this.Load += new System.EventHandler(this.ConfigFlightModes_Load);
((System.ComponentModel.ISupportInitialize)(this.currentStateBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -12,7 +12,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigFlightModes : BackStageViewContentPanel
public partial class ConfigFlightModes : UserControl, IActivate, IDeactivate
{
Timer timer = new Timer();
@ -124,18 +124,13 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
Simple6 = 32,
}
private void ConfigFlightModes_Load(object sender, EventArgs e)
public void Deactivate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
this.Enabled = false;
return;
}
else
{
this.Enabled = true;
timer.Stop();
}
public void Activate()
{
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) // APM
{
CB_simple1.Visible = false;

View File

@ -79,7 +79,6 @@
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "ConfigFriendlyParams";
this.Size = new System.Drawing.Size(673, 177);
this.Load += new System.EventHandler(this.ConfigRawParamsV2_Load);
this.ResumeLayout(false);
}

View File

@ -14,7 +14,7 @@ using log4net;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigFriendlyParams : BackStageViewContentPanel
public partial class ConfigFriendlyParams : UserControl, IActivate
{
#region Class Fields
@ -130,7 +130,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void ConfigRawParamsV2_Load(object sender, EventArgs e)
public void Activate()
{
BindParamList();
}
@ -297,6 +297,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
catch (Exception ex) { log.Error(ex); }
}
});
ThemeManager.ApplyThemeTo(this);
}
/// <summary>

View File

@ -191,7 +191,6 @@
this.Controls.Add(this.pictureBox3);
this.Controls.Add(this.pictureBox1);
this.Name = "ConfigHardwareOptions";
this.Load += new System.EventHandler(this.ConfigHardwareOptions_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();

View File

@ -11,7 +11,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigHardwareOptions : BackStageViewContentPanel
public partial class ConfigHardwareOptions : UserControl, IActivate
{
bool startup = false;
@ -233,7 +233,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
catch { CustomMessageBox.Show("Set SONAR_TYPE Failed"); }
}
private void ConfigHardwareOptions_Load(object sender, EventArgs e)
public void Activate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{

View File

@ -16,10 +16,10 @@ using System.Threading;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigPlanner : BackStageViewContentPanel
public partial class ConfigPlanner : UserControl, IActivate
{
private bool startup = false;
List<CultureInfo> languages = new List<CultureInfo>();
private List<CultureInfo> _languages;
public class GCSBitmapInfo
{
@ -422,104 +422,12 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
MainV2.config["CHK_GDIPlus"] = CHK_GDIPlus.Checked.ToString();
}
// This load handler now only contains code that should execute once
// on start up. See Activate() for the remainder
private void ConfigPlanner_Load(object sender, EventArgs e)
{
startup = true;
// setup up camera button states
if (MainV2.cam != null)
{
BUT_videostart.Enabled = false;
CHK_hudshow.Checked = GCSViews.FlightData.myhud.hudon;
}
else
{
BUT_videostart.Enabled = true;
}
// setup speech states
if (MainV2.config["speechenable"] != null)
CHK_enablespeech.Checked = bool.Parse(MainV2.config["speechenable"].ToString());
if (MainV2.config["speechwaypointenabled"] != null)
CHK_speechwaypoint.Checked = bool.Parse(MainV2.config["speechwaypointenabled"].ToString());
if (MainV2.config["speechmodeenabled"] != null)
CHK_speechmode.Checked = bool.Parse(MainV2.config["speechmodeenabled"].ToString());
if (MainV2.config["speechcustomenabled"] != null)
CHK_speechcustom.Checked = bool.Parse(MainV2.config["speechcustomenabled"].ToString());
if (MainV2.config["speechbatteryenabled"] != null)
CHK_speechbattery.Checked = bool.Parse(MainV2.config["speechbatteryenabled"].ToString());
if (MainV2.config["speechaltenabled"] != null)
CHK_speechaltwarning.Checked = bool.Parse(MainV2.config["speechaltenabled"].ToString());
// this can't fail because it set at startup
NUM_tracklength.Value = int.Parse(MainV2.config["NUM_tracklength"].ToString());
// get wps on connect
if (MainV2.config["loadwpsonconnect"] != null)
CHK_loadwponconnect.Checked = bool.Parse(MainV2.config["loadwpsonconnect"].ToString());
// setup other config state
if (MainV2.config["CHK_resetapmonconnect"] != null)
CHK_resetapmonconnect.Checked = bool.Parse(MainV2.config["CHK_resetapmonconnect"].ToString());
CMB_rateattitude.Text = MainV2.cs.rateattitude.ToString();
CMB_rateposition.Text = MainV2.cs.rateposition.ToString();
CMB_raterc.Text = MainV2.cs.raterc.ToString();
CMB_ratestatus.Text = MainV2.cs.ratestatus.ToString();
CMB_ratesensors.Text = MainV2.cs.ratesensors.ToString();
if (MainV2.config["CHK_GDIPlus"] != null)
CHK_GDIPlus.Checked = bool.Parse(MainV2.config["CHK_GDIPlus"].ToString());
if (MainV2.config["CHK_maprotation"] != null)
CHK_maprotation.Checked = bool.Parse(MainV2.config["CHK_maprotation"].ToString());
//set hud color state
string hudcolor = (string)MainV2.config["hudcolor"];
CMB_osdcolor.DataSource = Enum.GetNames(typeof(KnownColor));
if (hudcolor != null)
{
int index = CMB_osdcolor.Items.IndexOf(hudcolor);
CMB_osdcolor.SelectedIndex = index;
}
else
{
int index = CMB_osdcolor.Items.IndexOf("White");
CMB_osdcolor.SelectedIndex = index;
}
// set distance/speed unit states
CMB_distunits.DataSource = Enum.GetNames(typeof(Common.distances));
CMB_speedunits.DataSource = Enum.GetNames(typeof(Common.speeds));
if (MainV2.config["distunits"] != null)
CMB_distunits.Text = MainV2.config["distunits"].ToString();
if (MainV2.config["speedunits"] != null)
CMB_speedunits.Text = MainV2.config["speedunits"].ToString();
// setup language selection
CultureInfo ci = null;
foreach (string name in new string[] { "en-US", "zh-Hans", "zh-TW", "ru-RU", "Fr", "Pl", "it-IT", "es-ES" })
{
ci = CultureInfoEx.GetCultureInfo(name);
if (ci != null)
languages.Add(ci);
}
CMB_language.DisplayMember = "DisplayName";
CMB_language.DataSource = languages;
ci = Thread.CurrentThread.CurrentUICulture;
for (int i = 0; i < languages.Count; i++)
{
if (ci.IsChildOf(languages[i]))
{
CMB_language.SelectedIndex = i;
break;
}
}
//CMB_language.SelectedIndexChanged += CMB_language_SelectedIndexChanged;
startup = false;
}
@ -571,5 +479,94 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
return;
MainV2.config["CHK_maprotation"] = CHK_maprotation.Checked.ToString();
}
// Called every time that this control is made current in the backstage view
public void Activate()
{
startup = true; // flag to ignore changes while we programatically populate controls
CMB_osdcolor.DataSource = Enum.GetNames(typeof(KnownColor));
// set distance/speed unit states
CMB_distunits.DataSource = Enum.GetNames(typeof(Common.distances));
CMB_speedunits.DataSource = Enum.GetNames(typeof(Common.speeds));
// setup language selection
var cultureCodes = new[] { "en-US", "zh-Hans", "zh-TW", "ru-RU", "Fr", "Pl", "it-IT", "es-ES" };
_languages = cultureCodes
.Select(CultureInfoEx.GetCultureInfo)
.Where(c => c != null)
.ToList();
CMB_language.DisplayMember = "DisplayName";
CMB_language.DataSource = _languages;
var currentUiCulture = Thread.CurrentThread.CurrentUICulture;
for (int i = 0; i < _languages.Count; i++)
{
if (currentUiCulture.IsChildOf(_languages[i]))
{
CMB_language.SelectedIndex = i;
break;
}
}
// setup up camera button states
if (MainV2.cam != null)
{
BUT_videostart.Enabled = false;
CHK_hudshow.Checked = GCSViews.FlightData.myhud.hudon;
}
else
{
BUT_videostart.Enabled = true;
}
// setup speech states
SetCheckboxFromConfig("speechenable", CHK_enablespeech);
SetCheckboxFromConfig("speechwaypointenabled", CHK_speechwaypoint);
SetCheckboxFromConfig("speechmodeenabled", CHK_speechmode);
SetCheckboxFromConfig("speechcustomenabled", CHK_speechcustom);
SetCheckboxFromConfig("speechbatteryenabled", CHK_speechbattery);
SetCheckboxFromConfig("speechaltenabled", CHK_speechaltwarning);
// this can't fail because it set at startup
NUM_tracklength.Value = int.Parse(MainV2.config["NUM_tracklength"].ToString());
// get wps on connect
SetCheckboxFromConfig("loadwpsonconnect", CHK_loadwponconnect);
// setup other config state
SetCheckboxFromConfig("CHK_resetapmonconnect", CHK_resetapmonconnect);
CMB_rateattitude.Text = MainV2.cs.rateattitude.ToString();
CMB_rateposition.Text = MainV2.cs.rateposition.ToString();
CMB_raterc.Text = MainV2.cs.raterc.ToString();
CMB_ratestatus.Text = MainV2.cs.ratestatus.ToString();
CMB_ratesensors.Text = MainV2.cs.ratesensors.ToString();
SetCheckboxFromConfig("CHK_GDIPlus", CHK_GDIPlus);
SetCheckboxFromConfig("CHK_maprotation", CHK_maprotation);
//set hud color state
string hudcolor = (string)MainV2.config["hudcolor"];
int index = CMB_osdcolor.Items.IndexOf(hudcolor ?? "White");
CMB_osdcolor.SelectedIndex = index;
if (MainV2.config["distunits"] != null)
CMB_distunits.Text = MainV2.config["distunits"].ToString();
if (MainV2.config["speedunits"] != null)
CMB_speedunits.Text = MainV2.config["speedunits"].ToString();
}
private static void SetCheckboxFromConfig(string configKey, CheckBox chk)
{
if (MainV2.config[configKey] != null)
chk.Checked = bool.Parse(MainV2.config[configKey].ToString());
}
}
}

View File

@ -269,7 +269,6 @@
this.Controls.Add(this.BARyaw);
this.Controls.Add(this.BARroll);
this.Name = "ConfigRadioInput";
this.Load += new System.EventHandler(this.ConfigRadioInput_Load);
this.groupBoxElevons.ResumeLayout(false);
this.groupBoxElevons.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.currentStateBindingSource)).EndInit();

View File

@ -11,7 +11,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigRadioInput : BackStageViewContentPanel
public partial class ConfigRadioInput : UserControl, IActivate, IDeactivate
{
bool startup = false;
bool run = false;
@ -36,10 +36,11 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
// setup rc update
timer.Tick += new EventHandler(timer_Tick);
}
timer.Enabled = true;
timer.Interval = 100;
timer.Start();
public void Deactivate()
{
timer.Stop();
}
void timer_Tick(object sender, EventArgs e)
@ -52,17 +53,11 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
catch { }
}
private void ConfigRadioInput_Load(object sender, EventArgs e)
public void Activate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
this.Enabled = false;
return;
}
else
{
this.Enabled = true;
}
timer.Enabled = true;
timer.Interval = 100;
timer.Start();
startup = true;

View File

@ -151,7 +151,6 @@
this.Controls.Add(this.BUT_load);
this.Controls.Add(this.Params);
this.Name = "ConfigRawParams";
this.Load += new System.EventHandler(this.ConfigRawParams_Load);
((System.ComponentModel.ISupportInitialize)(this.Params)).EndInit();
this.ResumeLayout(false);

View File

@ -11,7 +11,7 @@ using ArdupilotMega.Controls.BackstageView;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigRawParams : BackStageViewContentPanel
public partial class ConfigRawParams : UserControl, IActivate
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -424,7 +424,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
Params.Sort(Params.Columns[0], ListSortDirection.Ascending);
}
private void ConfigRawParams_Load(object sender, EventArgs e)
public void Activate()
{
// read tooltips
if (tooltips.Count == 0)

View File

@ -685,8 +685,6 @@
this.Controls.Add(this.HS3);
this.Controls.Add(this.Gservoloc);
this.Name = "ConfigTradHeli";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ConfigTradHeli_FormClosing);
this.Load += new System.EventHandler(this.ConfigTradHeli_Load);
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox3.ResumeLayout(false);

View File

@ -11,7 +11,7 @@ using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigTradHeli : BackStageViewContentPanel
public partial class ConfigTradHeli : UserControl, IActivate, IDeactivate
{
bool startup = false;
bool inpwmdetect = false;
@ -368,17 +368,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
MainV2.comPort.setParam(((CheckBox)sender).Name, ((CheckBox)sender).Checked == true ? 1.0f : 0.0f);
}
private void ConfigTradHeli_Load(object sender, EventArgs e)
public void Activate()
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
this.Enabled = false;
return;
}
else
{
this.Enabled = true;
}
if (MainV2.comPort.param["H_GYR_ENABLE"] == null)
{
@ -487,8 +478,10 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
}
}
private void ConfigTradHeli_FormClosing(object sender, FormClosingEventArgs e)
public void Deactivate()
{
timer.Stop();
startup = true;
}
}

View File

@ -25,18 +25,22 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
if (MainV2.comPort.BaseStream.IsOpen)
{
AddPagesForConnectedState();
// backstageView.AddSpacer(20);
}
// These pages work when not connected to an APM
AddBackstageViewPage(new ArdupilotMega._3DRradio(), "3DR Radio");
AddBackstageViewPage(new ArdupilotMega.Antenna.Tracker(), "Antenna Tracker");
//backstageView.AddSpacer(15);
AddBackstageViewPage(new ConfigPlanner(), "Planner");
this.backstageView.ActivatePage(backstageView.Pages[0]);
if (!MainV2.comPort.BaseStream.IsOpen)
{
Common.MessageShowAgain("Config Connect", "Please connect (click Connect Button) before using setup!!");
ThemeManager.ApplyThemeTo(this);
Common.MessageShowAgain("Config Connect", @"Please connect (click Connect Button) before using setup.
If you are just setting up 3DR radios, you may continue without connecting.");
}
}
@ -61,8 +65,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
AddBackstageViewPage(new ConfigTradHeli(), "Heli Setup");
var configpanel = new Controls.ConfigPanel();
configpanel.LoadXML("ArduCopterConfig.xml");
var configpanel = new Controls.ConfigPanel(Application.StartupPath + System.IO.Path.DirectorySeparatorChar + "ArduCopterConfig.xml");
AddBackstageViewPage(configpanel, "ArduCopter Pids");
AddBackstageViewPage(new ConfigArducopter(), "ArduCopter Config");
@ -74,8 +77,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
AddBackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level");
var configpanel = new Controls.ConfigPanel();
configpanel.LoadXML("ArduCopterConfig.xml");
var configpanel = new Controls.ConfigPanel(Application.StartupPath + System.IO.Path.DirectorySeparatorChar + "ArduCopterConfig.xml");
AddBackstageViewPage(configpanel, "ArduCopter Pids");
AddBackstageViewPage(new ConfigArducopter(), "ArduCopter Config");
@ -99,9 +101,9 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
AddBackstageViewPage(new ConfigRawParams(), "Parameter List");
}
private void AddBackstageViewPage(BackStageViewContentPanel userControl, string headerText)
private void AddBackstageViewPage(UserControl userControl, string headerText)
{
backstageView.AddPage(new BackstageView.BackstageViewPage(userControl, headerText));
backstageView.AddPage(userControl, headerText);
}

View File

@ -1161,6 +1161,7 @@
this.Controls.Add(this.label6);
this.MinimumSize = new System.Drawing.Size(1008, 461);
this.Name = "FlightData";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FlightData_FormClosing);
this.Load += new System.EventHandler(this.FlightData_Load);
this.Resize += new System.EventHandler(this.FlightData_Resize);
this.ParentChanged += new System.EventHandler(this.FlightData_ParentChanged);

View File

@ -18,13 +18,14 @@ using ZedGraph; // Graphs
using System.Drawing.Drawing2D;
using ArdupilotMega.Controls;
using ArdupilotMega.Utilities;
using ArdupilotMega.Controls.BackstageView;
// written by michael oborne
namespace ArdupilotMega.GCSViews
{
partial class FlightData : MyUserControl
partial class FlightData : MyUserControl, IActivate, IDeactivate
{
ArdupilotMega.IMAVLink comPort = MainV2.comPort;
ArdupilotMega.MAVLink comPort = MainV2.comPort;
public static int threadrun = 0;
StreamWriter swlog;
int tickStart = 0;
@ -196,6 +197,22 @@ namespace ArdupilotMega.GCSViews
catch { }
}
public void Activate()
{
if (CB_tuning.Checked)
ZedGraphTimer.Start();
// SubMainLeft.Panel1.Controls.Clear();
// SubMainLeft.Panel1.Controls.Add(hud1);
}
public void Deactivate()
{
//SubMainLeft.Panel1.Controls.Remove(hud1);
hud1.Size = new System.Drawing.Size(0, 0);
ZedGraphTimer.Stop();
}
void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
// Draw the background of the ListBox control for each item.
@ -223,8 +240,6 @@ namespace ArdupilotMega.GCSViews
private void FlightData_Load(object sender, EventArgs e)
{
MainV2.bs = bindingSource1;
System.Threading.Thread t11 = new System.Threading.Thread(new System.Threading.ThreadStart(mainloop))
{
IsBackground = true,
@ -255,6 +270,8 @@ namespace ArdupilotMega.GCSViews
DateTime tunning = DateTime.Now.AddSeconds(0);
DateTime mapupdate = DateTime.Now.AddSeconds(0);
DateTime vidrec = DateTime.Now.AddSeconds(0);
DateTime waypoints = DateTime.Now.AddSeconds(0);
@ -319,8 +336,6 @@ namespace ArdupilotMega.GCSViews
updatePlayPauseButton(true);
MainV2.comPort.setAPType();
if (comPort.BaseStream.IsOpen)
{
MainV2.comPort.logreadmode = false;
@ -429,45 +444,51 @@ namespace ArdupilotMega.GCSViews
setMapBearing();
}
if (route == null)
{
route = new GMapRoute(trackPoints, "track");
routes.Routes.Add(route);
}
PointLatLng currentloc = new PointLatLng(MainV2.cs.lat, MainV2.cs.lng);
gMapControl1.HoldInvalidation = true;
int cnt = 0;
while (gMapControl1.inOnPaint == true)
{
System.Threading.Thread.Sleep(1);
cnt++;
}
if (trackPoints.Count > int.Parse(MainV2.config["NUM_tracklength"].ToString()))
if (route.Points.Count > int.Parse(MainV2.config["NUM_tracklength"].ToString()))
{
trackPoints.RemoveRange(0, trackPoints.Count - int.Parse(MainV2.config["NUM_tracklength"].ToString()));
// trackPoints.RemoveRange(0, trackPoints.Count - int.Parse(MainV2.config["NUM_tracklength"].ToString()));
route.Points.RemoveRange(0, route.Points.Count - int.Parse(MainV2.config["NUM_tracklength"].ToString()));
}
if (MainV2.cs.lat != 0)
trackPoints.Add(new PointLatLng(MainV2.cs.lat, MainV2.cs.lng));
{
// trackPoints.Add(currentloc);
route.Points.Add(currentloc);
}
// if (CB_tuning.Checked == false) // draw if in view
{
if (MainV2.comPort.logreadmode && MainV2.comPort.logplaybackfile != null)
{
// this is for the pulled wp list from a mavlink logfile
FlightPlanner.pointlist.Clear();
FlightPlanner.pointlist.AddRange(MainV2.comPort.wps);
}
while (gMapControl1.inOnPaint == true)
{
System.Threading.Thread.Sleep(1);
}
updateClearRoutes();
route = new GMapRoute(trackPoints, "track");
//route = new GMapRoute(route.Points, "track");
//track.Stroke = Pens.Red;
//route.Stroke = new Pen(Color.FromArgb(144, Color.Red));
//route.Stroke.Width = 5;
//route.Tag = "track";
routes.Routes.Clear();
routes.Routes.Add(route);
if (waypoints.AddSeconds(10) < DateTime.Now)
@ -475,6 +496,12 @@ namespace ArdupilotMega.GCSViews
//Console.WriteLine("Doing FD WP's");
polygons.Markers.Clear();
if (MainV2.comPort.logreadmode && MainV2.comPort.logplaybackfile != null)
{
FlightPlanner.pointlist.Clear();
FlightPlanner.pointlist.AddRange(MainV2.comPort.wps);
}
foreach (PointLatLngAlt plla in FlightPlanner.pointlist)
{
if (plla == null || plla.Lng == 0 || plla.Lat == 0)
@ -494,29 +521,35 @@ namespace ArdupilotMega.GCSViews
//routes.Polygons.Add(poly);
if (trackPoints.Count > 0)
if (route.Points.Count > 0)
{
PointLatLng currentloc = new PointLatLng(MainV2.cs.lat, MainV2.cs.lng);
// add primary route icon
if (routes.Markers.Count != 1)
{
routes.Markers.Clear();
routes.Markers.Add( new GMapMarkerCross(currentloc));
}
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
{
routes.Markers.Add(new GMapMarkerPlane(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing, MainV2.cs.target_bearing, gMapControl1));
routes.Markers[0] = (new GMapMarkerPlane(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing, MainV2.cs.target_bearing, gMapControl1));
}
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover)
{
routes.Markers.Add(new GMapMarkerRover(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing, MainV2.cs.target_bearing, gMapControl1));
routes.Markers[0] = (new GMapMarkerRover(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing, MainV2.cs.target_bearing, gMapControl1));
}
else
{
routes.Markers.Add(new GMapMarkerQuad(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing));
routes.Markers[0] = (new GMapMarkerQuad(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing));
}
if (trackPoints[trackPoints.Count - 1].Lat != 0 && (DateTime.Now.Second % 4 == 0) && CHK_autopan.Checked)
if (route.Points[route.Points.Count - 1].Lat != 0 && (mapupdate.AddSeconds(3) < DateTime.Now) && CHK_autopan.Checked)
{
updateMapPosition(currentloc);
mapupdate = DateTime.Now;
}
if (trackPoints.Count == 1 && gMapControl1.Zoom == 3) // 3 is the default load zoom
if (route.Points.Count == 1 && gMapControl1.Zoom == 3) // 3 is the default load zoom
{
updateMapPosition(currentloc);
updateMapZoom(17);
@ -539,28 +572,19 @@ namespace ArdupilotMega.GCSViews
private void setMapBearing()
{
this.Invoke((System.Windows.Forms.MethodInvoker)delegate()
this.BeginInvoke((System.Windows.Forms.MethodInvoker)delegate()
{
gMapControl1.Bearing = (int)MainV2.cs.yaw;
});
}
// to prevent cross thread calls while in a draw and exception
private void updateClearRoutes()
{
// not async
this.Invoke((System.Windows.Forms.MethodInvoker)delegate()
{
routes.Markers.Clear();
routes.Routes.Clear();
});
}
private void updatePlayPauseButton(bool playing)
{
if (playing)
{
if (BUT_playlog.Text == "Pause")
return;
this.BeginInvoke((System.Windows.Forms.MethodInvoker)delegate()
{
try
@ -626,8 +650,9 @@ namespace ArdupilotMega.GCSViews
{
try
{
if (tracklog.Visible)
tracklog.Value = (int)(MainV2.comPort.logplaybackfile.BaseStream.Position / (double)MainV2.comPort.logplaybackfile.BaseStream.Length * 100);
if (lbl_logpercent.Visible)
lbl_logpercent.Text = (MainV2.comPort.logplaybackfile.BaseStream.Position / (double)MainV2.comPort.logplaybackfile.BaseStream.Length).ToString("0.00%");
}
catch { }
@ -806,15 +831,20 @@ namespace ArdupilotMega.GCSViews
{
ZedGraphTimer.Stop();
threadrun = 0;
try
{
if (comPort.BaseStream.IsOpen)
{
comPort.Close();
}
}
catch { }
}
private void BUT_clear_track_Click(object sender, EventArgs e)
{
trackPoints.Clear();
if (route !=null)
route.Points.Clear();
}
private void BUT_save_log_Click(object sender, EventArgs e)
@ -1349,7 +1379,7 @@ namespace ArdupilotMega.GCSViews
foreach (Control temp in tabStatus.Controls)
{
temp.DataBindings.Clear();
// temp.DataBindings.Clear();
//temp.Dispose();
}
//tabStatus.Controls.Clear();
@ -1387,10 +1417,14 @@ namespace ArdupilotMega.GCSViews
}
catch { }
if (add)
{
lbl1.Location = new Point(x, y);
lbl1.Size = new System.Drawing.Size(75, 13);
lbl1.Text = field.Name;
lbl1.Name = field.Name;
lbl1.Visible = true;
lbl2.AutoSize = false;
lbl2.Location = new Point(lbl1.Right + 5, y);
@ -1398,10 +1432,10 @@ namespace ArdupilotMega.GCSViews
//if (lbl2.Name == "")
lbl2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource1, field.Name, true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, ""));
lbl2.Name = field.Name + "value";
lbl2.Visible = true;
//lbl2.Text = fieldValue.ToString();
if (add)
{
tabStatus.Controls.Add(lbl1);
tabStatus.Controls.Add(lbl2);
}
@ -1426,7 +1460,9 @@ namespace ArdupilotMega.GCSViews
{
foreach (Control temp in tabStatus.Controls)
{
temp.DataBindings.Clear();
// temp.DataBindings.Clear();
// temp.Dispose();
// tabStatus.Controls.Remove(temp);
}
}
}
@ -1903,5 +1939,6 @@ print 'Roll complete'
{
hud1.batteryon = !hud1.batteryon;
}
}
}

View File

@ -226,7 +226,7 @@
<value>hud1</value>
</data>
<data name="&gt;&gt;hud1.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.HUD, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;hud1.Parent" xml:space="preserve">
<value>SubMainLeft.Panel1</value>
@ -265,7 +265,7 @@
<value>BUT_script</value>
</data>
<data name="&gt;&gt;BUT_script.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_script.Parent" xml:space="preserve">
<value>tabActions</value>
@ -298,7 +298,7 @@
<value>BUT_joystick</value>
</data>
<data name="&gt;&gt;BUT_joystick.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_joystick.Parent" xml:space="preserve">
<value>tabActions</value>
@ -328,7 +328,7 @@
<value>BUT_quickmanual</value>
</data>
<data name="&gt;&gt;BUT_quickmanual.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_quickmanual.Parent" xml:space="preserve">
<value>tabActions</value>
@ -358,7 +358,7 @@
<value>BUT_quickrtl</value>
</data>
<data name="&gt;&gt;BUT_quickrtl.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_quickrtl.Parent" xml:space="preserve">
<value>tabActions</value>
@ -388,7 +388,7 @@
<value>BUT_quickauto</value>
</data>
<data name="&gt;&gt;BUT_quickauto.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_quickauto.Parent" xml:space="preserve">
<value>tabActions</value>
@ -442,7 +442,7 @@
<value>BUT_setwp</value>
</data>
<data name="&gt;&gt;BUT_setwp.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_setwp.Parent" xml:space="preserve">
<value>tabActions</value>
@ -493,7 +493,7 @@
<value>BUT_setmode</value>
</data>
<data name="&gt;&gt;BUT_setmode.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_setmode.Parent" xml:space="preserve">
<value>tabActions</value>
@ -523,7 +523,7 @@
<value>BUT_clear_track</value>
</data>
<data name="&gt;&gt;BUT_clear_track.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_clear_track.Parent" xml:space="preserve">
<value>tabActions</value>
@ -574,7 +574,7 @@
<value>BUT_Homealt</value>
</data>
<data name="&gt;&gt;BUT_Homealt.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_Homealt.Parent" xml:space="preserve">
<value>tabActions</value>
@ -604,7 +604,7 @@
<value>BUT_RAWSensor</value>
</data>
<data name="&gt;&gt;BUT_RAWSensor.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_RAWSensor.Parent" xml:space="preserve">
<value>tabActions</value>
@ -634,7 +634,7 @@
<value>BUTrestartmission</value>
</data>
<data name="&gt;&gt;BUTrestartmission.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUTrestartmission.Parent" xml:space="preserve">
<value>tabActions</value>
@ -664,7 +664,7 @@
<value>BUTactiondo</value>
</data>
<data name="&gt;&gt;BUTactiondo.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUTactiondo.Parent" xml:space="preserve">
<value>tabActions</value>
@ -718,7 +718,7 @@
<value>Gvspeed</value>
</data>
<data name="&gt;&gt;Gvspeed.Type" xml:space="preserve">
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Gvspeed.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -748,7 +748,7 @@
<value>Gheading</value>
</data>
<data name="&gt;&gt;Gheading.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.HSI, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.HSI, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Gheading.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -778,7 +778,7 @@
<value>Galt</value>
</data>
<data name="&gt;&gt;Galt.Type" xml:space="preserve">
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Galt.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -811,7 +811,7 @@
<value>Gspeed</value>
</data>
<data name="&gt;&gt;Gspeed.Type" xml:space="preserve">
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Gspeed.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -895,7 +895,7 @@
<value>lbl_playbackspeed</value>
</data>
<data name="&gt;&gt;lbl_playbackspeed.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_playbackspeed.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -922,7 +922,7 @@
<value>lbl_logpercent</value>
</data>
<data name="&gt;&gt;lbl_logpercent.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_logpercent.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -949,7 +949,7 @@
<value>NUM_playbackspeed</value>
</data>
<data name="&gt;&gt;NUM_playbackspeed.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;NUM_playbackspeed.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -976,7 +976,7 @@
<value>BUT_log2kml</value>
</data>
<data name="&gt;&gt;BUT_log2kml.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_log2kml.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -1030,7 +1030,7 @@
<value>BUT_playlog</value>
</data>
<data name="&gt;&gt;BUT_playlog.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_playlog.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -1057,7 +1057,7 @@
<value>BUT_loadtelem</value>
</data>
<data name="&gt;&gt;BUT_loadtelem.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_loadtelem.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -1246,7 +1246,7 @@
<value>lbl_hdop</value>
</data>
<data name="&gt;&gt;lbl_hdop.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_hdop.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1279,7 +1279,7 @@
<value>lbl_sats</value>
</data>
<data name="&gt;&gt;lbl_sats.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_sats.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1309,7 +1309,7 @@
<value>lbl_winddir</value>
</data>
<data name="&gt;&gt;lbl_winddir.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_winddir.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1339,7 +1339,7 @@
<value>lbl_windvel</value>
</data>
<data name="&gt;&gt;lbl_windvel.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_windvel.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1511,7 +1511,7 @@
<value>gMapControl1</value>
</data>
<data name="&gt;&gt;gMapControl1.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;gMapControl1.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1574,7 +1574,7 @@
<value>TXT_lat</value>
</data>
<data name="&gt;&gt;TXT_lat.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_lat.Parent" xml:space="preserve">
<value>panel1</value>
@ -1631,7 +1631,7 @@
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>panel1</value>
@ -1661,7 +1661,7 @@
<value>TXT_long</value>
</data>
<data name="&gt;&gt;TXT_long.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_long.Parent" xml:space="preserve">
<value>panel1</value>
@ -1691,7 +1691,7 @@
<value>TXT_alt</value>
</data>
<data name="&gt;&gt;TXT_alt.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_alt.Parent" xml:space="preserve">
<value>panel1</value>
@ -1892,7 +1892,7 @@
<value>label6</value>
</data>
<data name="&gt;&gt;label6.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label6.Parent" xml:space="preserve">
<value>$this</value>
@ -1988,6 +1988,6 @@
<value>FlightData</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4580.38577, Culture=neutral, PublicKeyToken=null</value>
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4585.31842, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -111,13 +111,13 @@
this.jumpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.jumpstartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.jumpwPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.createWpCircleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ContextMeasure = new System.Windows.Forms.ToolStripMenuItem();
this.rotateMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.polygonToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addPolygonPointToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
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();
@ -126,6 +126,7 @@
this.setReturnLocationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadFromFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clearMissionToolStripMenuItem = 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();
@ -721,12 +722,13 @@
this.deleteWPToolStripMenuItem,
this.loiterToolStripMenuItem,
this.jumpToolStripMenuItem,
this.createWpCircleToolStripMenuItem,
this.toolStripSeparator1,
this.ContextMeasure,
this.rotateMapToolStripMenuItem,
this.polygonToolStripMenuItem,
this.clearMissionToolStripMenuItem,
this.geoFenceToolStripMenuItem});
this.geoFenceToolStripMenuItem,
this.clearMissionToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1");
//
@ -783,6 +785,12 @@
resources.ApplyResources(this.jumpwPToolStripMenuItem, "jumpwPToolStripMenuItem");
this.jumpwPToolStripMenuItem.Click += new System.EventHandler(this.jumpwPToolStripMenuItem_Click);
//
// createWpCircleToolStripMenuItem
//
this.createWpCircleToolStripMenuItem.Name = "createWpCircleToolStripMenuItem";
resources.ApplyResources(this.createWpCircleToolStripMenuItem, "createWpCircleToolStripMenuItem");
this.createWpCircleToolStripMenuItem.Click += new System.EventHandler(this.createWpCircleToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
@ -820,12 +828,6 @@
resources.ApplyResources(this.clearPolygonToolStripMenuItem, "clearPolygonToolStripMenuItem");
this.clearPolygonToolStripMenuItem.Click += new System.EventHandler(this.clearPolygonToolStripMenuItem_Click);
//
// clearMissionToolStripMenuItem
//
this.clearMissionToolStripMenuItem.Name = "clearMissionToolStripMenuItem";
resources.ApplyResources(this.clearMissionToolStripMenuItem, "clearMissionToolStripMenuItem");
this.clearMissionToolStripMenuItem.Click += new System.EventHandler(this.clearMissionToolStripMenuItem_Click);
//
// geoFenceToolStripMenuItem
//
this.geoFenceToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -879,6 +881,12 @@
resources.ApplyResources(this.saveToFileToolStripMenuItem, "saveToFileToolStripMenuItem");
this.saveToFileToolStripMenuItem.Click += new System.EventHandler(this.saveToFileToolStripMenuItem_Click);
//
// clearMissionToolStripMenuItem
//
this.clearMissionToolStripMenuItem.Name = "clearMissionToolStripMenuItem";
resources.ApplyResources(this.clearMissionToolStripMenuItem, "clearMissionToolStripMenuItem");
this.clearMissionToolStripMenuItem.Click += new System.EventHandler(this.clearMissionToolStripMenuItem_Click);
//
// trackBar1
//
resources.ApplyResources(this.trackBar1, "trackBar1");
@ -911,7 +919,6 @@
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
@ -923,6 +930,7 @@
this.Controls.Add(this.panelBASE);
this.MinimumSize = new System.Drawing.Size(1008, 461);
this.Name = "FlightPlanner";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FlightPlanner_FormClosing);
this.Load += new System.EventHandler(this.Planner_Load);
this.Resize += new System.EventHandler(this.Planner_Resize);
((System.ComponentModel.ISupportInitialize)(this.Commands)).EndInit();
@ -1037,5 +1045,6 @@
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem GeoFenceuploadToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem createWpCircleToolStripMenuItem;
}
}

View File

@ -23,11 +23,12 @@ using SharpKml.Base;
using SharpKml.Dom;
using ArdupilotMega.Controls;
using ArdupilotMega.Utilities;
using ArdupilotMega.Controls.BackstageView;
namespace ArdupilotMega.GCSViews
{
partial class FlightPlanner : MyUserControl
partial class FlightPlanner : MyUserControl, IDeactivate
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
int selectedrow = 0;
@ -697,6 +698,8 @@ namespace ArdupilotMega.GCSViews
panelMap_Resize(null, null);
writeKML();
timer1.Start();
}
void parser_ElementAdded(object sender, SharpKml.Base.ElementEventArgs e)
@ -1223,7 +1226,7 @@ namespace ArdupilotMega.GCSViews
try
{
IMAVLink port = MainV2.comPort;
MAVLink port = MainV2.comPort;
if (!port.BaseStream.IsOpen)
{
@ -1256,12 +1259,13 @@ namespace ArdupilotMega.GCSViews
catch (Exception ex) { error = 1; CustomMessageBox.Show("Error : " + ex.ToString()); }
try
{
this.BeginInvoke((MethodInvoker)delegate()
this.Invoke((MethodInvoker)delegate()
{
if (error == 0)
{
try
{
log.Info("Process " + cmds.Count);
processToScreen(cmds);
}
catch (Exception exx) { log.Info(exx.ToString()); }
@ -1332,7 +1336,7 @@ namespace ArdupilotMega.GCSViews
{
try
{
IMAVLink port = MainV2.comPort;
MAVLink port = MainV2.comPort;
if (!port.BaseStream.IsOpen)
{
@ -1430,7 +1434,9 @@ namespace ArdupilotMega.GCSViews
void processToScreen(List<Locationwp> cmds)
{
quickadd = true;
Commands.Rows.Clear();
while (Commands.Rows.Count > 0)
Commands.Rows.RemoveAt(0);
if (cmds.Count == 0)
{
@ -1500,25 +1506,6 @@ namespace ArdupilotMega.GCSViews
}
try
{
DataGridViewTextBoxCell cellhome;
cellhome = Commands.Rows[0].Cells[Lat.Index] as DataGridViewTextBoxCell;
if (cellhome.Value != null)
{
if (cellhome.Value.ToString() != TXT_homelat.Text && cellhome.Value.ToString() != "0")
{
DialogResult dr = CustomMessageBox.Show("Reset Home to loaded coords", "Reset Home Coords", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
TXT_homelat.Text = (double.Parse(cellhome.Value.ToString())).ToString();
cellhome = Commands.Rows[0].Cells[Lon.Index] as DataGridViewTextBoxCell;
TXT_homelng.Text = (double.Parse(cellhome.Value.ToString())).ToString();
cellhome = Commands.Rows[0].Cells[Alt.Index] as DataGridViewTextBoxCell;
TXT_homealt.Text = (double.Parse(cellhome.Value.ToString()) * MainV2.cs.multiplierdist).ToString();
}
}
}
log.Info("Setting wp params");
string hold_alt = ((int)((float)param["ALT_HOLD_RTL"] * MainV2.cs.multiplierdist)).ToString();
@ -1551,6 +1538,26 @@ namespace ArdupilotMega.GCSViews
CHK_holdalt.Checked = Convert.ToBoolean((float)param["ALT_HOLD_RTL"] > 0);
log.Info("param ALT_HOLD_RTL " + CHK_holdalt.Checked.ToString());
DataGridViewTextBoxCell cellhome;
cellhome = Commands.Rows[0].Cells[Lat.Index] as DataGridViewTextBoxCell;
if (cellhome.Value != null)
{
if (cellhome.Value.ToString() != TXT_homelat.Text && cellhome.Value.ToString() != "0")
{
DialogResult dr = CustomMessageBox.Show("Reset Home to loaded coords", "Reset Home Coords", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
TXT_homelat.Text = (double.Parse(cellhome.Value.ToString())).ToString();
cellhome = Commands.Rows[0].Cells[Lon.Index] as DataGridViewTextBoxCell;
TXT_homelng.Text = (double.Parse(cellhome.Value.ToString())).ToString();
cellhome = Commands.Rows[0].Cells[Alt.Index] as DataGridViewTextBoxCell;
TXT_homealt.Text = (double.Parse(cellhome.Value.ToString()) * MainV2.cs.multiplierdist).ToString();
}
}
}
}
catch (Exception ex) { log.Info(ex.ToString()); } // if there is no valid home
@ -2840,7 +2847,8 @@ namespace ArdupilotMega.GCSViews
private void clearMissionToolStripMenuItem_Click(object sender, EventArgs e)
{
Commands.Rows.Clear();
while (Commands.Rows.Count > 0)
Commands.Rows.RemoveAt(0);
selectedrow = 0;
writeKML();
}
@ -3394,5 +3402,66 @@ namespace ArdupilotMega.GCSViews
return (T)formatter.Deserialize(ms);
}
}
private void createWpCircleToolStripMenuItem_Click(object sender, EventArgs e)
{
string RadiusIn = "50";
Common.InputBox("Radius", "Radius", ref RadiusIn);
string Pointsin = "20";
Common.InputBox("Points", "Number of points to generate Circle", ref Pointsin);
int Points = 0;
int Radius = 0;
if (!int.TryParse(RadiusIn, out Radius))
{
CustomMessageBox.Show("Bad Radius");
return;
}
if (!int.TryParse(Pointsin, out Points))
{
CustomMessageBox.Show("Bad Point value");
return;
}
for (double a = 0; a <= 360; a += 360.0f / Points)
{
selectedrow = Commands.Rows.Add();
Commands.Rows[selectedrow].Cells[Command.Index].Value = MAVLink.MAV_CMD.WAYPOINT.ToString();
ChangeColumnHeader(MAVLink.MAV_CMD.WAYPOINT.ToString());
float d = Radius;
float R = 6371000;
var lat2 = Math.Asin(Math.Sin(end.Lat * deg2rad) * Math.Cos(d / R) +
Math.Cos(end.Lat * deg2rad) * Math.Sin(d / R) * Math.Cos(a * deg2rad));
var lon2 = end.Lng * deg2rad + Math.Atan2(Math.Sin(a * deg2rad) * Math.Sin(d / R) * Math.Cos(end.Lat * deg2rad),
Math.Cos(d / R) - Math.Sin(end.Lat * deg2rad) * Math.Sin(lat2));
PointLatLng pll = new PointLatLng(lat2 * rad2deg, lon2 * rad2deg);
setfromGE(pll.Lat, pll.Lng, (int)float.Parse(TXT_DefaultAlt.Text));
}
//drawnpolygon.Points.Add(new PointLatLng(start.Lat, start.Lng));
}
public void Deactivate()
{
timer1.Stop();
}
private void FlightPlanner_FormClosing(object sender, FormClosingEventArgs e)
{
timer1.Stop();
}
}
}

View File

@ -556,7 +556,7 @@
<value>BUT_write</value>
</data>
<data name="&gt;&gt;BUT_write.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_write.Parent" xml:space="preserve">
<value>panel5</value>
@ -583,7 +583,7 @@
<value>BUT_read</value>
</data>
<data name="&gt;&gt;BUT_read.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_read.Parent" xml:space="preserve">
<value>panel5</value>
@ -610,7 +610,7 @@
<value>SaveFile</value>
</data>
<data name="&gt;&gt;SaveFile.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;SaveFile.Parent" xml:space="preserve">
<value>panel5</value>
@ -637,7 +637,7 @@
<value>BUT_loadwpfile</value>
</data>
<data name="&gt;&gt;BUT_loadwpfile.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_loadwpfile.Parent" xml:space="preserve">
<value>panel5</value>
@ -1261,7 +1261,7 @@
<value>BUT_loadkml</value>
</data>
<data name="&gt;&gt;BUT_loadkml.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_loadkml.Parent" xml:space="preserve">
<value>panelWaypoints</value>
@ -1291,7 +1291,7 @@
<value>BUT_zoomto</value>
</data>
<data name="&gt;&gt;BUT_zoomto.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_zoomto.Parent" xml:space="preserve">
<value>panelWaypoints</value>
@ -1321,7 +1321,7 @@
<value>BUT_Camera</value>
</data>
<data name="&gt;&gt;BUT_Camera.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_Camera.Parent" xml:space="preserve">
<value>panelWaypoints</value>
@ -1351,7 +1351,7 @@
<value>BUT_grid</value>
</data>
<data name="&gt;&gt;BUT_grid.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_grid.Parent" xml:space="preserve">
<value>panelWaypoints</value>
@ -1381,7 +1381,7 @@
<value>BUT_Prefetch</value>
</data>
<data name="&gt;&gt;BUT_Prefetch.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_Prefetch.Parent" xml:space="preserve">
<value>panelWaypoints</value>
@ -1411,7 +1411,7 @@
<value>button1</value>
</data>
<data name="&gt;&gt;button1.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;button1.Parent" xml:space="preserve">
<value>panelWaypoints</value>
@ -1441,7 +1441,7 @@
<value>BUT_Add</value>
</data>
<data name="&gt;&gt;BUT_Add.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_Add.Parent" xml:space="preserve">
<value>panelWaypoints</value>
@ -1647,6 +1647,12 @@
<data name="jumpToolStripMenuItem.Text" xml:space="preserve">
<value>Jump</value>
</data>
<data name="createWpCircleToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>167, 22</value>
</data>
<data name="createWpCircleToolStripMenuItem.Text" xml:space="preserve">
<value>Create Wp Circle</value>
</data>
<data name="toolStripSeparator1.Size" type="System.Drawing.Size, System.Drawing">
<value>164, 6</value>
</data>
@ -1680,12 +1686,6 @@
<data name="polygonToolStripMenuItem.Text" xml:space="preserve">
<value>Draw Polygon</value>
</data>
<data name="clearMissionToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>167, 22</value>
</data>
<data name="clearMissionToolStripMenuItem.Text" xml:space="preserve">
<value>Clear Mission</value>
</data>
<data name="toolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>177, 22</value>
</data>
@ -1731,8 +1731,14 @@
<data name="geoFenceToolStripMenuItem.Text" xml:space="preserve">
<value>Geo-Fence</value>
</data>
<data name="clearMissionToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>167, 22</value>
</data>
<data name="clearMissionToolStripMenuItem.Text" xml:space="preserve">
<value>Clear Mission</value>
</data>
<data name="contextMenuStrip1.Size" type="System.Drawing.Size, System.Drawing">
<value>168, 208</value>
<value>168, 230</value>
</data>
<data name="&gt;&gt;contextMenuStrip1.Name" xml:space="preserve">
<value>contextMenuStrip1</value>
@ -1898,7 +1904,7 @@
<value>MainMap</value>
</data>
<data name="&gt;&gt;MainMap.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.myGMAP, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;MainMap.Parent" xml:space="preserve">
<value>panelMap</value>
@ -1928,7 +1934,7 @@
<value>trackBar1</value>
</data>
<data name="&gt;&gt;trackBar1.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyTrackBar, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;trackBar1.Parent" xml:space="preserve">
<value>panelMap</value>
@ -2161,6 +2167,12 @@
<data name="&gt;&gt;jumpwPToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;createWpCircleToolStripMenuItem.Name" xml:space="preserve">
<value>createWpCircleToolStripMenuItem</value>
</data>
<data name="&gt;&gt;createWpCircleToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator1.Name" xml:space="preserve">
<value>toolStripSeparator1</value>
</data>
@ -2197,12 +2209,6 @@
<data name="&gt;&gt;clearPolygonToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;clearMissionToolStripMenuItem.Name" xml:space="preserve">
<value>clearMissionToolStripMenuItem</value>
</data>
<data name="&gt;&gt;clearMissionToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;geoFenceToolStripMenuItem.Name" xml:space="preserve">
<value>geoFenceToolStripMenuItem</value>
</data>
@ -2251,6 +2257,12 @@
<data name="&gt;&gt;saveToFileToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;clearMissionToolStripMenuItem.Name" xml:space="preserve">
<value>clearMissionToolStripMenuItem</value>
</data>
<data name="&gt;&gt;clearMissionToolStripMenuItem.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolTip1.Name" xml:space="preserve">
<value>toolTip1</value>
</data>
@ -2267,6 +2279,6 @@
<value>FlightPlanner</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4579.33184, Culture=neutral, PublicKeyToken=null</value>
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4582.39185, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -40,7 +40,6 @@
this.TXT_pitch = new ArdupilotMega.Controls.MyLabel();
this.TXT_heading = new ArdupilotMega.Controls.MyLabel();
this.TXT_wpdist = new ArdupilotMega.Controls.MyLabel();
this.currentStateBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.TXT_bererror = new ArdupilotMega.Controls.MyLabel();
this.TXT_alterror = new ArdupilotMega.Controls.MyLabel();
this.TXT_lat = new ArdupilotMega.Controls.MyLabel();
@ -114,7 +113,6 @@
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.RAD_JSBSim = new System.Windows.Forms.RadioButton();
this.CHK_xplane10 = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.currentStateBindingSource)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
@ -200,10 +198,6 @@
this.TXT_wpdist.Name = "TXT_wpdist";
this.TXT_wpdist.resize = false;
//
// currentStateBindingSource
//
this.currentStateBindingSource.DataSource = typeof(ArdupilotMega.CurrentState);
//
// TXT_bererror
//
resources.ApplyResources(this.TXT_bererror, "TXT_bererror");
@ -743,8 +737,8 @@
this.Controls.Add(this.CHKREV_pitch);
this.Controls.Add(this.CHKREV_roll);
this.Name = "Simulation";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Simulation_FormClosing);
this.Load += new System.EventHandler(this.Simulation_Load);
((System.ComponentModel.ISupportInitialize)(this.currentStateBindingSource)).EndInit();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
@ -833,7 +827,6 @@
private ArdupilotMega.Controls.MyLabel TXT_yaw;
private ArdupilotMega.Controls.MyButton but_advsettings;
private System.Windows.Forms.CheckBox chkSensor;
private System.Windows.Forms.BindingSource currentStateBindingSource;
private System.Windows.Forms.CheckBox CHK_quad;
private ArdupilotMega.Controls.MyButton BUT_startfgquad;
private ArdupilotMega.Controls.MyButton BUT_startfgplane;

View File

@ -22,7 +22,7 @@ namespace ArdupilotMega.GCSViews
public partial class Simulation : MyUserControl
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
IMAVLink comPort = MainV2.comPort;
MAVLink comPort = MainV2.comPort;
UdpClient XplanesSEND;
UdpClient MavLink;
Socket SimulatorRECV;
@ -263,6 +263,8 @@ namespace ArdupilotMega.GCSViews
private void Simulation_Load(object sender, EventArgs e)
{
timer_servo_graph.Stop();
GPSrate.SelectedIndex = 2;
xmlconfig(false);
@ -725,7 +727,7 @@ namespace ArdupilotMega.GCSViews
/// <param name="data">Packet</param>
/// <param name="receviedbytes">Length</param>
/// <param name="comPort">Com Port</param>
private void RECVprocess(byte[] data, int receviedbytes, ArdupilotMega.IMAVLink comPort)
private void RECVprocess(byte[] data, int receviedbytes, ArdupilotMega.MAVLink comPort)
{
#if MAVLINK10
ArdupilotMega.MAVLink.mavlink_hil_state_t hilstate = new ArdupilotMega.MAVLink.mavlink_hil_state_t();
@ -2190,5 +2192,10 @@ namespace ArdupilotMega.GCSViews
CHKgraphthrottle.Visible = false;
}
}
private void Simulation_FormClosing(object sender, FormClosingEventArgs e)
{
timer_servo_graph.Stop();
}
}
}

View File

@ -261,7 +261,7 @@
<value>ConnectComPort</value>
</data>
<data name="&gt;&gt;ConnectComPort.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;ConnectComPort.Parent" xml:space="preserve">
<value>panel5</value>
@ -309,7 +309,7 @@
<value>TXT_roll</value>
</data>
<data name="&gt;&gt;TXT_roll.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_roll.Parent" xml:space="preserve">
<value>panel2</value>
@ -330,7 +330,7 @@
<value>TXT_pitch</value>
</data>
<data name="&gt;&gt;TXT_pitch.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_pitch.Parent" xml:space="preserve">
<value>panel2</value>
@ -351,7 +351,7 @@
<value>TXT_heading</value>
</data>
<data name="&gt;&gt;TXT_heading.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_heading.Parent" xml:space="preserve">
<value>panel2</value>
@ -372,7 +372,7 @@
<value>TXT_wpdist</value>
</data>
<data name="&gt;&gt;TXT_wpdist.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_wpdist.Parent" xml:space="preserve">
<value>panel4</value>
@ -380,9 +380,6 @@
<data name="&gt;&gt;TXT_wpdist.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<metadata name="currentStateBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 17</value>
</metadata>
<data name="TXT_bererror.Location" type="System.Drawing.Point, System.Drawing">
<value>75, 50</value>
</data>
@ -396,7 +393,7 @@
<value>TXT_bererror</value>
</data>
<data name="&gt;&gt;TXT_bererror.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_bererror.Parent" xml:space="preserve">
<value>panel4</value>
@ -417,7 +414,7 @@
<value>TXT_alterror</value>
</data>
<data name="&gt;&gt;TXT_alterror.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_alterror.Parent" xml:space="preserve">
<value>panel4</value>
@ -438,7 +435,7 @@
<value>TXT_lat</value>
</data>
<data name="&gt;&gt;TXT_lat.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_lat.Parent" xml:space="preserve">
<value>panel1</value>
@ -459,7 +456,7 @@
<value>TXT_long</value>
</data>
<data name="&gt;&gt;TXT_long.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_long.Parent" xml:space="preserve">
<value>panel1</value>
@ -480,7 +477,7 @@
<value>TXT_alt</value>
</data>
<data name="&gt;&gt;TXT_alt.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_alt.Parent" xml:space="preserve">
<value>panel1</value>
@ -504,7 +501,7 @@
<value>SaveSettings</value>
</data>
<data name="&gt;&gt;SaveSettings.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;SaveSettings.Parent" xml:space="preserve">
<value>$this</value>
@ -588,7 +585,7 @@
<value>TXT_servoroll</value>
</data>
<data name="&gt;&gt;TXT_servoroll.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_servoroll.Parent" xml:space="preserve">
<value>panel3</value>
@ -609,7 +606,7 @@
<value>TXT_servopitch</value>
</data>
<data name="&gt;&gt;TXT_servopitch.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_servopitch.Parent" xml:space="preserve">
<value>panel3</value>
@ -630,7 +627,7 @@
<value>TXT_servorudder</value>
</data>
<data name="&gt;&gt;TXT_servorudder.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_servorudder.Parent" xml:space="preserve">
<value>panel3</value>
@ -651,7 +648,7 @@
<value>TXT_servothrottle</value>
</data>
<data name="&gt;&gt;TXT_servothrottle.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_servothrottle.Parent" xml:space="preserve">
<value>panel3</value>
@ -675,7 +672,7 @@
<value>label4</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>panel1</value>
@ -699,7 +696,7 @@
<value>label3</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>panel1</value>
@ -723,7 +720,7 @@
<value>label2</value>
</data>
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>panel1</value>
@ -747,7 +744,7 @@
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>panel1</value>
@ -792,7 +789,7 @@
<value>label30</value>
</data>
<data name="&gt;&gt;label30.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label30.Parent" xml:space="preserve">
<value>panel2</value>
@ -813,7 +810,7 @@
<value>TXT_yaw</value>
</data>
<data name="&gt;&gt;TXT_yaw.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_yaw.Parent" xml:space="preserve">
<value>panel2</value>
@ -837,7 +834,7 @@
<value>label11</value>
</data>
<data name="&gt;&gt;label11.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label11.Parent" xml:space="preserve">
<value>panel2</value>
@ -861,7 +858,7 @@
<value>label7</value>
</data>
<data name="&gt;&gt;label7.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label7.Parent" xml:space="preserve">
<value>panel2</value>
@ -885,7 +882,7 @@
<value>label6</value>
</data>
<data name="&gt;&gt;label6.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label6.Parent" xml:space="preserve">
<value>panel2</value>
@ -909,7 +906,7 @@
<value>label5</value>
</data>
<data name="&gt;&gt;label5.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label5.Parent" xml:space="preserve">
<value>panel2</value>
@ -954,7 +951,7 @@
<value>label8</value>
</data>
<data name="&gt;&gt;label8.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label8.Parent" xml:space="preserve">
<value>panel4</value>
@ -978,7 +975,7 @@
<value>label9</value>
</data>
<data name="&gt;&gt;label9.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label9.Parent" xml:space="preserve">
<value>panel4</value>
@ -1002,7 +999,7 @@
<value>label10</value>
</data>
<data name="&gt;&gt;label10.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label10.Parent" xml:space="preserve">
<value>panel4</value>
@ -1026,7 +1023,7 @@
<value>label16</value>
</data>
<data name="&gt;&gt;label16.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label16.Parent" xml:space="preserve">
<value>panel3</value>
@ -1050,7 +1047,7 @@
<value>label15</value>
</data>
<data name="&gt;&gt;label15.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label15.Parent" xml:space="preserve">
<value>panel3</value>
@ -1074,7 +1071,7 @@
<value>label14</value>
</data>
<data name="&gt;&gt;label14.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label14.Parent" xml:space="preserve">
<value>panel3</value>
@ -1098,7 +1095,7 @@
<value>label13</value>
</data>
<data name="&gt;&gt;label13.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label13.Parent" xml:space="preserve">
<value>panel3</value>
@ -1122,7 +1119,7 @@
<value>label12</value>
</data>
<data name="&gt;&gt;label12.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label12.Parent" xml:space="preserve">
<value>panel3</value>
@ -1167,7 +1164,7 @@
<value>label20</value>
</data>
<data name="&gt;&gt;label20.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label20.Parent" xml:space="preserve">
<value>panel4</value>
@ -1191,7 +1188,7 @@
<value>label19</value>
</data>
<data name="&gt;&gt;label19.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label19.Parent" xml:space="preserve">
<value>panel4</value>
@ -1212,7 +1209,7 @@
<value>TXT_control_mode</value>
</data>
<data name="&gt;&gt;TXT_control_mode.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_control_mode.Parent" xml:space="preserve">
<value>panel4</value>
@ -1233,7 +1230,7 @@
<value>TXT_WP</value>
</data>
<data name="&gt;&gt;TXT_WP.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_WP.Parent" xml:space="preserve">
<value>panel4</value>
@ -1257,7 +1254,7 @@
<value>label18</value>
</data>
<data name="&gt;&gt;label18.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label18.Parent" xml:space="preserve">
<value>panel4</value>
@ -1302,7 +1299,7 @@
<value>label17</value>
</data>
<data name="&gt;&gt;label17.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label17.Parent" xml:space="preserve">
<value>$this</value>
@ -1375,7 +1372,7 @@
<value>label28</value>
</data>
<data name="&gt;&gt;label28.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label28.Parent" xml:space="preserve">
<value>panel6</value>
@ -1399,7 +1396,7 @@
<value>label29</value>
</data>
<data name="&gt;&gt;label29.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label29.Parent" xml:space="preserve">
<value>panel6</value>
@ -1423,7 +1420,7 @@
<value>label27</value>
</data>
<data name="&gt;&gt;label27.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label27.Parent" xml:space="preserve">
<value>panel6</value>
@ -1447,7 +1444,7 @@
<value>label25</value>
</data>
<data name="&gt;&gt;label25.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label25.Parent" xml:space="preserve">
<value>panel6</value>
@ -1495,7 +1492,7 @@
<value>label24</value>
</data>
<data name="&gt;&gt;label24.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label24.Parent" xml:space="preserve">
<value>panel6</value>
@ -1519,7 +1516,7 @@
<value>label23</value>
</data>
<data name="&gt;&gt;label23.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label23.Parent" xml:space="preserve">
<value>panel6</value>
@ -1543,7 +1540,7 @@
<value>label22</value>
</data>
<data name="&gt;&gt;label22.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label22.Parent" xml:space="preserve">
<value>panel6</value>
@ -1567,7 +1564,7 @@
<value>label21</value>
</data>
<data name="&gt;&gt;label21.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label21.Parent" xml:space="preserve">
<value>panel6</value>
@ -1684,7 +1681,7 @@
<value>label26</value>
</data>
<data name="&gt;&gt;label26.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyLabel, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label26.Parent" xml:space="preserve">
<value>$this</value>
@ -1855,7 +1852,7 @@
<value>but_advsettings</value>
</data>
<data name="&gt;&gt;but_advsettings.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;but_advsettings.Parent" xml:space="preserve">
<value>$this</value>
@ -1939,7 +1936,7 @@
<value>BUT_startfgquad</value>
</data>
<data name="&gt;&gt;BUT_startfgquad.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_startfgquad.Parent" xml:space="preserve">
<value>$this</value>
@ -1966,7 +1963,7 @@
<value>BUT_startfgplane</value>
</data>
<data name="&gt;&gt;BUT_startfgplane.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_startfgplane.Parent" xml:space="preserve">
<value>$this</value>
@ -1993,7 +1990,7 @@
<value>BUT_startxplane</value>
</data>
<data name="&gt;&gt;BUT_startxplane.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_startxplane.Parent" xml:space="preserve">
<value>$this</value>
@ -2136,12 +2133,6 @@
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>722, 742</value>
</data>
<data name="&gt;&gt;currentStateBindingSource.Name" xml:space="preserve">
<value>currentStateBindingSource</value>
</data>
<data name="&gt;&gt;currentStateBindingSource.Type" xml:space="preserve">
<value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;timer_servo_graph.Name" xml:space="preserve">
<value>timer_servo_graph</value>
</data>
@ -2158,6 +2149,6 @@
<value>Simulation</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner10, Version=1.1.4582.35218, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -147,10 +147,15 @@ namespace ArdupilotMega.GCSViews
{
threadrun = false;
try
{
if (comPort.IsOpen)
{
comPort.Close();
}
}
catch { } // Exception System.IO.IOException: The specified port does not exist.
System.Threading.Thread.Sleep(400);
MainV2.giveComport = false;

View File

@ -77,6 +77,7 @@
// TXT_status
//
resources.ApplyResources(this.TXT_status, "TXT_status");
this.TXT_status.ForeColor = System.Drawing.Color.Red;
this.TXT_status.Name = "TXT_status";
//
// BUT_redokml

View File

@ -159,7 +159,7 @@
<value>BUT_DLall</value>
</data>
<data name="&gt;&gt;BUT_DLall.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4537.26254, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4583.40805, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_DLall.Parent" xml:space="preserve">
<value>$this</value>
@ -183,7 +183,7 @@
<value>BUT_DLthese</value>
</data>
<data name="&gt;&gt;BUT_DLthese.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4537.26254, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4583.40805, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_DLthese.Parent" xml:space="preserve">
<value>$this</value>
@ -207,7 +207,7 @@
<value>BUT_clearlogs</value>
</data>
<data name="&gt;&gt;BUT_clearlogs.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4537.26254, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4583.40805, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_clearlogs.Parent" xml:space="preserve">
<value>$this</value>
@ -276,7 +276,7 @@
<value>BUT_redokml</value>
</data>
<data name="&gt;&gt;BUT_redokml.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4537.26254, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4583.40805, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_redokml.Parent" xml:space="preserve">
<value>$this</value>
@ -300,7 +300,7 @@
<value>BUT_firstperson</value>
</data>
<data name="&gt;&gt;BUT_firstperson.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4537.26254, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4583.40805, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_firstperson.Parent" xml:space="preserve">
<value>$this</value>
@ -328,7 +328,7 @@
<value>BUT_dumpdf</value>
</data>
<data name="&gt;&gt;BUT_dumpdf.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner, Version=1.1.4537.26254, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4583.40805, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_dumpdf.Parent" xml:space="preserve">
<value>$this</value>

View File

@ -44,7 +44,7 @@ namespace ArdupilotMega
/// <summary>
/// Main Comport interface
/// </summary>
public static IMAVLink comPort = new MAVLink();
public static MAVLink comPort = new MAVLink();
/// <summary>
/// Comport name
/// </summary>
@ -90,10 +90,6 @@ namespace ArdupilotMega
/// </summary>
bool serialThread = false;
/// <summary>
/// unused at this point - potential to move all forms to this single binding source. need to evalutate performance/exception issues
/// </summary>
static internal BindingSource bs;
/// <summary>
/// used for mini https server for websockets/mjpeg video stream, and network link kmls
/// </summary>
private TcpListener listener;
@ -1014,8 +1010,8 @@ namespace ArdupilotMega
int minbytes = 10;
if (MONO)
minbytes = 0;
// if (MONO)
// minbytes = 0;
DateTime speechcustomtime = DateTime.Now;
@ -1081,8 +1077,7 @@ namespace ArdupilotMega
MainV2.cs.linkqualitygcs = (ushort)(MainV2.cs.linkqualitygcs * 0.8f);
linkqualitytime = DateTime.Now;
int fixme;
//GCSViews.FlightData.myhud.Invalidate();
GCSViews.FlightData.myhud.Invalidate();
}
}
@ -1116,16 +1111,19 @@ namespace ArdupilotMega
}
}
//Console.WriteLine(DateTime.Now.Millisecond + " " + comPort.BaseStream.BytesToRead);
// Console.WriteLine(DateTime.Now.Millisecond + " " + comPort.BaseStream.BytesToRead);
while (comPort.BaseStream.BytesToRead > minbytes && giveComport == false)
{
//Console.WriteLine(DateTime.Now.Millisecond + " SR1 " + comPort.BaseStream.BytesToRead );
comPort.readPacket();
//Console.WriteLine(DateTime.Now.Millisecond + " SR2 " + comPort.BaseStream.BytesToRead);
}
// Console.WriteLine("SR left");
}
catch (Exception e)
{
log.Error("Serial Reader fail :" + e.Message);
log.Error("Serial Reader fail :" + e.ToString());
try
{
comPort.Close();
@ -1186,7 +1184,7 @@ namespace ArdupilotMega
private void MainV2_Load(object sender, EventArgs e)
{
MyView.AddScreen(new MainSwitcher.Screen("FlightData",FlightData,true));
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));
@ -1228,7 +1226,8 @@ namespace ArdupilotMega
new Thread(SerialReader)
{
IsBackground = true,
Name = "Main Serial reader"
Name = "Main Serial reader",
Priority = ThreadPriority.AboveNormal
}.Start();
try
@ -1977,7 +1976,7 @@ namespace ArdupilotMega
}
}
catch { }
log.Debug(file + " " + bytes);
// log.Debug(file + " " + bytes);
int len = dataStream.Read(buf1, 0, 1024);
if (len == 0)
break;
@ -2081,11 +2080,9 @@ namespace ArdupilotMega
if (keyData == (Keys.Control | Keys.W)) // test ac config
{
Controls.ConfigPanel cfg = new Controls.ConfigPanel();
Controls.ConfigPanel cfg = new Controls.ConfigPanel(Application.StartupPath + System.IO.Path.DirectorySeparatorChar + "ArduCopterConfig.xml");
cfg.LoadXML("ArduCopterConfig.xml");
//cfg.ShowDialog();
//cfg.Show();
return true;
}

View File

@ -19,7 +19,7 @@ using System.Windows.Forms;
namespace ArdupilotMega
{
public partial class MAVLink: IMAVLink
public partial class MAVLink
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public ICommsSerial BaseStream { get; set; }
@ -703,6 +703,8 @@ namespace ArdupilotMega
DateTime start = DateTime.Now;
DateTime restart = DateTime.Now;
DateTime lastmessage = DateTime.MinValue;
do
{
@ -763,13 +765,15 @@ namespace ArdupilotMega
log.Info(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (par.param_count) + " name: " + paramID);
//Console.WriteLine(DateTime.Now.Millisecond + " gp " + BaseStream.BytesToRead);
modifyParamForDisplay(true, paramID, ref par.param_value);
param[paramID] = (par.param_value);
param_count++;
got.Add(par.param_index);
// if (Progress != null)
// Progress((param.Count * 100) / param_total, "Got param " + paramID);
Console.WriteLine(DateTime.Now.Millisecond + " gp1 " + BaseStream.BytesToRead);
this.frmProgressReporter.UpdateProgressAndStatus((got.Count * 100) / param_total, "Got param " + paramID);
// we have them all - lets escape eq total = 176 index = 0-175
@ -782,6 +786,7 @@ namespace ArdupilotMega
}
//stopwatch.Stop();
//Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);
Console.WriteLine(DateTime.Now.Millisecond + " gp2 " + BaseStream.BytesToRead);
}
} while (got.Count < param_total);
@ -801,14 +806,12 @@ namespace ArdupilotMega
public static void modifyParamForDisplay(bool fromapm, string paramname, ref float value)
{
if (paramname.ToUpper().EndsWith("_IMAX") || paramname.ToUpper().EndsWith("ALT_HOLD_RTL") || paramname.ToUpper().EndsWith("TRIM_ARSPD_CM")
if (paramname.ToUpper().EndsWith("_IMAX") || paramname.ToUpper().EndsWith("ALT_HOLD_RTL") || paramname.ToUpper().EndsWith("APPROACH_ALT") || paramname.ToUpper().EndsWith("TRIM_ARSPD_CM")
|| paramname.ToUpper().EndsWith("XTRK_ANGLE_CD") || paramname.ToUpper().EndsWith("LIM_PITCH_MAX") || paramname.ToUpper().EndsWith("LIM_PITCH_MIN")
|| paramname.ToUpper().EndsWith("LIM_ROLL_CD") || paramname.ToUpper().EndsWith("PITCH_MAX") || paramname.ToUpper().EndsWith("WP_SPEED_MAX"))
{
if (paramname.ToUpper().EndsWith("THR_HOLD_IMAX"))
{
if (paramname.ToUpper().EndsWith("THR_RATE_IMAX") || paramname.ToUpper().EndsWith("THR_HOLD_IMAX"))
return;
}
if (fromapm)
{
@ -2049,7 +2052,7 @@ namespace ArdupilotMega
/// <returns></returns>
public byte[] readPacket()
{
byte[] temp = new byte[300];
byte[] buffer = new byte[300];
int count = 0;
int length = 0;
int readcount = 0;
@ -2073,6 +2076,7 @@ namespace ArdupilotMega
lock (readlock)
{
// Console.WriteLine(DateTime.Now.Millisecond + " SR " + BaseStream.BytesToRead);
while (BaseStream.IsOpen || logreadmode)
{
@ -2104,11 +2108,11 @@ namespace ArdupilotMega
if (oldlogformat)
{
temp = readlogPacket(); //old style log
buffer = readlogPacket(); //old style log
}
else
{
temp = readlogPacketMavlink();
buffer = readlogPacketMavlink();
}
}
else
@ -2126,51 +2130,53 @@ namespace ArdupilotMega
}
// System.Threading.Thread.Sleep(1);
}
//Console.WriteLine(DateTime.Now.Millisecond + " SR1 " + BaseStream.BytesToRead);
if (BaseStream.IsOpen)
{
temp[count] = (byte)BaseStream.ReadByte();
buffer[count] = (byte)BaseStream.ReadByte();
if (rawlogfile != null && rawlogfile.BaseStream.CanWrite)
rawlogfile.Write(temp[count]);
rawlogfile.Write(buffer[count]);
}
}
}
catch (Exception e) { log.Info("MAVLink readpacket read error: " + e.ToString()); break; }
// check if looks like a mavlink packet and check for exclusions and write to console
if (temp[0] != 254 && temp[0] != 'U' || lastbad[0] == 'I' && lastbad[1] == 'M' || lastbad[1] == 'G' || lastbad[1] == 'A') // out of sync "AUTO" "GUIDED" "IMU"
if (buffer[0] != 254 && buffer[0] != 'U' || lastbad[0] == 'I' && lastbad[1] == 'M' || lastbad[1] == 'G' || lastbad[1] == 'A') // out of sync "AUTO" "GUIDED" "IMU"
{
if (temp[0] >= 0x20 && temp[0] <= 127 || temp[0] == '\n' || temp[0] == '\r')
if (buffer[0] >= 0x20 && buffer[0] <= 127 || buffer[0] == '\n' || buffer[0] == '\r')
{
TCPConsole.Write(temp[0]);
Console.Write((char)temp[0]);
TCPConsole.Write(buffer[0]);
Console.Write((char)buffer[0]);
}
_bytesReceivedSubj.OnNext(1);
count = 0;
lastbad[0] = lastbad[1];
lastbad[1] = temp[0];
temp[1] = 0;
lastbad[1] = buffer[0];
buffer[1] = 0;
continue;
}
// reset count on valid packet
readcount = 0;
//Console.WriteLine(DateTime.Now.Millisecond + " SR2 " + BaseStream.BytesToRead);
if (temp[0] == 'U' || temp[0] == 254)
if (buffer[0] == 'U' || buffer[0] == 254)
{
length = temp[1] + 6 + 2 - 2; // data + header + checksum - U - length
length = buffer[1] + 6 + 2 - 2; // data + header + checksum - U - length
if (count >= 5 || logreadmode)
{
if (sysid != 0)
{
if (sysid != temp[3] || compid != temp[4])
if (sysid != buffer[3] || compid != buffer[4])
{
if (temp[3] == '3' && temp[4] == 'D')
if (buffer[3] == '3' && buffer[4] == 'D')
{
// this is a 3dr radio rssi packet
}
else
{
log.InfoFormat("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", temp[3], temp[4], sysid, compid);
log.InfoFormat("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", buffer[3], buffer[4], sysid, compid);
return new byte[0];
}
}
@ -2197,12 +2203,11 @@ namespace ArdupilotMega
}
if (BaseStream.IsOpen)
{
int read = BaseStream.Read(temp, 6, length - 4);
int read = BaseStream.Read(buffer, 6, length - 4);
if (rawlogfile != null && rawlogfile.BaseStream.CanWrite)
{
// write only what we read, temp is the whole packet, so 6-end
rawlogfile.Write(temp, 6, read);
rawlogfile.BaseStream.Flush();
rawlogfile.Write(buffer, 6, read);
}
}
}
@ -2218,11 +2223,13 @@ namespace ArdupilotMega
if (count == 299)
break;
}
//Console.WriteLine(DateTime.Now.Millisecond + " SR3 " + BaseStream.BytesToRead);
}// end readlock
Array.Resize<byte>(ref temp, count);
Array.Resize<byte>(ref buffer, count);
_bytesReceivedSubj.OnNext(temp.Length);
_bytesReceivedSubj.OnNext(buffer.Length);
if (packetlosttimer.AddSeconds(5) < DateTime.Now)
{
@ -2241,34 +2248,34 @@ namespace ArdupilotMega
bpstime = DateTime.Now;
}
bps1 += temp.Length;
bps1 += buffer.Length;
bps = (bps1 + bps2) / 2;
if (temp.Length >= 5 && temp[3] == 255 && logreadmode) // gcs packet
if (buffer.Length >= 5 && buffer[3] == 255 && logreadmode) // gcs packet
{
getWPsfromstream(ref temp);
return temp;// new byte[0];
getWPsfromstream(ref buffer);
return buffer;// new byte[0];
}
ushort crc = MavlinkCRC.crc_calculate(temp, temp.Length - 2);
ushort crc = MavlinkCRC.crc_calculate(buffer, buffer.Length - 2);
if (temp.Length > 5 && temp[0] == 254)
if (buffer.Length > 5 && buffer[0] == 254)
{
crc = MavlinkCRC.crc_accumulate(MAVLINK_MESSAGE_CRCS[temp[5]], crc);
crc = MavlinkCRC.crc_accumulate(MAVLINK_MESSAGE_CRCS[buffer[5]], crc);
}
if (temp.Length > 5 && temp[1] != MAVLINK_MESSAGE_LENGTHS[temp[5]])
if (buffer.Length > 5 && buffer[1] != MAVLINK_MESSAGE_LENGTHS[buffer[5]])
{
if (MAVLINK_MESSAGE_LENGTHS[temp[5]] == 0) // pass for unknown packets
if (MAVLINK_MESSAGE_LENGTHS[buffer[5]] == 0) // pass for unknown packets
{
}
else
{
log.InfoFormat("Mavlink Bad Packet (Len Fail) len {0} pkno {1}", temp.Length, temp[5]);
log.InfoFormat("Mavlink Bad Packet (Len Fail) len {0} pkno {1}", buffer.Length, buffer[5]);
#if MAVLINK10
if (temp.Length == 11 && temp[0] == 'U' && temp[5] == 0){
if (buffer.Length == 11 && buffer[0] == 'U' && buffer[5] == 0){
string message ="Mavlink 0.9 Heartbeat, Please upgrade your AP, This planner is for Mavlink 1.0\n\n";
System.Windows.Forms.CustomMessageBox.Show(message);
throw new Exception(message);
@ -2285,28 +2292,28 @@ namespace ArdupilotMega
}
}
if (temp.Length < 5 || temp[temp.Length - 1] != (crc >> 8) || temp[temp.Length - 2] != (crc & 0xff))
if (buffer.Length < 5 || buffer[buffer.Length - 1] != (crc >> 8) || buffer[buffer.Length - 2] != (crc & 0xff))
{
int packetno = -1;
if (temp.Length > 5)
if (buffer.Length > 5)
{
packetno = temp[5];
packetno = buffer[5];
}
log.InfoFormat("Mavlink Bad Packet (crc fail) len {0} crc {1} pkno {2}", temp.Length, crc, packetno);
log.InfoFormat("Mavlink Bad Packet (crc fail) len {0} crc {1} pkno {2}", buffer.Length, crc, packetno);
return new byte[0];
}
try
{
if ((temp[0] == 'U' || temp[0] == 254) && temp.Length >= temp[1])
if ((buffer[0] == 'U' || buffer[0] == 254) && buffer.Length >= buffer[1])
{
if (temp[3] == '3' && temp[4] == 'D')
if (buffer[3] == '3' && buffer[4] == 'D')
{
}
else
{
byte packetSeqNo = temp[2];
byte packetSeqNo = buffer[2];
int expectedPacketSeqNo = ((recvpacketcount + 1) % 0x100);
if (packetSeqNo != expectedPacketSeqNo)
@ -2340,26 +2347,26 @@ namespace ArdupilotMega
// Console.Write(temp[5] + " " + DateTime.Now.Millisecond + " " + packetspersecond[temp[5]] + " " + (DateTime.Now - packetspersecondbuild[temp[5]]).TotalMilliseconds + " \n");
if (double.IsInfinity(packetspersecond[temp[5]]))
packetspersecond[temp[5]] = 0;
if (double.IsInfinity(packetspersecond[buffer[5]]))
packetspersecond[buffer[5]] = 0;
packetspersecond[temp[5]] = (((1000 / ((DateTime.Now - packetspersecondbuild[temp[5]]).TotalMilliseconds) + packetspersecond[temp[5]]) / 2));
packetspersecond[buffer[5]] = (((1000 / ((DateTime.Now - packetspersecondbuild[buffer[5]]).TotalMilliseconds) + packetspersecond[buffer[5]]) / 2));
packetspersecondbuild[temp[5]] = DateTime.Now;
packetspersecondbuild[buffer[5]] = DateTime.Now;
//Console.WriteLine("Packet {0}",temp[5]);
// store packet history
lock (objlock)
{
packets[temp[5]] = temp;
packets[buffer[5]] = buffer;
}
if (debugmavlink)
DebugPacket(temp);
DebugPacket(buffer);
if (temp[5] == MAVLink.MAVLINK_MSG_ID_STATUSTEXT) // status text
if (buffer[5] == MAVLink.MAVLINK_MSG_ID_STATUSTEXT) // status text
{
string logdata = Encoding.ASCII.GetString(temp, 7, temp.Length - 7);
string logdata = Encoding.ASCII.GetString(buffer, 7, buffer.Length - 7);
int ind = logdata.IndexOf('\0');
if (ind != -1)
logdata = logdata.Substring(0, ind);
@ -2372,7 +2379,7 @@ namespace ArdupilotMega
}
getWPsfromstream(ref temp);
getWPsfromstream(ref buffer);
try
{
@ -2383,8 +2390,12 @@ namespace ArdupilotMega
byte[] datearray = BitConverter.GetBytes((UInt64)((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds * 1000)); //ASCIIEncoding.ASCII.GetBytes(DateTime.Now.ToBinary() + ":");
Array.Reverse(datearray);
logfile.Write(datearray, 0, datearray.Length);
logfile.Write(temp, 0, temp.Length);
logfile.Write(buffer, 0, buffer.Length);
if (buffer[5] == 0) {// flush on heartbeat - 1 seconds
logfile.Flush();
rawlogfile.BaseStream.Flush();
}
}
}
@ -2398,7 +2409,9 @@ namespace ArdupilotMega
// Console.Write((DateTime.Now - start).TotalMilliseconds.ToString("00.000") + "\t" + temp.Length + " \r");
return temp;
// Console.WriteLine(DateTime.Now.Millisecond + " SR4 " + BaseStream.BytesToRead);
return buffer;
}
/// <summary>

View File

@ -34,10 +34,10 @@ namespace ArdupilotMega.Presenter
private CameraAxisProperties _pitchAxis;
private CameraAxisProperties _rollAxis;
private readonly IMAVLink _mavlink;
private readonly MAVLink _mavlink;
private readonly Dictionary<string, string> _errors;
public ConfigCameraStabPresenter(IMAVLink mavlink)
public ConfigCameraStabPresenter(MAVLink mavlink)
{
_mavlink = mavlink;
_errors = new Dictionary<string, string>();

View File

@ -31,10 +31,6 @@ namespace ArdupilotMega
Application.Idle += Application_Idle;
int wt = 0, ct = 0;
ThreadPool.GetMaxThreads(out wt, out ct);
log.Info("Max Threads: " + wt);
//MagCalib.ProcessLog();
//MessageBox.Show("NOTE: This version may break advanced mission scripting");
@ -67,17 +63,7 @@ namespace ArdupilotMega
return;
*/
char[] line = "testtesttesttesttest".ToCharArray();
Delta.delta_encode(ref line);
Delta.delta_decode(ref line);
if (System.Diagnostics.Debugger.IsAttached)
{
// testing
// Utilities.ParameterMetaDataParser.GetParameterInformation();
}
try
{
@ -94,13 +80,19 @@ namespace ArdupilotMega
}
}
static DateTime lastidle = DateTime.Now;
static void Application_Idle(object sender, EventArgs e)
{
//System.Threading.Thread.Sleep(10);
//Console.Write("Idle\n");
System.Threading.Thread.Sleep(20);
if (lastidle.AddMilliseconds(20) < DateTime.Now)
{
Application.DoEvents();
lastidle = DateTime.Now;
}
System.Threading.Thread.Sleep(1);
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)

View File

@ -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.98")]
[assembly: AssemblyFileVersion("1.1.99")]
[assembly: NeutralResourcesLanguageAttribute("")]

View File

@ -177,6 +177,18 @@ namespace ArdupilotMega.Properties {
}
}
public static System.Drawing.Bitmap frames_plus {
get {
object obj = ResourceManager.GetObject("frames_plus", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
public static System.Drawing.Bitmap frames_x {
get {
object obj = ResourceManager.GetObject("frames_x", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
public static System.Drawing.Bitmap Gaugebg {
get {
object obj = ResourceManager.GetObject("Gaugebg", resourceCulture);

View File

@ -1234,11 +1234,17 @@
<data name="rover" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\car.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cameraGimalPitch1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cameraGimalPitch1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cameraGimalRoll1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cameraGimalRoll1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="frames_plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\frames_plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="frames_x" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\frames_x.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -101,6 +101,8 @@
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.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.SPLIT_local.Panel1.SuspendLayout();
this.SPLIT_local.Panel2.SuspendLayout();
this.SPLIT_local.SuspendLayout();
@ -835,10 +837,25 @@
resources.ApplyResources(this.label9, "label9");
this.label9.Name = "label9";
//
// label10
//
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
//
// linkLabel1
//
resources.ApplyResources(this.linkLabel1, "linkLabel1");
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.TabStop = true;
this.toolTip1.SetToolTip(this.linkLabel1, resources.GetString("linkLabel1.ToolTip"));
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// _3DRradio
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.label10);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.BUT_Syncoptions);
@ -942,5 +959,7 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.LinkLabel linkLabel1;
}
}

View File

@ -17,7 +17,7 @@ using System.Text.RegularExpressions;
namespace ArdupilotMega
{
public partial class _3DRradio : BackStageViewContentPanel
public partial class _3DRradio : UserControl
{
public delegate void LogEventHandler(string message, int level = 0);
@ -719,5 +719,14 @@ namespace ArdupilotMega
SPLIT_local.Panel2Collapsed = !CHK_advanced.Checked;
SPLIT_remote.Panel2Collapsed = !CHK_advanced.Checked;
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
CustomMessageBox.Show(@"The 3DR Radios have 2 status LEDs, one red and one green.
green LED blinking - searching for another radio
green LED solid - link is established with another radio
red LED flashing - transmitting data
red LED solid - in firmware update mode");
}
}
}

View File

@ -138,8 +138,11 @@
<value>$this</value>
</data>
<data name="&gt;&gt;Progressbar.ZOrder" xml:space="preserve">
<value>7</value>
<value>9</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="S1.Items" xml:space="preserve">
<value>115</value>
</data>
@ -176,9 +179,6 @@
<data name="S1.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="S1.ToolTip" xml:space="preserve">
<value>Serial baud rate in rounded kbps. So 57 means 57600.
</value>
@ -733,6 +733,9 @@
<data name="&gt;&gt;S7.ZOrder" xml:space="preserve">
<value>14</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="RS7.Location" type="System.Drawing.Point, System.Drawing">
<value>83, 191</value>
</data>
@ -1799,13 +1802,13 @@ which result in a valid packet CRC
<value>BUT_savesettings</value>
</data>
<data name="&gt;&gt;BUT_savesettings.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, 3DRRadio, Version=0.6.4521.12642, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.14832, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_savesettings.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_savesettings.ZOrder" xml:space="preserve">
<value>4</value>
<value>6</value>
</data>
<data name="BUT_getcurrent.Location" type="System.Drawing.Point, System.Drawing">
<value>269, 3</value>
@ -1823,13 +1826,13 @@ which result in a valid packet CRC
<value>BUT_getcurrent</value>
</data>
<data name="&gt;&gt;BUT_getcurrent.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, 3DRRadio, Version=0.6.4521.12642, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.14832, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_getcurrent.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_getcurrent.ZOrder" xml:space="preserve">
<value>5</value>
<value>7</value>
</data>
<data name="lbl_status.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 361</value>
@ -1850,7 +1853,7 @@ which result in a valid packet CRC
<value>$this</value>
</data>
<data name="&gt;&gt;lbl_status.ZOrder" xml:space="preserve">
<value>6</value>
<value>8</value>
</data>
<data name="BUT_upload.Location" type="System.Drawing.Point, System.Drawing">
<value>419, 3</value>
@ -1868,13 +1871,13 @@ which result in a valid packet CRC
<value>BUT_upload</value>
</data>
<data name="&gt;&gt;BUT_upload.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, 3DRRadio, Version=0.6.4521.12642, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.14832, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_upload.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_upload.ZOrder" xml:space="preserve">
<value>8</value>
<value>10</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -2550,7 +2553,7 @@ which result in a valid packet CRC
<value>$this</value>
</data>
<data name="&gt;&gt;CHK_advanced.ZOrder" xml:space="preserve">
<value>3</value>
<value>5</value>
</data>
<data name="BUT_Syncoptions.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
@ -2574,13 +2577,13 @@ which result in a valid packet CRC
<value>BUT_Syncoptions</value>
</data>
<data name="&gt;&gt;BUT_Syncoptions.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.MyButton, 3DRRadio, Version=0.6.4521.12642, Culture=neutral, PublicKeyToken=null</value>
<value>ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4585.14832, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_Syncoptions.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_Syncoptions.ZOrder" xml:space="preserve">
<value>2</value>
<value>4</value>
</data>
<data name="ATI3.Location" type="System.Drawing.Point, System.Drawing">
<value>210, 12</value>
@ -2625,25 +2628,7 @@ which result in a valid packet CRC
<value>$this</value>
</data>
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="label9.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label9.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label9.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 15</value>
</data>
<data name="label9.Size" type="System.Drawing.Size, System.Drawing">
<value>42, 13</value>
</data>
<data name="label9.TabIndex" type="System.Int32, mscorlib">
<value>37</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>Version</value>
<value>3</value>
</data>
<data name="&gt;&gt;label9.Name" xml:space="preserve">
<value>label9</value>
@ -2679,6 +2664,97 @@ which result in a valid packet CRC
<value>$this</value>
</data>
<data name="&gt;&gt;groupBox2.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="label9.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label9.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label9.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 15</value>
</data>
<data name="label9.Size" type="System.Drawing.Size, System.Drawing">
<value>42, 13</value>
</data>
<data name="label9.TabIndex" type="System.Int32, mscorlib">
<value>37</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>Version</value>
</data>
<data name="&gt;&gt;label9.Name" xml:space="preserve">
<value>label9</value>
</data>
<data name="&gt;&gt;label9.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label9.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="&gt;&gt;label9.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="label10.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label10.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label10.Location" type="System.Drawing.Point, System.Drawing">
<value>9, 11</value>
</data>
<data name="label10.Size" type="System.Drawing.Size, System.Drawing">
<value>0, 13</value>
</data>
<data name="label10.TabIndex" type="System.Int32, mscorlib">
<value>82</value>
</data>
<data name="&gt;&gt;label10.Name" xml:space="preserve">
<value>label10</value>
</data>
<data name="&gt;&gt;label10.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label10.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label10.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="linkLabel1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="linkLabel1.Location" type="System.Drawing.Point, System.Drawing">
<value>689, 11</value>
</data>
<data name="linkLabel1.Size" type="System.Drawing.Size, System.Drawing">
<value>63, 13</value>
</data>
<data name="linkLabel1.TabIndex" type="System.Int32, mscorlib">
<value>83</value>
</data>
<data name="linkLabel1.Text" xml:space="preserve">
<value>Status Leds</value>
</data>
<data name="linkLabel1.ToolTip" xml:space="preserve">
<value>The 3DR Radios have 2 status LEDs, one red and one green.
green LED blinking - searching for another radio
green LED solid - link is established with another radio
red LED flashing - transmitting data
red LED solid - in firmware update mode</value>
</data>
<data name="&gt;&gt;linkLabel1.Name" xml:space="preserve">
<value>linkLabel1</value>
</data>
<data name="&gt;&gt;linkLabel1.Type" xml:space="preserve">
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;linkLabel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;linkLabel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -2700,6 +2776,6 @@ which result in a valid packet CRC
<value>_3DRradio</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, 3DRRadio, Version=0.6.4521.12642, Culture=neutral, PublicKeyToken=null</value>
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View File

@ -29,7 +29,7 @@ namespace ArdupilotMega.Utilities
parameterLocations.RemoveAll(String.IsNullOrEmpty);
string sStartupPath = Application.StartupPath;
using (var objXmlTextWriter = new XmlTextWriter(String.Format("{0}\\{1}", sStartupPath, ConfigurationManager.AppSettings["ParameterMetaDataXMLFileName"]), null))
using (var objXmlTextWriter = new XmlTextWriter(String.Format("{0}{1}{2}", Application.StartupPath, Path.DirectorySeparatorChar, ConfigurationManager.AppSettings["ParameterMetaDataXMLFileName"]), null))
{
objXmlTextWriter.Formatting = Formatting.Indented;
objXmlTextWriter.WriteStartDocument();
@ -96,6 +96,7 @@ namespace ArdupilotMega.Utilities
.ForEach(path => path.Value.Split(new []{ ParameterMetaDataConstants.PathDelimeter }, StringSplitOptions.None)
.ForEach(separatedPath =>
{
log.Info("Process "+ node.Key + " : " + separatedPath);
// Match based on the regex defined at the top of this class
Match pathMatch = _parentDirectoryRegex.Match(separatedPath);
if (pathMatch.Success && pathMatch.Groups["Path"] != null && !String.IsNullOrEmpty(pathMatch.Groups["Path"].Value))

View File

@ -21,7 +21,7 @@ namespace ArdupilotMega.Utilities
public void Reload()
{
string paramMetaDataXMLFileName = String.Format("{0}\\{1}", Application.StartupPath, ConfigurationManager.AppSettings["ParameterMetaDataXMLFileName"]);
string paramMetaDataXMLFileName = String.Format("{0}{1}{2}", Application.StartupPath, Path.DirectorySeparatorChar, ConfigurationManager.AppSettings["ParameterMetaDataXMLFileName"]);
try
{
if (File.Exists(paramMetaDataXMLFileName))

View File

@ -105,7 +105,7 @@ namespace ArdupilotMega.Utilities
DomainUpDown txt = (DomainUpDown)ctl;
txt.BorderStyle = BorderStyle.None;
}
else if (ctl.GetType() == typeof(GroupBox))
else if (ctl.GetType() == typeof(GroupBox) || ctl.GetType() == typeof(UserControl))
{
ctl.BackColor = BGColor;
ctl.ForeColor = TextColor;// Color.FromArgb(0xe6, 0xe8, 0xea);

View File

@ -215,13 +215,20 @@ namespace ArdupilotMega
imagetotime = new Hashtable();
//logFile = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM\2011-10-01 11-48 1.log";
TXT_outputlog.AppendText("Read Log\n");
List<string[]> list = readLog(logFile);
TXT_outputlog.AppendText("Log Read\n");
//dirWithImages = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM";
TXT_outputlog.AppendText("Read images\n");
string[] files = Directory.GetFiles(dirWithImages);
TXT_outputlog.AppendText("images read\n");
Document kml = new Document();
StreamWriter sw4 = new StreamWriter(dirWithImages + Path.DirectorySeparatorChar + "loglocation.csv");
@ -242,6 +249,8 @@ namespace ArdupilotMega
int lastmatchindex = 0;
TXT_outputlog.AppendText("start Processing\n");
foreach (string filename in files)
{
if (filename.ToLower().EndsWith(".jpg") && !filename.ToLower().Contains("_geotag"))
@ -277,7 +286,9 @@ namespace ArdupilotMega
if (lastmatchindex > (a))
continue;
//Application.DoEvents();
if (a % 1000 == 0)
Application.DoEvents();
DateTime logdt = startTime.AddMilliseconds(int.Parse(arr[1])).AddSeconds(offsetseconds);
@ -293,6 +304,13 @@ namespace ArdupilotMega
first++;
}
// time has past, logs are in time order
if (photodt < logdt.AddSeconds(-1))
{
lastmatchindex = a;
break;
}
//Console.Write("ph " + dt + " log " + crap + " \r");

View File

@ -277,7 +277,7 @@ namespace ArdupilotMega
}
}
catch { }
Thread.Sleep(500);
Thread.Sleep(1000);
}
}

View File

@ -31,11 +31,11 @@ namespace ArdupilotMega
if (System.Diagnostics.Debugger.IsAttached) {
ArdupilotMega.Controls.OpenGLtest ogl = new Controls.OpenGLtest();
// ArdupilotMega.Controls.OpenGLtest ogl = new Controls.OpenGLtest();
this.Controls.Add(ogl);
// this.Controls.Add(ogl);
ogl.Dock = DockStyle.Fill;
// ogl.Dock = DockStyle.Fill;
}
}