APM Planner 1.1.59

fix possible issue loading stream rates
fix tracker ranges
add more ch6 options
modify mag calib with throttle
This commit is contained in:
Michael Oborne 2012-03-30 06:17:06 +08:00
parent 0efb0e5b4d
commit cc047f2944
20 changed files with 2962 additions and 348 deletions

View File

@ -96,7 +96,7 @@ namespace ArdupilotMega.Antenna
}
public bool Pan(double Angle)
{
{
double range = Math.Abs(PanStartRange - PanEndRange);
// get relative center based on tracking center
@ -110,7 +110,7 @@ namespace ArdupilotMega.Antenna
// conver the angle into a 0-255 value
byte target = (byte)((((PointAtAngle / range) * 2.0) * 127 + centerpos) * _panreverse);
//Console.WriteLine("P " + Angle + " " + target + " " + PointAtAngle);
Console.WriteLine("P " + Angle + " " + target + " " + PointAtAngle);
var buffer = new byte[] { 0xff,PanAddress,target};
ComPort.Write(buffer, 0, buffer.Length);

View File

@ -120,8 +120,8 @@ namespace ArdupilotMega.Antenna
try
{
tracker.PanStartRange = int.Parse(TXT_panrange.Text) / 1 * -1;
tracker.PanEndRange = int.Parse(TXT_panrange.Text) / 1;
tracker.PanStartRange = int.Parse(TXT_panrange.Text) / 2 * -1;
tracker.PanEndRange = int.Parse(TXT_panrange.Text) / 2;
tracker.TrimPan = TRK_pantrim.Value;
tracker.TiltStartRange = int.Parse(TXT_tiltrange.Text) / 2 * -1;

View File

@ -223,6 +223,18 @@
<DependentUpon>Tracker.cs</DependentUpon>
</Compile>
<Compile Include="CodeGen.cs" />
<Compile Include="Controls\BackstageView\BackstageView.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\BackstageView\BackstageView.designer.cs">
<DependentUpon>BackstageView.cs</DependentUpon>
</Compile>
<Compile Include="Controls\BackstageView\BackstageViewButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\BackstageView\BackStageViewMenuPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\CustomMessageBox.cs" />
<Compile Include="Controls\ProgressReporterDialogue.cs">
<SubType>Form</SubType>
@ -230,6 +242,72 @@
<Compile Include="Controls\ProgressReporterDialogue.designer.cs">
<DependentUpon>ProgressReporterDialogue.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigAccelerometerCalibration.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigAccelerometerCalibration.Designer.cs">
<DependentUpon>ConfigAccelerometerCalibration.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigArducopter.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigArducopter.Designer.cs">
<DependentUpon>ConfigArducopter.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigArduplane.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigArduplane.Designer.cs">
<DependentUpon>ConfigArduplane.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigBatteryMonitoring.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigBatteryMonitoring.Designer.cs">
<DependentUpon>ConfigBatteryMonitoring.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigFlightModes.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigFlightModes.Designer.cs">
<DependentUpon>ConfigFlightModes.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigHardwareOptions.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigHardwareOptions.Designer.cs">
<DependentUpon>ConfigHardwareOptions.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigPlanner.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigPlanner.Designer.cs">
<DependentUpon>ConfigPlanner.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigRadioInput.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigRadioInput.Designer.cs">
<DependentUpon>ConfigRadioInput.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigTradHeli.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigTradHeli.Designer.cs">
<DependentUpon>ConfigTradHeli.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\Configuration.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\Configuration.Designer.cs">
<DependentUpon>Configuration.cs</DependentUpon>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigRawParams.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GCSViews\ConfigurationView\ConfigRawParams.Designer.cs">
<DependentUpon>ConfigRawParams.cs</DependentUpon>
</Compile>
<Compile Include="MagCalib.cs" />
<Compile Include="PIDTunning.cs" />
<Compile Include="Radio\3DRradio.cs">
@ -452,9 +530,45 @@
<EmbeddedResource Include="Antenna\Tracker.resx">
<DependentUpon>Tracker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\BackstageView\BackstageView.resx">
<DependentUpon>BackstageView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\ProgressReporterDialogue.resx">
<DependentUpon>ProgressReporterDialogue.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigAccelerometerCalibration.resx">
<DependentUpon>ConfigAccelerometerCalibration.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigArducopter.resx">
<DependentUpon>ConfigArducopter.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigArduplane.resx">
<DependentUpon>ConfigArduplane.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigBatteryMonitoring.resx">
<DependentUpon>ConfigBatteryMonitoring.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigFlightModes.resx">
<DependentUpon>ConfigFlightModes.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigHardwareOptions.resx">
<DependentUpon>ConfigHardwareOptions.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigPlanner.resx">
<DependentUpon>ConfigPlanner.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigRadioInput.resx">
<DependentUpon>ConfigRadioInput.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigRawParams.resx">
<DependentUpon>ConfigRawParams.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\ConfigTradHeli.resx">
<DependentUpon>ConfigTradHeli.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\ConfigurationView\Configuration.resx">
<DependentUpon>Configuration.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Radio\3DRradio.resx">
<DependentUpon>3DRradio.cs</DependentUpon>
</EmbeddedResource>

View File

@ -381,7 +381,12 @@ namespace ArdupilotMega
CH6_NAV_I = 20,
CH6_LOITER_RATE_P = 22,
CH6_LOITER_RATE_D = 23
CH6_LOITER_RATE_D = 23,
CH6_YAW_KI = 24,
CH6_ACRO_KP = 25,
CH6_YAW_RATE_KD = 26,
CH6_LOITER_KI = 27,
CH6_LOITER_RATE_KI = 28
}

View File

@ -0,0 +1,33 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace ArdupilotMega.Controls.BackstageView
{
public class BackStageViewMenuPanel : Panel
{
internal Color GradColor = Color.White;
internal Color PencilBorderColor = Color.White;
private const int GradientWidth = 6;
public BackStageViewMenuPanel()
{
this.SetStyle(ControlStyles.UserPaint, true);
}
protected override void OnPaintBackground(PaintEventArgs pevent)
{
base.OnPaintBackground(pevent);
var rc = new Rectangle(ClientSize.Width - GradientWidth, 0, GradientWidth, this.ClientSize.Height);
using (var brush = new LinearGradientBrush(rc, BackColor, GradColor, LinearGradientMode.Horizontal))
{
pevent.Graphics.FillRectangle(brush, rc);
}
pevent.Graphics.DrawLine(new Pen(PencilBorderColor), Width-1,0,Width-1,Height);
}
}
}

View File

@ -0,0 +1,73 @@
namespace ArdupilotMega.Controls.BackstageView
{
partial class BackstageView
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pnlPages = new System.Windows.Forms.Panel();
this.pnlMenu = new BackStageViewMenuPanel();
this.SuspendLayout();
//
// pnlPages
//
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(147, 0);
this.pnlPages.MinimumSize = new System.Drawing.Size(100, 0);
this.pnlPages.Name = "pnlPages";
this.pnlPages.Size = new System.Drawing.Size(243, 189);
this.pnlPages.TabIndex = 0;
//
// pnlMenu
//
this.pnlMenu.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| 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, 170);
this.pnlMenu.TabIndex = 1;
//
// BackstageView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.Controls.Add(this.pnlMenu);
this.Controls.Add(this.pnlPages);
this.Name = "BackstageView";
this.Size = new System.Drawing.Size(393, 192);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel pnlPages;
private BackStageViewMenuPanel pnlMenu;
}
}

View File

@ -0,0 +1,225 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using ArdupilotMega.Controls.BackstageView;
namespace ArdupilotMega.Controls.BackstageView
{
public partial class BackstageView : UserControl
{
private Color _buttonsAreaBgColor = Color.White;
private Color _buttonsAreaPencilColor = Color.DarkGray;
private Color _selectedTextColor = Color.White;
private Color _unSelectedTextColor = Color.Gray;
private Color _highlightColor1 = Color.DarkBlue;
private Color _highlightColor2 = Color.Blue;
private readonly List<BackstageViewPage> _pages= new List<BackstageViewPage>();
private BackstageViewPage _activePage;
private const int ButtonSpacing = 30;
private const int ButtonHeight = 30;
public BackstageView()
{
InitializeComponent();
this.pnlMenu.Height = this.Height;
this.pnlPages.Height = this.Height;
pnlMenu.BackColor = _buttonsAreaBgColor;
pnlMenu.PencilBorderColor = _buttonsAreaPencilColor;
pnlMenu.GradColor = this.BackColor;
}
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = value;
UpdateButtons();
pnlMenu.GradColor = this.BackColor;
}
}
[Description("Background pencil line color for the content region"), Category("Appearance")]
[DefaultValue(typeof(Color),"DarkGray")]
public Color ButtonsAreaPencilColor
{
get { return _buttonsAreaPencilColor; }
set
{
_buttonsAreaPencilColor = value;
pnlMenu.PencilBorderColor = _buttonsAreaPencilColor;
pnlMenu.Invalidate();
UpdateButtons();
Invalidate();
}
}
[Description("Background color for the buttons region"), Category("Appearance")]
[DefaultValue(typeof(Color),"White")]
public Color ButtonsAreaBgColor
{
get { return _buttonsAreaBgColor; }
set
{
_buttonsAreaBgColor = value;
this.pnlMenu.BackColor = _buttonsAreaBgColor;
pnlMenu.Invalidate();
Invalidate();
}
}
[Description("Color for the selector buttons text"), Category("Appearance")]
[DefaultValue(typeof(Color), "White")]
public Color SelectedTextColor
{
get { return _selectedTextColor; }
set
{
_selectedTextColor = value;
UpdateButtons();
}
}
[Description("Color for the un selected selector buttons text"), Category("Appearance")]
[DefaultValue(typeof(Color), "Gray")]
public Color UnSelectedTextColor
{
get { return _unSelectedTextColor; }
set
{
_unSelectedTextColor = value;
UpdateButtons();
Invalidate();
}
}
[Description("Color selected button background 1"), Category("Appearance")]
[DefaultValue(typeof(Color), "DarkBlue")]
public Color HighlightColor1
{
get { return _highlightColor1; }
set
{
_highlightColor1 = value;
UpdateButtons();
Invalidate();
}
}
[Description("Color selected button background 2"), Category("Appearance")]
[DefaultValue(typeof(Color), "Blue")]
public Color HighlightColor2
{
get { return _highlightColor2; }
set
{
_highlightColor2 = value;
UpdateButtons();
Invalidate();
}
}
private void UpdateButtons()
{
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();
}
}
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;
_pages.Add(page);
CreateLinkButton(page);
this.pnlPages.Controls.Add(page.Page);
if (_activePage == null)
_activePage = page;
ActivatePage(page);
// Todo: set the link button to be selected looking
}
private void CreateLinkButton(BackstageViewPage page)
{
var lnkButton = new BackstageViewButton
{
Text = page.LinkText,
Tag = page,
Top = _pages.IndexOf(page) * ButtonSpacing,
Width = this.pnlMenu.Width,
Height = ButtonHeight,
ContentPageColor = this.BackColor,
PencilBorderColor = _buttonsAreaPencilColor,
SelectedTextColor = _selectedTextColor,
UnSelectedTextColor = _unSelectedTextColor,
HighlightColor1 = _highlightColor1,
HighlightColor2 = _highlightColor2
};
pnlMenu.Controls.Add(lnkButton);
lnkButton.Click += this.ButtonClick;
}
private void ButtonClick(object sender, EventArgs e)
{
var backstageViewButton = ((BackstageViewButton) sender);
var associatedPage = backstageViewButton.Tag as BackstageViewPage;
this.ActivatePage(associatedPage);
}
private void ActivatePage(BackstageViewPage associatedPage)
{
// deactivate the old page
_activePage.Page.Visible = false;
var oldButton = this.pnlMenu.Controls.OfType<BackstageViewButton>().Single(b => b.Tag == _activePage);
oldButton.IsSelected = false;
associatedPage.Page.Visible = true;
var newButton = this.pnlMenu.Controls.OfType<BackstageViewButton>().Single(b => b.Tag == associatedPage);
newButton.IsSelected = true;
_activePage = associatedPage;
}
public class BackstageViewPage
{
public BackstageViewPage(Control page, string linkText)
{
Page = page;
LinkText = linkText;
}
public Control Page { get; private set; }
public string LinkText { get; set; }
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,150 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace ArdupilotMega.Controls.BackstageView
{
public class BackstageViewButton : Control
{
private bool _isSelected;
internal Color ContentPageColor = Color.Gray;
internal Color PencilBorderColor = Color.White;
internal Color SelectedTextColor = Color.White;
internal Color UnSelectedTextColor = Color.Gray;
internal Color HighlightColor1 = Color.DarkBlue;
internal Color HighlightColor2 = Color.Blue;
private bool _isMouseOver;
//internal Color HighlightColor1 = Color.FromArgb(0x94, 0xc1, 0x1f);
//internal Color HighlightColor2 = Color.FromArgb(0xcd, 0xe2, 0x96);
public BackstageViewButton()
{
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.ResizeRedraw, true);
this.BackColor = Color.Transparent;
}
/// <summary>
/// Whether this button should show the selected style
/// </summary>
public bool IsSelected
{
get { return _isSelected; }
set
{
if (_isSelected != value)
{
_isSelected = value;
//this.Parent.Refresh(); // <-- brutal, but works
InvalidateParentForBackground();
this.Invalidate();
}
}
}
// Must be a better way to redraw parent control in the area of
// the button
private void InvalidateParentForBackground()
{
var screenrect = this.RectangleToScreen(this.ClientRectangle);
var rectangleToClient = this.Parent.RectangleToClient(screenrect);
this.Parent.Invalidate(rectangleToClient);
}
protected override void OnPaint(PaintEventArgs pevent)
{
Graphics g = pevent.Graphics;
// Now the little 'arrow' thingy if we are selected and the selected bg grad
if (_isSelected)
{
var rect1 = new Rectangle(0, 0, Width / 2, Height);
var rect2 = new Rectangle(Width / 2, 0, Width, Height);
g.FillRectangle(new LinearGradientBrush(rect1, HighlightColor1, HighlightColor2, LinearGradientMode.Horizontal), rect1);
g.FillRectangle(new LinearGradientBrush(rect2, HighlightColor2, HighlightColor1, LinearGradientMode.Horizontal), rect2);
var butPen = new Pen(HighlightColor1);
g.DrawLine(butPen, 0, 0, Width, 0);
g.DrawLine(butPen, 0, Height - 1, Width, Height - 1);
var arrowBrush = new SolidBrush(this.ContentPageColor);
var midheight = Height / 2;
var arSize = 8;
var arrowPoints = new[]
{
new Point(Width, midheight + arSize),
new Point(Width - arSize, midheight),
new Point(Width, midheight - arSize)
};
g.DrawString(Text, new Font(FontFamily.GenericSansSerif, 10), new SolidBrush(SelectedTextColor), 20, 6);
g.FillPolygon(arrowBrush, arrowPoints);
var pencilBrush = new Pen(this.PencilBorderColor);
g.DrawPolygon(pencilBrush, arrowPoints);
}
else
{
if (_isMouseOver)
{
var brush = new SolidBrush(Color.FromArgb(10, 0xA0, 0xA0, 0xA0));
g.FillRectangle(brush, this.ClientRectangle);
var butPen = new Pen(PencilBorderColor);
g.DrawLine(butPen, 0, 0, Width, 0);
g.DrawLine(butPen, 0, Height - 1, Width, Height - 1);
}
g.DrawString(Text, new Font(FontFamily.GenericSansSerif, 10), new SolidBrush(this.UnSelectedTextColor), 20, 6);
}
}
protected override void OnMouseEnter(EventArgs e)
{
_isMouseOver = true;
base.OnMouseEnter(e);
InvalidateParentForBackground();
this.Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
_isMouseOver = false;
base.OnMouseLeave(e);
InvalidateParentForBackground();
this.Invalidate();
}
// This IS necessary for transparency
protected override CreateParams CreateParams
{
get
{
const int WS_EX_TRANSPARENT = 0x20;
CreateParams cp = base.CreateParams;
cp.ExStyle |= WS_EX_TRANSPARENT;
return cp;
}
}
}
}

View File

@ -201,9 +201,11 @@ namespace ArdupilotMega.GCSViews
}
catch { return; }
}
try
{
comPort.Write("\n\n\n");
}
catch { return; }
while (threadrun)
{
try

View File

@ -1162,6 +1162,8 @@ namespace ArdupilotMega
req.start_stop = 1; // start
req.req_stream_id = id; // id
// send each one twice.
generatePacket(MAVLINK_MSG_ID_REQUEST_DATA_STREAM, req);
generatePacket(MAVLINK_MSG_ID_REQUEST_DATA_STREAM, req);
}

View File

@ -21,7 +21,7 @@ namespace ArdupilotMega
/// <summary>
/// Self contained process tlog and save/display offsets
/// </summary>
public static void ProcessLog()
public static void ProcessLog(int throttleThreshold = 0)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "*.tlog|*.tlog";
@ -40,7 +40,7 @@ namespace ArdupilotMega
{
try
{
double[] ans = getOffsets(openFileDialog1.FileName);
double[] ans = getOffsets(openFileDialog1.FileName, throttleThreshold);
SaveOffsets(ans);
}
@ -53,9 +53,9 @@ namespace ArdupilotMega
/// </summary>
/// <param name="fn">Filename</param>
/// <returns>Offsets</returns>
public static double[] getOffsets(string fn)
public static double[] getOffsets(string fn, int throttleThreshold = 0)
{
// based of tridge's work
// based off tridge's work
string logfile = fn;
// old method
@ -76,6 +76,9 @@ namespace ArdupilotMega
Hashtable filter = new Hashtable();
// track data to use
bool useData = false;
log.Info("Start log: " + DateTime.Now);
MAVLink mine = new MAVLink();
@ -95,6 +98,19 @@ namespace ArdupilotMega
if (packet == null)
continue;
if (packet.GetType() == typeof(MAVLink.__mavlink_vfr_hud_t))
{
if (((MAVLink.__mavlink_vfr_hud_t)packet).throttle >= throttleThreshold)
{
useData = true;
}
else
{
useData = false;
}
}
if (packet.GetType() == typeof(MAVLink.__mavlink_sensor_offsets_t))
{
offset = new Tuple<float, float, float>(
@ -102,7 +118,7 @@ namespace ArdupilotMega
((MAVLink.__mavlink_sensor_offsets_t)packet).mag_ofs_y,
((MAVLink.__mavlink_sensor_offsets_t)packet).mag_ofs_z);
}
else if (packet.GetType() == typeof(MAVLink.__mavlink_raw_imu_t))
else if (packet.GetType() == typeof(MAVLink.__mavlink_raw_imu_t) && useData)
{
int div = 20;

View File

@ -72,6 +72,7 @@ namespace ArdupilotMega
GCSViews.FlightData FlightData;
GCSViews.FlightPlanner FlightPlanner;
GCSViews.Configuration Configuration;
//GCSViews.ConfigurationView.Configuration Configuration;
GCSViews.Simulation Simulation;
GCSViews.Firmware Firmware;
GCSViews.Terminal Terminal;
@ -188,14 +189,14 @@ namespace ArdupilotMega
if (config["CMB_rateattitude"] != null)
MainV2.cs.rateattitude = byte.Parse(config["CMB_rateattitude"].ToString());
if (config["CMB_rateattitude"] != null)
if (config["rateposition"] != null)
MainV2.cs.rateposition = byte.Parse(config["CMB_rateposition"].ToString());
if (config["CMB_rateattitude"] != null)
if (config["CMB_ratestatus"] != null)
MainV2.cs.ratestatus = byte.Parse(config["CMB_ratestatus"].ToString());
if (config["CMB_rateattitude"] != null)
if (config["CMB_raterc"] != null)
MainV2.cs.raterc = byte.Parse(config["CMB_raterc"].ToString());
if (config["CMB_ratesensors"] != null)
MainV2.cs.raterc = byte.Parse(config["CMB_ratesensors"].ToString());
MainV2.cs.ratesensors = byte.Parse(config["CMB_ratesensors"].ToString());
if (config["speechenable"] != null)
MainV2.speechEnable = bool.Parse(config["speechenable"].ToString());
@ -339,6 +340,7 @@ namespace ArdupilotMega
}
Configuration = new GCSViews.Configuration();
//Configuration = new GCSViews.ConfigurationView.Configuration();
UserControl temp = Configuration;

View File

@ -853,6 +853,14 @@ namespace ArdupilotMega
MavlinkInterface.logplaybackfile.Close();
MavlinkInterface.logplaybackfile = null;
try
{
addMagField(ref options);
}
catch (Exception ex) { log.Info(ex.ToString()); }
// custom sort based on packet name
//options.Sort(delegate(string c1, string c2) { return String.Compare(c1.Substring(0,c1.IndexOf('.')),c2.Substring(0,c2.IndexOf('.')));});
@ -872,6 +880,33 @@ namespace ArdupilotMega
return selection;
}
void addMagField(ref List<string> options)
{
string field = "mag_field Custom";
options.Add("Custom.mag_field");
this.data[field] = new PointPairList();
PointPairList list = ((PointPairList)this.data[field]);
PointPairList listx = ((PointPairList)this.data["xmag __mavlink_raw_imu_t"]);
PointPairList listy = ((PointPairList)this.data["ymag __mavlink_raw_imu_t"]);
PointPairList listz = ((PointPairList)this.data["zmag __mavlink_raw_imu_t"]);
//(float)Math.Sqrt(Math.Pow(mx, 2) + Math.Pow(my, 2) + Math.Pow(mz, 2));
for (int a = 0; a < listx.Count; a++)
{
double ans = Math.Sqrt(Math.Pow(listx[a].Y, 2) + Math.Pow(listy[a].Y, 2) + Math.Pow(listz[a].Y, 2));
//Console.WriteLine("{0} {1} {2} {3}", ans, listx[a].Y, listy[a].Y, listz[a].Y);
list.Add(listx[a].X, ans);
}
}
private void AddDataOption(Form selectform, string Name)
{
@ -947,7 +982,7 @@ namespace ArdupilotMega
selection.Remove(((CheckBox)sender).Name);
foreach (var item in zg1.GraphPane.CurveList)
{
if (item.Tag == ((CheckBox)sender).Name)
if (item.Tag.ToString() == ((CheckBox)sender).Name)
{
zg1.GraphPane.CurveList.Remove(item);
break;

View File

@ -34,5 +34,5 @@ using System.Resources;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.58")]
[assembly: AssemblyFileVersion("1.1.59")]
[assembly: NeutralResourcesLanguageAttribute("")]

View File

@ -30,7 +30,7 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Setup));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.Tabs = new System.Windows.Forms.TabControl();
this.tabRadioIn = new System.Windows.Forms.TabPage();
this.groupBoxElevons = new System.Windows.Forms.GroupBox();
this.CHK_mixmode = new System.Windows.Forms.CheckBox();
@ -116,6 +116,9 @@
this.TXT_battcapacity = new System.Windows.Forms.TextBox();
this.CMB_batmontype = new System.Windows.Forms.ComboBox();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.tabArduplane = new System.Windows.Forms.TabPage();
this.label48 = new System.Windows.Forms.Label();
this.BUT_levelplane = new ArdupilotMega.MyButton();
this.tabArducopter = new System.Windows.Forms.TabPage();
this.label28 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
@ -180,7 +183,7 @@
this.tabReset = new System.Windows.Forms.TabPage();
this.BUT_reset = new ArdupilotMega.MyButton();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.tabControl1.SuspendLayout();
this.Tabs.SuspendLayout();
this.tabRadioIn.SuspendLayout();
this.groupBoxElevons.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.currentStateBindingSource)).BeginInit();
@ -193,6 +196,7 @@
this.tabBattery.SuspendLayout();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
this.tabArduplane.SuspendLayout();
this.tabArducopter.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuad)).BeginInit();
@ -208,18 +212,19 @@
this.tabReset.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
// Tabs
//
this.tabControl1.Controls.Add(this.tabRadioIn);
this.tabControl1.Controls.Add(this.tabModes);
this.tabControl1.Controls.Add(this.tabHardware);
this.tabControl1.Controls.Add(this.tabBattery);
this.tabControl1.Controls.Add(this.tabArducopter);
this.tabControl1.Controls.Add(this.tabHeli);
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
this.Tabs.Controls.Add(this.tabRadioIn);
this.Tabs.Controls.Add(this.tabModes);
this.Tabs.Controls.Add(this.tabHardware);
this.Tabs.Controls.Add(this.tabBattery);
this.Tabs.Controls.Add(this.tabArduplane);
this.Tabs.Controls.Add(this.tabArducopter);
this.Tabs.Controls.Add(this.tabHeli);
resources.ApplyResources(this.Tabs, "Tabs");
this.Tabs.Name = "Tabs";
this.Tabs.SelectedIndex = 0;
this.Tabs.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabRadioIn
//
@ -931,6 +936,26 @@
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.TabStop = false;
//
// tabArduplane
//
this.tabArduplane.Controls.Add(this.label48);
this.tabArduplane.Controls.Add(this.BUT_levelplane);
resources.ApplyResources(this.tabArduplane, "tabArduplane");
this.tabArduplane.Name = "tabArduplane";
this.tabArduplane.UseVisualStyleBackColor = true;
//
// label48
//
resources.ApplyResources(this.label48, "label48");
this.label48.Name = "label48";
//
// BUT_levelplane
//
resources.ApplyResources(this.BUT_levelplane, "BUT_levelplane");
this.BUT_levelplane.Name = "BUT_levelplane";
this.BUT_levelplane.UseVisualStyleBackColor = true;
this.BUT_levelplane.Click += new System.EventHandler(this.BUT_levelplane_Click);
//
// tabArducopter
//
this.tabArducopter.Controls.Add(this.label28);
@ -1595,12 +1620,12 @@
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.Tabs);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "Setup";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Setup_FormClosing);
this.Load += new System.EventHandler(this.Setup_Load);
this.tabControl1.ResumeLayout(false);
this.Tabs.ResumeLayout(false);
this.tabRadioIn.ResumeLayout(false);
this.tabRadioIn.PerformLayout();
this.groupBoxElevons.ResumeLayout(false);
@ -1619,6 +1644,8 @@
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
this.tabArduplane.ResumeLayout(false);
this.tabArduplane.PerformLayout();
this.tabArducopter.ResumeLayout(false);
this.tabArducopter.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxQuadX)).EndInit();
@ -1644,7 +1671,7 @@
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabControl Tabs;
private System.Windows.Forms.TabPage tabRadioIn;
private HorizontalProgressBar2 BAR8;
private HorizontalProgressBar2 BAR7;
@ -1794,6 +1821,9 @@
private System.Windows.Forms.RadioButton H1_ENABLE;
private System.Windows.Forms.RadioButton CCPM;
private MyButton BUT_MagCalibration;
private System.Windows.Forms.TabPage tabArduplane;
private System.Windows.Forms.Label label48;
private MyButton BUT_levelplane;
}
}

View File

@ -100,7 +100,7 @@ namespace ArdupilotMega.Setup
fmodelist[no].BackColor = Color.Green;
if (tabControl1.SelectedTab == tabHeli)
if (Tabs.SelectedTab == tabHeli)
{
if (MainV2.comPort.param["HSV_MAN"] == null || MainV2.comPort.param["HSV_MAN"].ToString() == "0")
return;
@ -312,7 +312,7 @@ namespace ArdupilotMega.Setup
int monosux = 0;
monosux *= 5;
if (tabControl1.SelectedTab == tabRadioIn)
if (Tabs.SelectedTab == tabRadioIn)
{
startup = true;
@ -340,7 +340,7 @@ namespace ArdupilotMega.Setup
startup = false;
}
if (tabControl1.SelectedTab == tabModes)
if (Tabs.SelectedTab == tabModes)
{
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) // APM
{
@ -416,7 +416,7 @@ namespace ArdupilotMega.Setup
}
}
if (tabControl1.SelectedTab == tabHardware)
if (Tabs.SelectedTab == tabHardware)
{
startup = true;
@ -442,7 +442,7 @@ namespace ArdupilotMega.Setup
startup = false;
}
if (tabControl1.SelectedTab == tabBattery)
if (Tabs.SelectedTab == tabBattery)
{
startup = true;
bool not_supported = false;
@ -501,7 +501,7 @@ namespace ArdupilotMega.Setup
startup = false;
}
if (tabControl1.SelectedTab == tabArducopter)
if (Tabs.SelectedTab == tabArducopter)
{
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
{
@ -510,7 +510,7 @@ namespace ArdupilotMega.Setup
}
}
if (tabControl1.SelectedTab == tabHeli)
if (Tabs.SelectedTab == tabHeli)
{
if (MainV2.comPort.param["GYR_ENABLE"] == null)
{
@ -1437,7 +1437,7 @@ namespace ArdupilotMega.Setup
timer.Stop();
timer.Dispose();
tabControl1.SelectedIndex = 0;
Tabs.SelectedIndex = 0;
// mono runs validation on all controls on exit. try and skip it
startup = true;
@ -1697,7 +1697,34 @@ namespace ArdupilotMega.Setup
}
else
{
MagCalib.ProcessLog();
string minthro = "30";
Common.InputBox("Min Throttle", "Use only data above this throttle percent.", ref minthro);
int ans = 0;
int.TryParse(minthro, out ans);
MagCalib.ProcessLog(ans);
}
}
private void BUT_levelplane_Click(object sender, EventArgs e)
{
try
{
MainV2.comPort.setParam("MANUAL_LEVEL",1);
#if MAVLINK10
int fixme; // needs to be accel only
MainV2.comPort.doCommand(MAVLink.MAV_CMD.PREFLIGHT_CALIBRATION,1,1,1,1,1,1,1);
#else
MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC);
#endif
BUT_levelac2.Text = "Complete";
}
catch
{
CustomMessageBox.Show("Failed to level : AP 2.32+ is required");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using ArdupilotMega.Controls.BackstageView;
using log4net;
namespace ArdupilotMega
@ -225,6 +226,18 @@ namespace ArdupilotMega
LNK.VisitedLinkColor = TextColor;
}
else if (ctl.GetType() == typeof(BackstageView))
{
var bsv = ctl as BackstageView;
bsv.BackColor = BGColor;
bsv.ButtonsAreaBgColor = ControlBGColor;
bsv.HighlightColor2 = Color.FromArgb(0x94, 0xc1, 0x1f);
bsv.HighlightColor1 = Color.FromArgb(0x40, 0x57, 0x04);
bsv.SelectedTextColor = Color.White;
bsv.UnSelectedTextColor = Color.Gray;
bsv.ButtonsAreaPencilColor = Color.DarkGray;
}
else if (ctl.GetType() == typeof(HorizontalProgressBar2) || ctl.GetType() == typeof(VerticalProgressBar2))
{
((HorizontalProgressBar2)ctl).BackgroundColor = ControlBGColor;