Mission Planner 1.2.12

add arduino chip detect
fix apm2,2.5 dialog test
add write timeout. this will stop planner hangs on bad serial devices.
change quickview decimal places to 0.00
fix map clicking issue.
fix wind direction wrapping
add airspeed use
modify firmware screen from Marooned
major flightdata tab change.
add save/load polygon from file
add some error handling dialogs
This commit is contained in:
Michael Oborne committed 2012-09-20 07:37:36 +08:00
1 parent cbc4a57abb
commit 5dfb1bd129
64 files changed
+10704 -5410

No files matched your search

@@ -1,38 +1,112 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.IO.Ports;
using System.IO;
namespace ArdupilotMega.Arduino
{
public delegate void ProgressEventHandler(int progress,string status);
public delegate void ProgressEventHandler(int progress, string status);
/// <summary>
/// Arduino STK interface
/// </summary>
interface ArduinoComms
public interface ArduinoComms
{
bool connectAP();
bool keepalive();
bool sync();
byte[] download(short length);
byte[] downloadflash(short length);
bool setaddress(int address);
bool upload(byte[] data, short startfrom, short length, short startaddress);
bool uploadflash(byte[] data, int startfrom, int length, int startaddress);
bool connectAP();
bool keepalive();
bool sync();
byte[] download(short length);
byte[] downloadflash(short length);
bool setaddress(int address);
bool upload(byte[] data, short startfrom, short length, short startaddress);
bool uploadflash(byte[] data, int startfrom, int length, int startaddress);
event ProgressEventHandler Progress;
Chip getChipType();
event ProgressEventHandler Progress;
// from serialport class
int BaudRate { get; set; }
bool DtrEnable { get; set; }
string PortName { get; set; }
StopBits StopBits { get; set; }
Parity Parity { get; set; }
bool IsOpen { get; }
void Open();
void Close();
int DataBits { get; set; }
int BaudRate { get; set; }
bool DtrEnable { get; set; }
string PortName { get; set; }
StopBits StopBits { get; set; }
Parity Parity { get; set; }
bool IsOpen { get; }
void Open();
void Close();
int DataBits { get; set; }
}
public class Chip
{
public string name = "";
public byte sig1 = 0;
public byte sig2 = 0;
public byte sig3 = 0;
public uint size = 0;
static bool creating = true;
public static List<Chip> chips = new List<Chip>();
public static void Populate()
{
creating = false;
chips.Clear();
chips.Add(new Chip("ATmega2561", 0x1e, 0x98, 0x02, 0x100U)); //128 words
chips.Add(new Chip("ATmega2560", 0x1e, 0x98, 0x01, 0x100U)); //128 words
chips.Add(new Chip("ATmega1280", 0x1e, 0x97, 0x03, 0x80U)); //128 words
chips.Add(new Chip("ATmega1281", 0x1e, 0x97, 0x04, 0x80U)); //128 words
chips.Add(new Chip("ATmega128", 0x1e, 0x97, 0x02, 0x80U)); //128 words
chips.Add(new Chip("ATmega64", 0x1e, 0x96, 0x02, 0x80U)); //128 words
chips.Add(new Chip("ATmega32", 0x1e, 0x95, 0x02, 0x40U)); //64 words
chips.Add(new Chip("ATmega16", 0x1e, 0x94, 0x03, 0x40U)); //64 words
chips.Add(new Chip("ATmega8", 0x1e, 0x93, 0x07, 0x20U)); //32 words
chips.Add(new Chip("ATmega88", 0x1e, 0x93, 0x0a, 0x20U)); //32 words
chips.Add(new Chip("ATmega168", 0x1e, 0x94, 0x06, 0x40U)); //64 words
chips.Add(new Chip("ATmega328P", 0x1e, 0x95, 0x0F, 0x40U)); //64 words
chips.Add(new Chip("ATmega162", 0x1e, 0x94, 0x04, 0x40U)); //64 words
chips.Add(new Chip("ATmega163", 0x1e, 0x94, 0x02, 0x40U)); //64 words
chips.Add(new Chip("ATmega169", 0x1e, 0x94, 0x05, 0x40U)); //64 words
chips.Add(new Chip("ATmega8515", 0x1e, 0x93, 0x06, 0x20U)); //32 words
chips.Add(new Chip("ATmega8535", 0x1e, 0x93, 0x08, 0x20U));//32 words
foreach (Chip item in chips)
{
// Console.WriteLine(item);
}
}
public Chip(string nm, byte s1, byte s2, byte s3, uint size)
{
if (chips.Count == 0 && creating)
Populate();
name = nm;
sig1 = s1;
sig2 = s2;
sig3 = s3;
this.size = size;
}
public override string ToString()
{
return "Chip(" + name + ", " + sig1.ToString("X") + ", " + sig2.ToString("X") + ", " + sig3.ToString("X") + ", " + size + ")";
}
public override bool Equals(object obj)
{
Chip item = obj as Chip;
return (item.sig1 == this.sig1 && item.sig2 == this.sig2 && item.sig3 == this.sig3);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}
@@ -10,7 +10,7 @@ using ArdupilotMega.Utilities;
namespace ArdupilotMega.Arduino
{
class ArduinoDetect
public class ArduinoDetect
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
@@ -203,7 +203,7 @@ namespace ArdupilotMega.Arduino
}
else
{
if (DialogResult.Yes == CustomMessageBox.Show("Is this a APM 2?", "APM 2", MessageBoxButtons.YesNo))
if (DialogResult.Yes == CustomMessageBox.Show("Is this a APM 2+?", "APM 2+", MessageBoxButtons.YesNo))
{
return "2560-2";
}
@@ -11,7 +11,7 @@ using ArdupilotMega.Comms;
namespace ArdupilotMega.Arduino
{
class ArduinoSTK : SerialPort, ArduinoComms
public class ArduinoSTK : SerialPort, ArduinoComms
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event ProgressEventHandler Progress;
@@ -45,14 +45,14 @@ namespace ArdupilotMega.Arduino
return false;
}
int a = 0;
while (a < 50)
while (a < 50) // 50 tries at 50 ms = 2.5sec
{
this.DiscardInBuffer();
this.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2);
a++;
Thread.Sleep(50);
log.InfoFormat("btr {0}", this.BytesToRead);
log.InfoFormat("connectap btr {0}", this.BytesToRead);
if (this.BytesToRead >= 2)
{
byte b1 = (byte)this.ReadByte();
@@ -315,30 +315,39 @@ namespace ArdupilotMega.Arduino
return true;
}
public byte getChipType(byte part = 0)
public Chip getChipType()
{
byte answer = 0x00;
byte sig1 = 0x00;
byte sig2 = 0x00;
byte sig3 = 0x00;
byte[] command = new byte[] { (byte)'V', 0x30, 0x01, part, 0x01, (byte)' ' };
byte[] command = new byte[] { (byte)'u', (byte)' ' };
this.Write(command, 0, command.Length);
byte[] chr = new byte[1];
System.Threading.Thread.Sleep(20);
this.Read(chr, 0, 1);
byte[] chr = new byte[5];
if (chr[0] == 0x14)
int count = this.Read(chr, 0, 5);
log.Debug("getChipType read " + count);
if (chr[0] == 0x14 && chr[4] == 0x10)
{
this.Read(chr, 0, 1);
answer = (byte)chr[0];
sig1 = (byte)chr[1];
sig2 = (byte)chr[2];
sig3 = (byte)chr[3];
}
this.Read(chr, 0, 1);
if (chr[0] == 0x10)
foreach (Chip item in Arduino.Chip.chips)
{
if (item.Equals(new Chip("", sig1, sig2, sig3, 0)))
{
return answer;
log.Debug("Match "+item.ToString());
return item;
}
}
return answer;
return null;
}
public new bool Close()
@@ -10,7 +10,7 @@ using log4net;
namespace ArdupilotMega.Arduino
{
class ArduinoSTKv2 : SerialPort,ArduinoComms
public class ArduinoSTKv2 : SerialPort,ArduinoComms
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event ProgressEventHandler Progress;
@@ -368,6 +368,39 @@ namespace ArdupilotMega.Arduino
return true;
}
public Chip getChipType()
{
byte sig1 = 0x00;
byte sig2 = 0x00;
byte sig3 = 0x00;
byte[] command = new byte[] { (byte)0x1b, 0, 0, 0, 0 };
command = this.genstkv2packet(command);
sig1 = command[2];
command = new byte[] { (byte)0x1b, 0, 0, 0, 1 };
command = this.genstkv2packet(command);
sig2 = command[2];
command = new byte[] { (byte)0x1b, 0, 0, 0, 2 };
command = this.genstkv2packet(command);
sig3 = command[2];
foreach (Chip item in Arduino.Chip.chips)
{
if (item.Equals(new Chip("", sig1, sig2, sig3, 0)))
{
log.Debug("Match " + item.ToString());
return item;
}
}
return null;
}
public new bool Close() {
try
File diff suppressed because it is too large. Load diff
+10 -1
View File
@@ -1112,6 +1112,7 @@ System.ComponentModel.Description("Text under Bar")]
int _min = 0;
int _max = 0;
int _value = 0;
bool ctladded = false;
System.Windows.Forms.Label lbl1 = new System.Windows.Forms.Label();
System.Windows.Forms.Label lbl = new System.Windows.Forms.Label();
@@ -1144,6 +1145,13 @@ System.ComponentModel.Description("Text under Bar")]
drawlbl();
base.Value = ans;
drawlbl();
if (this.Parent != null && ctladded == false)
{
this.Parent.Controls.Add(lbl);
this.Parent.Controls.Add(lbl1);
ctladded = true;
}
}
}
@@ -1164,10 +1172,11 @@ System.ComponentModel.Description("Text under Bar")]
if (this.DesignMode) return;
if (this.Parent != null)
if (this.Parent != null && ctladded == false)
{
this.Parent.Controls.Add(lbl);
this.Parent.Controls.Add(lbl1);
ctladded = true;
}
}
}
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
using System.IO;
namespace ArdupilotMega.Comms
{
public class CommsFile : ICommsSerial
{
// Methods
public void Close() { BaseStream.Close(); }
public void DiscardInBuffer() { }
//void DiscardOutBuffer();
public void Open()
{
BaseStream = File.OpenRead(PortName);
}
public int Read(byte[] buffer, int offset, int count)
{
return BaseStream.Read(buffer, offset, count);
}
//int Read(char[] buffer, int offset, int count);
public int ReadByte() { return BaseStream.ReadByte(); }
public int ReadChar() { return BaseStream.ReadByte(); }
public string ReadExisting() { return ""; }
public string ReadLine() { return ""; }
//string ReadTo(string value);
public void Write(string text) { }
public void Write(byte[] buffer, int offset, int count) { }
//void Write(char[] buffer, int offset, int count);
public void WriteLine(string text) { }
public void toggleDTR() { }
// Properties
public Stream BaseStream { get; private set; }
public int BaudRate { get; set; }
public int BytesToRead { get { return (int)(BaseStream.Length - BaseStream.Position); } }
public int BytesToWrite { get; set; }
public int DataBits { get; set; }
public bool DtrEnable { get; set; }
public bool IsOpen { get { return (BaseStream != null); } }
public Parity Parity { get; set; }
public string PortName { get; set; }
public int ReadBufferSize { get; set; }
public int ReadTimeout { get; set; }
public bool RtsEnable { get; set; }
public StopBits StopBits { get; set; }
public int WriteBufferSize { get; set; }
public int WriteTimeout { get; set; }
}
}
@@ -11,6 +11,9 @@ namespace ArdupilotMega.Comms
{
public new void Open()
{
// 500ms write timeout - win32 api default
this.WriteTimeout = 500;
if (base.IsOpen)
return;
@@ -145,9 +145,9 @@ namespace ArdupilotMega.Controls.BackstageView
/// <summary>
/// Add a page (tab) to this backstage view. Will be added at the end/bottom
/// </summary>
public void AddPage(UserControl userControl, string headerText)
public BackstageViewPage AddPage(UserControl userControl, string headerText, BackstageViewPage Parent)
{
var page = new BackstageViewPage(userControl, headerText)
var page = new BackstageViewPage(userControl, headerText, Parent)
{
Page =
{
@@ -171,6 +171,8 @@ namespace ArdupilotMega.Controls.BackstageView
ActivatePage(page);
}
return page;
}
/// <summary>
@@ -196,7 +198,8 @@ namespace ArdupilotMega.Controls.BackstageView
SelectedTextColor = _selectedTextColor,
UnSelectedTextColor = _unSelectedTextColor,
HighlightColor1 = _highlightColor1,
HighlightColor2 = _highlightColor2
HighlightColor2 = _highlightColor2,
// Dock = DockStyle.Bottom
};
pnlMenu.Controls.Add(lnkButton);
@@ -322,6 +325,9 @@ namespace ArdupilotMega.Controls.BackstageView
if (popoutPage != null && popoutPage == page)
continue;
if (page is BackstageViewSpacer)
continue;
if (((BackstageViewPage)page).Page is IDeactivate)
{
((IDeactivate)((BackstageViewPage)(page)).Page).Deactivate();
@@ -335,7 +341,7 @@ namespace ArdupilotMega.Controls.BackstageView
public abstract class BackstageViewItem
{
public abstract int Spacing { get; }
public abstract int Spacing { get; set; }
}
/// <summary>
@@ -355,6 +361,7 @@ namespace ArdupilotMega.Controls.BackstageView
public override int Spacing
{
get { return _spacing; }
set { _spacing = value; }
}
}
@@ -363,11 +370,12 @@ namespace ArdupilotMega.Controls.BackstageView
/// Data structure to hold information about a 'tab' in the <see cref="BackstageView"/>
/// </summary>
public class BackstageViewPage : BackstageViewItem
{
public BackstageViewPage(UserControl page, string linkText)
{
public BackstageViewPage(UserControl page, string linkText, BackstageViewPage parent)
{
Page = page;
LinkText = linkText;
Parent = parent;
}
/// <summary>
@@ -380,9 +388,14 @@ namespace ArdupilotMega.Controls.BackstageView
/// </summary>
public string LinkText { get; set; }
public BackstageViewPage Parent { get; internal set; }
private int _spaceoverride = -1;
public override int Spacing
{
get { return ButtonSpacing; }
get { if (_spaceoverride != -1) return _spaceoverride; return ButtonSpacing; }
set { _spaceoverride = value; }
}
}
}
+4 -2
View File
@@ -36,6 +36,8 @@ namespace ArdupilotMega.Controls
/// </summary>
public new void Invalidate()
{
if (Disposing)
return;
if (!ThisReallyVisible())
{
return;
@@ -50,8 +52,8 @@ namespace ArdupilotMega.Controls
/// <returns></returns>
public bool ThisReallyVisible()
{
Control ctl = Control.FromHandle(this.Handle);
return ctl.Visible;
//Control ctl = Control.FromHandle(this.Handle);
return this.Visible;
}
public HSI()
+12 -5
View File
@@ -56,6 +56,8 @@ namespace ArdupilotMega.Controls
//return;
}
this.Name = "Hud";
//InitializeComponent();
graphicsObject = this;
@@ -367,8 +369,8 @@ namespace ArdupilotMega.Controls
{
countdate = DateTime.Now;
Console.WriteLine("HUD " + count + " hz drawtime " + (huddrawtime / count) + " gl " + opengl);
// if ((huddrawtime / count) > 1000)
// opengl = false;
if ((huddrawtime / count) > 1000)
opengl = false;
count = 0;
huddrawtime = 0;
@@ -1754,12 +1756,16 @@ namespace ArdupilotMega.Controls
if (SixteenXNine)
{
this.Height = (int)(this.Width / 1.777f);
int ht = (int)(this.Width / 1.777f);
if (ht != this.Height)
this.Height = ht;
}
else
{
// 4x3
this.Height = (int)(this.Width / 1.333f);
int ht = (int)(this.Width / 1.333f);
if (ht != this.Height)
this.Height = ht;
}
base.OnResize(e);
@@ -1799,7 +1805,8 @@ namespace ArdupilotMega.Controls
}
}
catch { }
Refresh();
}
}
}
@@ -44,5 +44,17 @@ namespace ArdupilotMega.Controls
base.OnPaint(pe);
this.CoverWithRect(pe.Graphics, Opacity);
}
public new bool DoubleBuffered
{
get
{
return base.DoubleBuffered;
}
set
{
base.DoubleBuffered = value;
}
}
}
}
@@ -14,7 +14,7 @@ namespace ArdupilotMega.Controls
public partial class MainSwitcher : UserControl
{
public List<Screen> screens = new List<Screen>();
Screen current;
public Screen current;
public MainSwitcher()
{
+24 -24
View File
@@ -29,8 +29,8 @@
private void InitializeComponent()
{
this.labelWithPseudoOpacity1 = new ArdupilotMega.Controls.LabelWithPseudoOpacity();
this.labelWithPseudoOpacity2 = new ArdupilotMega.Controls.LabelWithPseudoOpacity();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.labelWithPseudoOpacity2 = new ArdupilotMega.Controls.LabelWithPseudoOpacity();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
@@ -38,49 +38,49 @@
//
this.labelWithPseudoOpacity1.AutoSize = true;
this.labelWithPseudoOpacity1.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelWithPseudoOpacity1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelWithPseudoOpacity1.DoubleBuffered = true;
this.labelWithPseudoOpacity1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelWithPseudoOpacity1.Location = new System.Drawing.Point(3, 0);
this.labelWithPseudoOpacity1.Name = "labelWithPseudoOpacity1";
this.labelWithPseudoOpacity1.Size = new System.Drawing.Size(161, 50);
this.labelWithPseudoOpacity1.Size = new System.Drawing.Size(118, 20);
this.labelWithPseudoOpacity1.TabIndex = 0;
this.labelWithPseudoOpacity1.Text = "Altitude:";
this.labelWithPseudoOpacity1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// labelWithPseudoOpacity2
//
this.labelWithPseudoOpacity2.AutoSize = true;
this.labelWithPseudoOpacity2.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelWithPseudoOpacity2.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelWithPseudoOpacity2.Location = new System.Drawing.Point(170, 0);
this.labelWithPseudoOpacity2.Name = "labelWithPseudoOpacity2";
this.labelWithPseudoOpacity2.Size = new System.Drawing.Size(162, 50);
this.labelWithPseudoOpacity2.TabIndex = 1;
this.labelWithPseudoOpacity2.Text = "0.0";
this.labelWithPseudoOpacity2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.labelWithPseudoOpacity2, 1, 0);
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.labelWithPseudoOpacity2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.labelWithPseudoOpacity1, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(335, 50);
this.tableLayoutPanel1.Size = new System.Drawing.Size(122, 72);
this.tableLayoutPanel1.TabIndex = 2;
//
// labelWithPseudoOpacity2
//
this.labelWithPseudoOpacity2.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelWithPseudoOpacity2.DoubleBuffered = true;
this.labelWithPseudoOpacity2.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelWithPseudoOpacity2.Location = new System.Drawing.Point(3, 20);
this.labelWithPseudoOpacity2.Name = "labelWithPseudoOpacity2";
this.labelWithPseudoOpacity2.Size = new System.Drawing.Size(118, 52);
this.labelWithPseudoOpacity2.TabIndex = 2;
this.labelWithPseudoOpacity2.Text = "000.00";
this.labelWithPseudoOpacity2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// QuickView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1);
this.MinimumSize = new System.Drawing.Size(100, 27);
this.Name = "QuickView";
this.Size = new System.Drawing.Size(335, 50);
this.Size = new System.Drawing.Size(122, 72);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
@@ -90,7 +90,7 @@
#endregion
private LabelWithPseudoOpacity labelWithPseudoOpacity1;
private LabelWithPseudoOpacity labelWithPseudoOpacity2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private LabelWithPseudoOpacity labelWithPseudoOpacity2;
}
}
@@ -14,7 +14,15 @@ namespace ArdupilotMega.Controls
[System.ComponentModel.Browsable(true)]
public string desc { get { return labelWithPseudoOpacity1.Text; } set { if (labelWithPseudoOpacity1.Text == value) return; labelWithPseudoOpacity1.Text = value; } }
[System.ComponentModel.Browsable(true)]
public string number { get { return labelWithPseudoOpacity2.Text; } set { if (labelWithPseudoOpacity2.Text == value) return; labelWithPseudoOpacity2.Text = value; } }
public double number { get { return double.Parse(labelWithPseudoOpacity2.Text); }
set {
string ans = (value).ToString("0.00");
if (labelWithPseudoOpacity2.Text == ans)
return;
labelWithPseudoOpacity2.Text = ans;
GetFontSize();
}
}
[System.ComponentModel.Browsable(true)]
public Color numberColor { get { return labelWithPseudoOpacity2.ForeColor; } set { if (labelWithPseudoOpacity2.ForeColor == value) return; labelWithPseudoOpacity2.ForeColor = value; } }
@@ -24,6 +32,8 @@ namespace ArdupilotMega.Controls
labelWithPseudoOpacity1.DoubleClick += new EventHandler(labelWithPseudoOpacity1_DoubleClick);
labelWithPseudoOpacity2.DoubleClick += new EventHandler(labelWithPseudoOpacity2_DoubleClick);
labelWithPseudoOpacity2.DoubleBuffered = true;
}
void labelWithPseudoOpacity2_DoubleClick(object sender, EventArgs e)
@@ -54,10 +64,32 @@ namespace ArdupilotMega.Controls
base.OnPaint(e);
}
void GetFontSize()
{
Size extent = TextRenderer.MeasureText(labelWithPseudoOpacity2.Text, this.Font);
float hRatio = (this.Height) / (float)extent.Height;
float wRatio = this.Width / (float)extent.Width;
float ratio = (hRatio < wRatio) ? hRatio : wRatio;
float newSize = this.Font.Size * ratio;
if (newSize < 8)
newSize = 8;
//return newSize;
labelWithPseudoOpacity2.Font = new Font(labelWithPseudoOpacity2.Font.FontFamily, newSize - 2, labelWithPseudoOpacity2.Font.Style);
extent = TextRenderer.MeasureText(labelWithPseudoOpacity2.Text, labelWithPseudoOpacity2.Font);
}
protected override void OnResize(EventArgs e)
{
if (this.Height > 20)
labelWithPseudoOpacity2.Font = new Font(labelWithPseudoOpacity2.Font.FontFamily, this.Height * 0.7f);
this.ResizeRedraw = true;
GetFontSize();
base.OnResize(e);
}
@@ -12,6 +12,14 @@ namespace ArdupilotMega.Controls
{
public bool inOnPaint = false;
string otherthread = "";
int lastx = 0;
int lasty = 0;
public myGMAP()
: base()
{
this.Text = "Map";
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
@@ -38,6 +46,12 @@ namespace ArdupilotMega.Controls
{
try
{
if (e.X == lastx && e.Y == lasty)
return;
lastx = e.X;
lasty = e.Y;
base.OnMouseMove(e);
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
+1 -1
View File
@@ -480,7 +480,7 @@ namespace ArdupilotMega
gotwind = true;
wind_dir = wind.direction;
wind_dir = (wind.direction + 360) % 360;
wind_vel = wind.speed;
//MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS] = null;
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ArdupilotMega.Controls.BackstageView;
using ArdupilotMega.Controls;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigFailSafe : UserControl, IActivate, IDeactivate
{
Timer timer = new Timer();
public ConfigFailSafe()
{
InitializeComponent();
mavlinkCheckBox1.setup(1, 0, "THR_FAILSAFE", MainV2.comPort.param);
mavlinkNumericUpDown1.setup(800, 1200, 1, 1, "THR_FS_VALUE", MainV2.comPort.param);
// setup rc update
timer.Tick += new EventHandler(timer_Tick);
}
public void Deactivate()
{
timer.Stop();
}
void timer_Tick(object sender, EventArgs e)
{
// update all linked controls - 10hz
try
{
MainV2.cs.UpdateCurrentSettings(currentStateBindingSource);
}
catch { }
}
public void Activate()
{
timer.Enabled = true;
timer.Interval = 100;
timer.Start();
CustomMessageBox.Show("Ensure your props are not on the Plane/Quad","FailSafe",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,169 @@
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="CHK_elevonch2rev.Size" type="System.Drawing.Size, System.Drawing">
<value>115, 17</value>
</data>
<data name="CHK_elevonch2rev.Text" xml:space="preserve">
<value>Elevons CH2 逆转</value>
</data>
<data name="CHK_elevonrev.Size" type="System.Drawing.Size, System.Drawing">
<value>91, 17</value>
</data>
<data name="CHK_elevonrev.Text" xml:space="preserve">
<value>Elevons 逆转</value>
</data>
<data name="CHK_elevonch1rev.Size" type="System.Drawing.Size, System.Drawing">
<value>115, 17</value>
</data>
<data name="CHK_elevonch1rev.Text" xml:space="preserve">
<value>Elevons CH1 逆转</value>
</data>
<data name="groupBoxElevons.Text" xml:space="preserve">
<value>升降副翼 (Elevon) 配置</value>
</data>
<data name="CHK_revch3.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 17</value>
</data>
<data name="CHK_revch3.Text" xml:space="preserve">
<value>逆转</value>
</data>
<data name="CHK_revch4.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 17</value>
</data>
<data name="CHK_revch4.Text" xml:space="preserve">
<value>逆转</value>
</data>
<data name="CHK_revch2.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 17</value>
</data>
<data name="CHK_revch2.Text" xml:space="preserve">
<value>逆转</value>
</data>
<data name="CHK_revch1.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 17</value>
</data>
<data name="CHK_revch1.Text" xml:space="preserve">
<value>逆转</value>
</data>
<data name="BUT_Calibrateradio.Text" xml:space="preserve">
<value>校准遥控</value>
</data>
</root>
File diff suppressed because it is too large. Load diff
@@ -32,14 +32,14 @@
this.BUT_MagCalibrationLive = new ArdupilotMega.Controls.MyButton();
this.label27 = new System.Windows.Forms.Label();
this.CMB_sonartype = new System.Windows.Forms.ComboBox();
this.CHK_enableoptflow = new System.Windows.Forms.CheckBox();
this.CHK_enableoptflow = new ArdupilotMega.Controls.MavlinkCheckBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.linkLabelmagdec = new System.Windows.Forms.LinkLabel();
this.label100 = new System.Windows.Forms.Label();
this.TXT_declination = new System.Windows.Forms.TextBox();
this.CHK_enableairspeed = new System.Windows.Forms.CheckBox();
this.CHK_enablesonar = new System.Windows.Forms.CheckBox();
this.CHK_enablecompass = new System.Windows.Forms.CheckBox();
this.CHK_enableairspeed = new ArdupilotMega.Controls.MavlinkCheckBox();
this.CHK_enablesonar = new ArdupilotMega.Controls.MavlinkCheckBox();
this.CHK_enablecompass = new ArdupilotMega.Controls.MavlinkCheckBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
@@ -53,6 +53,7 @@
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.CHK_airspeeduse = new ArdupilotMega.Controls.MavlinkCheckBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
@@ -87,6 +88,10 @@
//
resources.ApplyResources(this.CHK_enableoptflow, "CHK_enableoptflow");
this.CHK_enableoptflow.Name = "CHK_enableoptflow";
this.CHK_enableoptflow.OffValue = 0F;
this.CHK_enableoptflow.OnValue = 1F;
this.CHK_enableoptflow.param = null;
this.CHK_enableoptflow.ParamName = null;
this.CHK_enableoptflow.UseVisualStyleBackColor = true;
this.CHK_enableoptflow.CheckedChanged += new System.EventHandler(this.CHK_enableoptflow_CheckedChanged);
//
@@ -121,6 +126,10 @@
//
resources.ApplyResources(this.CHK_enableairspeed, "CHK_enableairspeed");
this.CHK_enableairspeed.Name = "CHK_enableairspeed";
this.CHK_enableairspeed.OffValue = 0F;
this.CHK_enableairspeed.OnValue = 1F;
this.CHK_enableairspeed.param = null;
this.CHK_enableairspeed.ParamName = null;
this.CHK_enableairspeed.UseVisualStyleBackColor = true;
this.CHK_enableairspeed.CheckedChanged += new System.EventHandler(this.CHK_enableairspeed_CheckedChanged);
//
@@ -128,6 +137,10 @@
//
resources.ApplyResources(this.CHK_enablesonar, "CHK_enablesonar");
this.CHK_enablesonar.Name = "CHK_enablesonar";
this.CHK_enablesonar.OffValue = 0F;
this.CHK_enablesonar.OnValue = 1F;
this.CHK_enablesonar.param = null;
this.CHK_enablesonar.ParamName = null;
this.CHK_enablesonar.UseVisualStyleBackColor = true;
this.CHK_enablesonar.CheckedChanged += new System.EventHandler(this.CHK_enablesonar_CheckedChanged);
//
@@ -135,6 +148,10 @@
//
resources.ApplyResources(this.CHK_enablecompass, "CHK_enablecompass");
this.CHK_enablecompass.Name = "CHK_enablecompass";
this.CHK_enablecompass.OffValue = 0F;
this.CHK_enablecompass.OnValue = 1F;
this.CHK_enablecompass.param = null;
this.CHK_enablecompass.ParamName = null;
this.CHK_enablecompass.UseVisualStyleBackColor = true;
this.CHK_enablecompass.CheckedChanged += new System.EventHandler(this.CHK_enablecompass_CheckedChanged);
//
@@ -222,10 +239,21 @@
this.groupBox4.Name = "groupBox4";
this.groupBox4.TabStop = false;
//
// CHK_airspeeduse
//
resources.ApplyResources(this.CHK_airspeeduse, "CHK_airspeeduse");
this.CHK_airspeeduse.Name = "CHK_airspeeduse";
this.CHK_airspeeduse.OffValue = 0F;
this.CHK_airspeeduse.OnValue = 1F;
this.CHK_airspeeduse.param = null;
this.CHK_airspeeduse.ParamName = null;
this.CHK_airspeeduse.UseVisualStyleBackColor = true;
//
// ConfigHardwareOptions
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.CHK_airspeeduse);
this.Controls.Add(this.CHK_enableoptflow);
this.Controls.Add(this.label3);
this.Controls.Add(this.groupBox4);
@@ -265,14 +293,14 @@
private ArdupilotMega.Controls.MyButton BUT_MagCalibrationLive;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.ComboBox CMB_sonartype;
private System.Windows.Forms.CheckBox CHK_enableoptflow;
private ArdupilotMega.Controls.MavlinkCheckBox CHK_enableoptflow;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.LinkLabel linkLabelmagdec;
private System.Windows.Forms.Label label100;
private System.Windows.Forms.TextBox TXT_declination;
private System.Windows.Forms.CheckBox CHK_enableairspeed;
private System.Windows.Forms.CheckBox CHK_enablesonar;
private System.Windows.Forms.CheckBox CHK_enablecompass;
private ArdupilotMega.Controls.MavlinkCheckBox CHK_enableairspeed;
private ArdupilotMega.Controls.MavlinkCheckBox CHK_enablesonar;
private ArdupilotMega.Controls.MavlinkCheckBox CHK_enablecompass;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox1;
@@ -286,5 +314,6 @@
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox4;
private Controls.MavlinkCheckBox CHK_airspeeduse;
}
}
@@ -247,21 +247,12 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
startup = true;
if (MainV2.comPort.param["ARSPD_ENABLE"] != null)
{
CHK_enableairspeed.Checked = MainV2.comPort.param["ARSPD_ENABLE"].ToString() == "1" ? true : false;
CHK_enableairspeed.Enabled = true;
}
if (MainV2.comPort.param["SONAR_ENABLE"] != null)
{
CHK_enablesonar.Checked = MainV2.comPort.param["SONAR_ENABLE"].ToString() == "1" ? true : false;
CHK_enablesonar.Enabled = true;
}
if (MainV2.comPort.param["MAG_ENABLE"] != null)
{
CHK_enablecompass.Checked = MainV2.comPort.param["MAG_ENABLE"].ToString() == "1" ? true : false;
CHK_enablecompass.Enabled = true;
}
CHK_airspeeduse.setup(1, 0, "ARSPD_USE", MainV2.comPort.param);
CHK_enableairspeed.setup(1, 0, "ARSPD_ENABLE", MainV2.comPort.param);
CHK_enablecompass.setup(1, 0, "MAG_ENABLE", MainV2.comPort.param, TXT_declination);
CHK_enableoptflow.setup(1,0,"FLOW_ENABLE", MainV2.comPort.param);
CHK_enablesonar.setup(1, 0, "SONAR_ENABLE", MainV2.comPort.param, CMB_sonartype);
if (MainV2.comPort.param["COMPASS_DEC"] != null)
{
TXT_declination.Text = (float.Parse(MainV2.comPort.param["COMPASS_DEC"].ToString()) * rad2deg).ToString();
@@ -270,11 +261,6 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
{
CMB_sonartype.SelectedIndex = int.Parse(MainV2.comPort.param["SONAR_TYPE"].ToString());
}
if (MainV2.comPort.param["FLOW_ENABLE"] != null)
{
CHK_enableoptflow.Checked = MainV2.comPort.param["FLOW_ENABLE"].ToString() == "1" ? true : false;
CHK_enableoptflow.Enabled = true;
}
if (MainV2.comPort.param["COMPASS_AUTODEC"] != null)
{
CHK_autodec.Checked = MainV2.comPort.param["COMPASS_AUTODEC"].ToString() == "1" ? true : false;
File diff suppressed because it is too large. Load diff
@@ -85,8 +85,10 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
enum Channelinput
{
Disable = 0,
RC5 = 5,
RC6 = 6,
RC7 = 7
RC7 = 7,
RC8 = 8
}
public void Activate()
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -83,7 +83,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
CHK_revch3.Checked = MainV2.comPort.param["RC3_REV"].ToString() == "-1";
CHK_revch4.Checked = MainV2.comPort.param["RC4_REV"].ToString() == "-1";
}
catch (Exception ex) { CustomMessageBox.Show("Missing RC rev Param " + ex.ToString()); }
catch (Exception ex) { /*CustomMessageBox.Show("Missing RC rev Param " + ex.ToString());*/ }
startup = false;
}
@@ -13,7 +13,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class Setup : MyUserControl
{
// remeber the last page accessed
// remember the last page accessed
static string lastpagename = "";
public Setup()
@@ -22,10 +22,8 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
ThemeManager.ApplyThemeTo(this);
}
private void Setup_Load(object sender, EventArgs e)
{
if (MainV2.comPort.BaseStream.IsOpen)
{
AddPagesForConnectedState();
@@ -35,7 +33,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
// 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);
backstageView.AddSpacer(5);
AddBackstageViewPage(new ConfigPlanner(), "Planner");
// remeber last page accessed
@@ -67,14 +65,15 @@ If you are just setting up 3DR radios, you may continue without connecting.");
AddBackstageViewPage(new ConfigRadioInput(), "Radio Calibration");
AddBackstageViewPage(new ConfigFlightModes(), "Flight Modes");
AddBackstageViewPage(new ConfigHardwareOptions(), "Hardware Options");
AddBackstageViewPage(new ConfigBatteryMonitoring(), "Battery Monitor");
AddBackstageViewPage(new ConfigFailSafe(), "FailSafe");
BackstageView.BackstageViewPage hardware = AddBackstageViewPage(new ConfigHardwareOptions(), "Hardware Options");
AddBackstageViewPage(new ConfigBatteryMonitoring(), "Battery Monitor", hardware);
/******************************HELI **************************/
if (MainV2.comPort.param["H_GYR_ENABLE"] != null) // heli
{
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal");
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal", hardware);
AddBackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level");
@@ -89,9 +88,7 @@ If you are just setting up 3DR radios, you may continue without connecting.");
/****************************** ArduCopter **************************/
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
{
//AddBackstageViewPage(new ConfigCameraStab(), "Camera Gimbal");
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal");
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal", hardware);
AddBackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "ArduCopter Level");
@@ -104,7 +101,7 @@ If you are just setting up 3DR radios, you may continue without connecting.");
/****************************** ArduPlane **************************/
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
{
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal");
AddBackstageViewPage(new ConfigMount(), "Camera Gimbal", hardware);
AddBackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "ArduPlane Level");
AddBackstageViewPage(new ConfigArduplane(), "ArduPlane Pids");
@@ -118,18 +115,18 @@ If you are just setting up 3DR radios, you may continue without connecting.");
AddBackstageViewPage(new ConfigFriendlyParams { ParameterMode = ParameterMetaDataConstants.Standard }, "Standard Params");
AddBackstageViewPage(new ConfigFriendlyParams { ParameterMode = ParameterMetaDataConstants.Advanced }, "Advanced Params");
AddBackstageViewPage(new ConfigRawParams(), "Parameter List");
AddBackstageViewPage(new ConfigRawParams(), "Adv Parameter List");
}
private void AddBackstageViewPage(UserControl userControl, string headerText)
private BackstageView.BackstageViewPage AddBackstageViewPage(UserControl userControl, string headerText, BackstageView.BackstageViewPage Parent = null)
{
backstageView.AddPage(userControl, headerText);
return backstageView.AddPage(userControl, headerText, Parent);
}
private void Setup_FormClosing(object sender, FormClosingEventArgs e)
{
lastpagename = backstageView.SelectedPage.LinkText;
if (backstageView.SelectedPage != null)
lastpagename = backstageView.SelectedPage.LinkText;
backstageView.Close();
}
@@ -0,0 +1,60 @@
namespace ArdupilotMega.GCSViews.ConfigurationView
{
partial class SetupFresh
{
/// <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.backstageView = new ArdupilotMega.Controls.BackstageView.BackstageView();
this.SuspendLayout();
//
// backstageView
//
this.backstageView.AutoSize = true;
this.backstageView.Dock = System.Windows.Forms.DockStyle.Fill;
this.backstageView.Location = new System.Drawing.Point(0, 0);
this.backstageView.Name = "backstageView";
this.backstageView.Size = new System.Drawing.Size(1008, 506);
this.backstageView.TabIndex = 0;
//
// Setup
//
this.Controls.Add(this.backstageView);
this.MinimumSize = new System.Drawing.Size(1000, 450);
this.Name = "Setup";
this.Size = new System.Drawing.Size(1008, 506);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Setup_FormClosing);
this.Load += new System.EventHandler(this.Setup_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Controls.BackstageView.BackstageView backstageView;
}
}
@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ArdupilotMega.Controls.BackstageView;
using ArdupilotMega.Utilities;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class SetupFresh : MyUserControl
{
// remember the last page accessed
static string lastpagename = "";
public SetupFresh()
{
InitializeComponent();
ThemeManager.ApplyThemeTo(this);
}
private void Setup_Load(object sender, EventArgs e)
{
if (MainV2.comPort.BaseStream.IsOpen)
{
AddPagesForConnectedState();
// backstageView.AddSpacer(20);
}
// remeber last page accessed
foreach (BackstageView.BackstageViewPage page in backstageView.Pages) {
if (page.LinkText == lastpagename)
{
this.backstageView.ActivatePage(page);
break;
}
}
//this.backstageView.ActivatePage(backstageView.Pages[0]);
ThemeManager.ApplyThemeTo(this);
if (!MainV2.comPort.BaseStream.IsOpen)
{
Common.MessageShowAgain("Config Connect", @"Please connect (click Connect Button) before using setup.");
}
}
// Add the pages that can only be shown when we are connected to an APM
private void AddPagesForConnectedState()
{
/****************************** Common **************************/
AddBackstageViewPage(new ConfigRadioInput(), "Step 1: Radio Calib");
AddBackstageViewPage(new ConfigFlightModes(), "Step 2: Flight Modes");
AddBackstageViewPage(new ConfigFailSafe(), "Step 3: FailSafe");
BackstageView.BackstageViewPage hardware = AddBackstageViewPage(new ConfigHardwareOptions(), "Step 4: Hardware");
AddBackstageViewPage(new ConfigBatteryMonitoring(), "Step 5: Battery");
/******************************HELI **************************/
if (MainV2.comPort.param["H_GYR_ENABLE"] != null) // heli
{
AddBackstageViewPage(new ConfigMount(), "Step 6: Gimbal");
AddBackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "Step 7: Level");
AddBackstageViewPage(new ConfigTradHeli(), "Step 8: Heli Setup");
}
/****************************** ArduCopter **************************/
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
{
AddBackstageViewPage(new ConfigMount(), "Step 6: Gimbal");
AddBackstageViewPage(new ConfigAccelerometerCalibrationQuad(), "Step 7: Level");
}
/****************************** ArduPlane **************************/
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
{
AddBackstageViewPage(new ConfigMount(), "Step 6: Gimbal");
AddBackstageViewPage(new ConfigAccelerometerCalibrationPlane(), "Step 7: Level");
}
/****************************** ArduRover **************************/
else if (MainV2.cs.firmware == MainV2.Firmwares.ArduRover)
{
}
}
private BackstageView.BackstageViewPage AddBackstageViewPage(UserControl userControl, string headerText, BackstageView.BackstageViewPage Parent = null)
{
return backstageView.AddPage(userControl, headerText, Parent);
}
private void Setup_FormClosing(object sender, FormClosingEventArgs e)
{
if (backstageView.SelectedPage != null)
lastpagename = backstageView.SelectedPage.LinkText;
backstageView.Close();
}
}
}
@@ -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>
+32 -2
View File
@@ -73,8 +73,11 @@ namespace ArdupilotMega.GCSViews
this.pictureBoxACHHil = new System.Windows.Forms.PictureBox();
this.pictureBoxOcta = new ArdupilotMega.Controls.ImageLabel();
this.pictureBoxOctav = new ArdupilotMega.Controls.ImageLabel();
this.pictureBoxRover = new ArdupilotMega.Controls.ImageLabel();
this.label1 = new System.Windows.Forms.Label();
this.CMB_history = new System.Windows.Forms.ComboBox();
this.CMB_history_label = new System.Windows.Forms.Label();
this.Custom_firmware_label = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxHilimage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAPHil)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxACHil)).BeginInit();
@@ -173,8 +176,6 @@ namespace ArdupilotMega.GCSViews
this.pictureBoxAPHil.Name = "pictureBoxAPHil";
this.pictureBoxAPHil.TabStop = false;
this.pictureBoxAPHil.Click += new System.EventHandler(this.pictureBoxAPHil_Click);
this.pictureBoxAPHil.MouseEnter += new System.EventHandler(this.pictureBoxAPHil_MouseEnter);
this.pictureBoxAPHil.MouseLeave += new System.EventHandler(this.pictureBoxAPHil_MouseLeave);
//
// pictureBoxACHil
//
@@ -210,6 +211,15 @@ namespace ArdupilotMega.GCSViews
this.pictureBoxOctav.TabStop = false;
this.pictureBoxOctav.Click += new System.EventHandler(this.pictureBoxOctav_Click);
//
// pictureBoxRover
//
this.pictureBoxRover.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBoxRover.Image = null;
resources.ApplyResources(this.pictureBoxRover, "pictureBoxRover");
this.pictureBoxRover.Name = "pictureBoxRover";
this.pictureBoxRover.TabStop = false;
this.pictureBoxRover.Click += new System.EventHandler(this.pictureBoxRover_Click);
//
// label1
//
resources.ApplyResources(this.label1, "label1");
@@ -223,10 +233,27 @@ namespace ArdupilotMega.GCSViews
this.CMB_history.Name = "CMB_history";
this.CMB_history.SelectedIndexChanged += new System.EventHandler(this.CMB_history_SelectedIndexChanged);
//
// CMB_history_label
//
resources.ApplyResources(this.CMB_history_label, "CMB_history_label");
this.CMB_history_label.Cursor = System.Windows.Forms.Cursors.Hand;
this.CMB_history_label.Name = "CMB_history_label";
this.CMB_history_label.Click += new System.EventHandler(this.CMB_history_label_Click);
//
// Custom_firmware_label
//
resources.ApplyResources(this.Custom_firmware_label, "Custom_firmware_label");
this.Custom_firmware_label.Cursor = System.Windows.Forms.Cursors.Hand;
this.Custom_firmware_label.Name = "Custom_firmware_label";
this.Custom_firmware_label.Click += new System.EventHandler(this.Custom_firmware_label_Click);
//
// Firmware
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.Custom_firmware_label);
this.Controls.Add(this.CMB_history_label);
this.Controls.Add(this.pictureBoxRover);
this.Controls.Add(this.CMB_history);
this.Controls.Add(this.label1);
this.Controls.Add(this.BUT_setup);
@@ -258,6 +285,9 @@ namespace ArdupilotMega.GCSViews
}
private ComboBox CMB_history;
private Controls.ImageLabel pictureBoxRover;
private Label CMB_history_label;
private Label Custom_firmware_label;
}
}
+36 -38
View File
@@ -21,33 +21,9 @@ namespace ArdupilotMega.GCSViews
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.C))
{
var fd = new OpenFileDialog {Filter = "Firmware (*.hex)|*.hex"};
fd.ShowDialog();
if (File.Exists(fd.FileName))
{
UploadFlash(fd.FileName, ArduinoDetect.DetectBoard(MainV2.comPortName));
}
return true;
}
if (keyData == (Keys.Control | Keys.R))
{
findfirmware("AR2");
return true;
}
if (keyData == (Keys.Control | Keys.O))
{
CMB_history.Enabled = false;
CMB_history.DataSource = oldurls;
CMB_history.Enabled = true;
CMB_history.Visible = true;
}
//CTRL+R moved to pictureBoxRover_Click
//CTRL+O moved to CMB_history_label_Click
//CTRL+C moved to Custom_firmware_label_Click
return base.ProcessCmdKey(ref msg, keyData);
}
@@ -78,6 +54,7 @@ namespace ArdupilotMega.GCSViews
WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
this.pictureBoxAPM.Image = ArdupilotMega.Properties.Resources.APM_airframes_001;
this.pictureBoxRover.Image = ArdupilotMega.Properties.Resources.APM_rover_firmware;
this.pictureBoxQuad.Image = ArdupilotMega.Properties.Resources.quad;
this.pictureBoxHexa.Image = ArdupilotMega.Properties.Resources.hexa;
this.pictureBoxTri.Image = ArdupilotMega.Properties.Resources.tri;
@@ -178,6 +155,10 @@ namespace ArdupilotMega.GCSViews
void updateDisplayName(software temp)
{
if (temp.url.ToLower().Contains("AR2".ToLower()))
{
pictureBoxRover.Text = temp.name;
}
if (temp.url.ToLower().Contains("firmware/AP-1".ToLower()))
{
pictureBoxAPM.Text = temp.name;
@@ -259,6 +240,10 @@ namespace ArdupilotMega.GCSViews
}
}
private void pictureBoxRover_Click(object sender, EventArgs e)
{
findfirmware("AR2");
}
private void pictureBoxAPM_Click(object sender, EventArgs e)
{
findfirmware("firmware/AP-1");
@@ -710,7 +695,7 @@ namespace ArdupilotMega.GCSViews
private void BUT_setup_Click(object sender, EventArgs e)
{
Form temp = new Form();
MyUserControl configview = new GCSViews.ConfigurationView.Setup();
MyUserControl configview = new GCSViews.ConfigurationView.SetupFresh();
temp.Controls.Add(configview);
ThemeManager.ApplyThemeTo(temp);
// fix title
@@ -747,21 +732,34 @@ namespace ArdupilotMega.GCSViews
findfirmware("AC2-HELHIL-");
}
private void pictureBoxAPHil_MouseEnter(object sender, EventArgs e)
{
}
private void pictureBoxAPHil_MouseLeave(object sender, EventArgs e)
{
}
private void CMB_history_SelectedIndexChanged(object sender, EventArgs e)
{
firmwareurl = oldurl.Replace("!Hash!", CMB_history.Text);
Firmware_Load(null, null);
}
//Show list of previous firmware versions (old CTRL+O shortcut)
private void CMB_history_label_Click(object sender, EventArgs e)
{
CMB_history.Enabled = false;
CMB_history.DataSource = oldurls;
CMB_history.Enabled = true;
CMB_history.Visible = true;
CMB_history_label.Visible = false;
}
//Load custom firmware (old CTRL+C shortcut)
private void Custom_firmware_label_Click(object sender, EventArgs e)
{
var fd = new OpenFileDialog { Filter = "Firmware (*.hex)|*.hex" };
fd.ShowDialog();
if (File.Exists(fd.FileName))
{
UploadFlash(fd.FileName, ArduinoDetect.DetectBoard(MainV2.comPortName));
}
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+61 -43
View File
@@ -31,14 +31,14 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlightPlanner));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
this.CHK_altmode = new System.Windows.Forms.CheckBox();
this.CHK_holdalt = new System.Windows.Forms.CheckBox();
this.Commands = new System.Windows.Forms.DataGridView();
@@ -134,6 +134,7 @@
this.reverseWPsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileLoadSaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadWPFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadAndAppendToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWPFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.trackerHomeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.flyToHereToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -142,7 +143,8 @@
this.panelBASE = new System.Windows.Forms.Panel();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.loadAndAppendToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.savePolygonToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadPolygonToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.Commands)).BeginInit();
this.panel5.SuspendLayout();
this.panel1.SuspendLayout();
@@ -174,14 +176,14 @@
//
this.Commands.AllowUserToAddRows = false;
resources.ApplyResources(this.Commands, "Commands");
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9;
this.Commands.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Command,
this.Param1,
@@ -195,17 +197,17 @@
this.Up,
this.Down});
this.Commands.Name = "Commands";
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.Format = "N0";
dataGridViewCellStyle5.NullValue = "0";
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black;
this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle13.Format = "N0";
dataGridViewCellStyle13.NullValue = "0";
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle14.ForeColor = System.Drawing.Color.Black;
this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle14;
this.Commands.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellContentClick);
this.Commands.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellEndEdit);
this.Commands.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.Commands_DataError);
@@ -217,9 +219,9 @@
//
// Command
//
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69)))));
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
this.Command.DefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69)))));
dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White;
this.Command.DefaultCellStyle = dataGridViewCellStyle10;
this.Command.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox;
resources.ApplyResources(this.Command, "Command");
this.Command.Name = "Command";
@@ -285,7 +287,7 @@
//
// Up
//
this.Up.DefaultCellStyle = dataGridViewCellStyle3;
this.Up.DefaultCellStyle = dataGridViewCellStyle11;
resources.ApplyResources(this.Up, "Up");
this.Up.Image = global::ArdupilotMega.Properties.Resources.up;
this.Up.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@@ -293,8 +295,8 @@
//
// Down
//
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Down.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Down.DefaultCellStyle = dataGridViewCellStyle12;
resources.ApplyResources(this.Down, "Down");
this.Down.Image = global::ArdupilotMega.Properties.Resources.down;
this.Down.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@@ -418,8 +420,8 @@
//
// dataGridViewImageColumn1
//
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle15;
resources.ApplyResources(this.dataGridViewImageColumn1, "dataGridViewImageColumn1");
this.dataGridViewImageColumn1.Image = global::ArdupilotMega.Properties.Resources.up;
this.dataGridViewImageColumn1.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@@ -427,8 +429,8 @@
//
// dataGridViewImageColumn2
//
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle16;
resources.ApplyResources(this.dataGridViewImageColumn2, "dataGridViewImageColumn2");
this.dataGridViewImageColumn2.Image = global::ArdupilotMega.Properties.Resources.down;
this.dataGridViewImageColumn2.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch;
@@ -765,7 +767,9 @@
//
this.polygonToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addPolygonPointToolStripMenuItem,
this.clearPolygonToolStripMenuItem});
this.clearPolygonToolStripMenuItem,
this.savePolygonToolStripMenuItem,
this.loadPolygonToolStripMenuItem});
this.polygonToolStripMenuItem.Name = "polygonToolStripMenuItem";
resources.ApplyResources(this.polygonToolStripMenuItem, "polygonToolStripMenuItem");
//
@@ -938,6 +942,12 @@
resources.ApplyResources(this.loadWPFileToolStripMenuItem, "loadWPFileToolStripMenuItem");
this.loadWPFileToolStripMenuItem.Click += new System.EventHandler(this.loadWPFileToolStripMenuItem_Click);
//
// loadAndAppendToolStripMenuItem
//
this.loadAndAppendToolStripMenuItem.Name = "loadAndAppendToolStripMenuItem";
resources.ApplyResources(this.loadAndAppendToolStripMenuItem, "loadAndAppendToolStripMenuItem");
this.loadAndAppendToolStripMenuItem.Click += new System.EventHandler(this.loadAndAppendToolStripMenuItem_Click);
//
// saveWPFileToolStripMenuItem
//
this.saveWPFileToolStripMenuItem.Name = "saveWPFileToolStripMenuItem";
@@ -990,11 +1000,17 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// loadAndAppendToolStripMenuItem
// savePolygonToolStripMenuItem
//
this.loadAndAppendToolStripMenuItem.Name = "loadAndAppendToolStripMenuItem";
resources.ApplyResources(this.loadAndAppendToolStripMenuItem, "loadAndAppendToolStripMenuItem");
this.loadAndAppendToolStripMenuItem.Click += new System.EventHandler(this.loadAndAppendToolStripMenuItem_Click);
this.savePolygonToolStripMenuItem.Name = "savePolygonToolStripMenuItem";
resources.ApplyResources(this.savePolygonToolStripMenuItem, "savePolygonToolStripMenuItem");
this.savePolygonToolStripMenuItem.Click += new System.EventHandler(this.savePolygonToolStripMenuItem_Click);
//
// loadPolygonToolStripMenuItem
//
this.loadPolygonToolStripMenuItem.Name = "loadPolygonToolStripMenuItem";
resources.ApplyResources(this.loadPolygonToolStripMenuItem, "loadPolygonToolStripMenuItem");
this.loadPolygonToolStripMenuItem.Click += new System.EventHandler(this.loadPolygonToolStripMenuItem_Click);
//
// FlightPlanner
//
@@ -1131,5 +1147,7 @@
private System.Windows.Forms.ToolStripMenuItem gridV2ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem reverseWPsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadAndAppendToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem savePolygonToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadPolygonToolStripMenuItem;
}
}
@@ -1419,7 +1419,7 @@ namespace ArdupilotMega.GCSViews
return;
}
int i = -1;
int i = Commands.Rows.Count - 1;
foreach (Locationwp temp in cmds)
{
i++;
@@ -1920,11 +1920,39 @@ namespace ArdupilotMega.GCSViews
rc.Pen.Color = Color.Red;
MainMap.Invalidate(false);
int answer;
if (int.TryParse(item.Tag.ToString(), out answer))
{
try
{
Commands.CurrentCell = Commands[0, answer - 1];
item.ToolTipText = "Alt: " + Commands[Alt.Index, answer - 1].Value.ToString();
item.ToolTipMode = MarkerTooltipMode.OnMouseOver;
}
catch { }
}
CurentRectMarker = rc;
}
}
}
// click on some marker
void MainMap_OnMarkerClick(GMapMarker item, MouseEventArgs e)
{
int answer;
try // when dragging item can sometimes be null
{
if (int.TryParse(item.Tag.ToString(), out answer))
{
Commands.CurrentCell = Commands[0, answer - 1];
}
}
catch { }
return;
}
void MainMap_OnMapTypeChanged(MapType type)
{
comboBoxMapType.SelectedItem = MainMap.MapType;
@@ -1949,6 +1977,8 @@ namespace ArdupilotMega.GCSViews
{
end = MainMap.FromLocalToLatLng(e.X, e.Y);
// Console.WriteLine("MainMap MU");
if (e.Button == MouseButtons.Right) // ignore right clicks
{
return;
@@ -2001,6 +2031,8 @@ namespace ArdupilotMega.GCSViews
{
start = MainMap.FromLocalToLatLng(e.X, e.Y);
// Console.WriteLine("MainMap MD");
if (e.Button == MouseButtons.Left && Control.ModifierKeys != Keys.Alt)
{
isMouseDown = true;
@@ -2018,6 +2050,11 @@ namespace ArdupilotMega.GCSViews
{
PointLatLng point = MainMap.FromLocalToLatLng(e.X, e.Y);
if (start == point)
return;
// Console.WriteLine("MainMap MM " + point);
currentMarker.Position = point;
if (!isMouseDown)
@@ -2108,22 +2145,7 @@ namespace ArdupilotMega.GCSViews
}
}
// click on some marker
void MainMap_OnMarkerClick(GMapMarker item, MouseEventArgs e)
{
int answer;
try // when dragging item can sometimes be null
{
if (int.TryParse(item.Tag.ToString(), out answer))
{
Commands.CurrentCell = Commands[0, answer - 1];
}
}
catch { }
return;
}
// loader start loading tiles
void MainMap_OnTileLoadStart()
@@ -4204,5 +4226,89 @@ namespace ArdupilotMega.GCSViews
readQGC110wpfile(file, true);
}
}
private void savePolygonToolStripMenuItem_Click(object sender, EventArgs e)
{
if (drawnpolygon.Points.Count == 0)
{
return;
}
SaveFileDialog sf = new SaveFileDialog();
sf.Filter = "Polygon (*.poly)|*.poly";
sf.ShowDialog();
if (sf.FileName != "")
{
try
{
StreamWriter sw = new StreamWriter(sf.OpenFile());
sw.WriteLine("#saved by APM Planner " + Application.ProductVersion);
if (drawnpolygon.Points.Count > 0)
{
foreach (var pll in drawnpolygon.Points)
{
sw.WriteLine(pll.Lat + " " + pll.Lng);
}
PointLatLng pll2 = drawnpolygon.Points[0];
sw.WriteLine(pll2.Lat + " " + pll2.Lng);
}
sw.Close();
}
catch { CustomMessageBox.Show("Failed to write fence file"); }
}
}
private void loadPolygonToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
fd.Filter = "Polygon (*.poly)|*.poly";
fd.ShowDialog();
if (File.Exists(fd.FileName))
{
StreamReader sr = new StreamReader(fd.OpenFile());
drawnpolygons.Markers.Clear();
drawnpolygons.Polygons.Clear();
drawnpolygon.Points.Clear();
int a = 0;
while (!sr.EndOfStream)
{
string line = sr.ReadLine();
if (line.StartsWith("#"))
{
continue;
}
else
{
string[] items = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
drawnpolygon.Points.Add(new PointLatLng(double.Parse(items[0]), double.Parse(items[1])));
addpolygonmarkergrid(drawnpolygon.Points.Count.ToString(), double.Parse(items[1]), double.Parse(items[0]), 0);
a++;
}
}
// remove loop close
if (drawnpolygon.Points[0] == drawnpolygon.Points[drawnpolygon.Points.Count - 1])
{
drawnpolygon.Points.RemoveAt(drawnpolygon.Points.Count - 1);
}
drawnpolygons.Polygons.Add(drawnpolygon);
MainMap.UpdatePolygonLocalPosition(drawnpolygon);
MainMap.Invalidate();
}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -336,7 +336,7 @@ namespace ArdupilotMega.GCSViews
System.Threading.Thread t11 = new System.Threading.Thread(new System.Threading.ThreadStart(mainloop))
{
Name = "Main Serial/UDP listener",
Name = "Main simu Serial/UDP listener",
IsBackground = true
};
t11.Start();
@@ -638,7 +638,7 @@ namespace ArdupilotMega.GCSViews
if (hzcounttime.Second != DateTime.Now.Second)
{
Console.WriteLine("SIM hz {0}", hzcount);
// Console.WriteLine("SIM hz {0}", hzcount);
hzcount = 0;
hzcounttime = DateTime.Now;
}
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArdupilotMega.HIL
{
class AeroSimRC : Hil
{
}
}
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArdupilotMega.HIL
{
class FlightGear : Hil
{
}
}
+93
View File
@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using System.Reflection;
using System.Runtime.InteropServices;
namespace ArdupilotMega.HIL
{
public delegate void ProgressEventHandler(int progress, string status);
public abstract class Hil
{
internal static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct sitl_fdm
{
// this is the packet sent by the simulator
// to the APM executable to update the simulator state
// All values are little-endian
public double latitude, longitude; // degrees
public double altitude; // MSL
public double heading; // degrees
public double speedN, speedE; // m/s
public double xAccel, yAccel, zAccel; // m/s/s in body frame
public double rollRate, pitchRate, yawRate; // degrees/s/s in earth frame
public double rollDeg, pitchDeg, yawDeg; // euler angles, degrees
public double airspeed; // m/s
public UInt32 magic; // 0x4c56414e
};
public const float ft2m = (float)(1.0 / 3.2808399);
public const float rad2deg = (float)(180 / Math.PI);
public const float deg2rad = (float)(1.0 / rad2deg);
public const float kts2fps = (float)1.68780986;
internal DateTime lastgpsupdate = DateTime.Now;
internal sitl_fdm[] sitl_fdmbuffer = new sitl_fdm[5];
internal sitl_fdm oldgps = new sitl_fdm();
// gps buffer
internal int gpsbufferindex = 0;
internal int REV_pitch = 1;
internal int REV_roll = 1;
internal int REV_rudder = 1;
internal int GPS_rate = 200;
internal int rollgain = 10000;
internal int pitchgain = 10000;
internal int ruddergain = 10000;
internal int throttlegain = 10000;
public float roll_out, pitch_out, throttle_out, rudder_out, collective_out;
public event ProgressEventHandler Status;
public bool sitl { get; set; }
public bool heli { get; set; }
public bool quad { get; set; }
public bool xplane10 { get; set; }
public abstract void SetupSockets(int Recvport, int SendPort, string SimIP);
public abstract void Shutdown();
public abstract void GetFromSim(ref sitl_fdm data);
public abstract void SendToSim();
public abstract void SendToAP(sitl_fdm data);
public abstract void GetFromAP();
internal void UpdateStatus(int progress, string status)
{
if (Status != null)
Status(progress, status);
}
internal float Constrain(float value, float min, float max)
{
if (value > max) { value = max; }
if (value < min) { value = min; }
return value;
}
internal short Constrain(double value, double min, double max)
{
if (value > max) { value = max; }
if (value < min) { value = min; }
return (short)value;
}
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArdupilotMega.HIL
{
class JSBSim : Hil
{
}
}
File diff suppressed because it is too large. Load diff
+30 -12
View File
@@ -260,7 +260,15 @@ namespace ArdupilotMega
// preload
Python.CreateEngine();
}
catch (Exception e) { CustomMessageBox.Show("A Major error has occured : " + e.ToString()); this.Close(); }
catch (ArgumentException e) {
//http://www.microsoft.com/en-us/download/details.aspx?id=16083
//System.ArgumentException: Font 'Arial' does not support style 'Regular'.
log.Fatal(e);
CustomMessageBox.Show(e.ToString() + "\n\n Please install this http://www.microsoft.com/en-us/download/details.aspx?id=16083");
this.Close();
}
catch (Exception e) { log.Fatal(e); CustomMessageBox.Show("A Major error has occured : " + e.ToString()); this.Close(); }
if (MainV2.config["CHK_GDIPlus"] != null)
GCSViews.FlightData.myhud.UseOpenGL = !bool.Parse(MainV2.config["CHK_GDIPlus"].ToString());
@@ -294,7 +302,7 @@ namespace ArdupilotMega
if (config["CMB_rateattitude"] != null)
MainV2.cs.rateattitude = byte.Parse(config["CMB_rateattitude"].ToString());
if (config["rateposition"] != null)
if (config["CMB_rateposition"] != null)
MainV2.cs.rateposition = byte.Parse(config["CMB_rateposition"].ToString());
if (config["CMB_ratestatus"] != null)
MainV2.cs.ratestatus = byte.Parse(config["CMB_ratestatus"].ToString());
@@ -434,12 +442,6 @@ namespace ArdupilotMega
private void MenuFlightData_Click(object sender, EventArgs e)
{
MyView.ShowScreen("FlightData");
if (MainV2.config["FlightSplitter"] != null)
{
FlightData.MainHcopy.SplitterDistance = int.Parse(MainV2.config["FlightSplitter"].ToString()) - 1;
FlightData.MainHcopy.SplitterDistance = int.Parse(MainV2.config["FlightSplitter"].ToString());
}
}
private void MenuFlightPlanner_Click(object sender, EventArgs e)
@@ -571,17 +573,22 @@ namespace ArdupilotMega
comPort.BaseStream.DtrEnable = false;
comPort.BaseStream.RtsEnable = false;
// prevent serialreader from doing anything
giveComport = true;
// reset on connect logic.
if (config["CHK_resetapmonconnect"] == null || bool.Parse(config["CHK_resetapmonconnect"].ToString()) == true)
comPort.BaseStream.toggleDTR();
giveComport = false;
// setup to record new logs
try
{
Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs");
comPort.logfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".tlog", FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read));
comPort.logfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".tlog", FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None));
comPort.rawlogfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".rlog", FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read));
comPort.rawlogfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".rlog", FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None));
}
catch (Exception exp2) { log.Error(exp2); CustomMessageBox.Show("Failed to create log - wont log this session"); } // soft fail
@@ -611,6 +618,13 @@ namespace ArdupilotMega
// save the baudrate for this port
config[_connectionControl.CMB_serialport.Text + "_BAUD"] = _connectionControl.CMB_baudrate.Text;
// refresh config window if needed
if (MyView.current != null && MyView.current.Name == "Config")
{
MyView.ShowScreen("Config");
}
// load wps on connect option.
if (config["loadwpsonconnect"] != null && bool.Parse(config["loadwpsonconnect"].ToString()) == true)
{
@@ -671,7 +685,7 @@ namespace ArdupilotMega
}
}
catch (Exception exp3) { log.Error(exp3); }
//MessageBox.Show("Can not establish a connection\n\n" + ex.ToString());
MessageBox.Show("Can not establish a connection\n\n" + ex.Message);
return;
}
}
@@ -1124,7 +1138,11 @@ namespace ArdupilotMega
// actauly read the packets
while (comPort.BaseStream.BytesToRead > minbytes && giveComport == false)
{
comPort.readPacket();
try
{
comPort.readPacket();
}
catch { }
}
}
catch (Exception e)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+120
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>
+90 -22
View File
@@ -28,6 +28,8 @@ namespace ArdupilotMega
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.Idle += Application_Idle;
//MagCalib.ProcessLog();
@@ -38,30 +40,81 @@ namespace ArdupilotMega
//Console.WriteLine(srtm.getAltitude(-35.115676879882812, 117.94178754638671,20));
/*
Arduino.ArduinoSTK comport = new Arduino.ArduinoSTK();
Arduino.ArduinoSTKv2 comport = new Arduino.ArduinoSTKv2();
comport.PortName = "com4";
comport.PortName = "com8";
comport.BaudRate = 57600;
comport.BaudRate = 115200;
comport.Open();
comport.connectAP();
comport.sync();
comport.sync();
Console.WriteLine( comport.getChipType(0));
Console.WriteLine(comport.getChipType(1));
Console.WriteLine(comport.getChipType(2));
Arduino.Chip.Populate();
if (comport.connectAP())
{
Arduino.Chip chip = comport.getChipType();
Console.WriteLine(chip);
}
Console.ReadLine();
return;
*/
/*
Comms.SerialPort sp = new Comms.SerialPort();
sp.PortName = "com8";
sp.BaudRate = 115200;
CurrentState cs = new CurrentState();
MAVLink mav = new MAVLink();
mav.BaseStream = sp;
mav.Open();
HIL.XPlane xp = new HIL.XPlane();
xp.SetupSockets(49005, 49000, "127.0.0.1");
HIL.Hil.sitl_fdm data = new HIL.Hil.sitl_fdm();
while (true)
{
while (mav.BaseStream.BytesToRead > 0)
mav.readPacket();
// update all stats
cs.UpdateCurrentSettings(null);
xp.GetFromSim(ref data);
xp.GetFromAP(); // no function
xp.SendToAP(data);
xp.SendToSim();
MAVLink.mavlink_rc_channels_override_t rc = new MAVLink.mavlink_rc_channels_override_t();
rc.chan3_raw = 1500;
mav.sendPacket(rc);
} */
/*
MAVLink mav = new MAVLink();
mav.BaseStream = new Comms.CommsFile() { PortName = @"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\logs\2012-09-09 15-07-25.tlog" };
mav.Open(true);
while (mav.BaseStream.BytesToRead > 0)
{
byte[] packet = mav.readPacket();
mav.DebugPacket(packet, true);
}
*/
try
{
@@ -71,6 +124,11 @@ namespace ArdupilotMega
}
catch (Exception ex)
{
if (ex.GetType() == typeof(FileNotFoundException))
{
Console.WriteLine("If your error is about Microsoft.DirectX.DirectInput, please install the latest directx redist from here http://www.microsoft.com/en-us/download/details.aspx?id=35 \n\n");
}
log.Fatal("Fatal app exception", ex);
Console.WriteLine(ex.ToString());
@@ -78,6 +136,11 @@ namespace ArdupilotMega
}
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
handleException((Exception)e.ExceptionObject);
}
static DateTime lastidle = DateTime.Now;
static void Application_Idle(object sender, EventArgs e)
@@ -93,10 +156,8 @@ namespace ArdupilotMega
System.Threading.Thread.Sleep(1);
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
static void handleException(Exception ex)
{
Exception ex = e.Exception;
log.Debug(ex.ToString());
if (ex.Message == "Requested registry access is not allowed.")
@@ -113,18 +174,18 @@ namespace ArdupilotMega
CustomMessageBox.Show("Serial connection has been lost");
return;
}
if (e.Exception.GetType() == typeof(MissingMethodException))
if (ex.GetType() == typeof(MissingMethodException))
{
CustomMessageBox.Show("Please Update - Some older library dlls are causing problems\n" + e.Exception.Message);
CustomMessageBox.Show("Please Update - Some older library dlls are causing problems\n" + ex.Message);
return;
}
if (e.Exception.GetType() == typeof(ObjectDisposedException) || e.Exception.GetType() == typeof(InvalidOperationException)) // something is trying to update while the form, is closing.
if (ex.GetType() == typeof(ObjectDisposedException) || ex.GetType() == typeof(InvalidOperationException)) // something is trying to update while the form, is closing.
{
return; // ignore
}
if (e.Exception.GetType() == typeof(FileNotFoundException) || e.Exception.GetType() == typeof(BadImageFormatException)) // i get alot of error from people who click the exe from inside a zip file.
if (ex.GetType() == typeof(FileNotFoundException) || ex.GetType() == typeof(BadImageFormatException)) // i get alot of error from people who click the exe from inside a zip file.
{
CustomMessageBox.Show("You are missing some DLL's. Please extract the zip file somewhere. OR Use the update feature from the menu " + e.Exception.ToString());
CustomMessageBox.Show("You are missing some DLL's. Please extract the zip file somewhere. OR Use the update feature from the menu " + ex.ToString());
// return;
}
DialogResult dr = CustomMessageBox.Show("An error has occurred\n" + ex.ToString() + "\n\nReport this Error???", "Send Error", MessageBoxButtons.YesNo);
@@ -173,5 +234,12 @@ namespace ArdupilotMega
}
}
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Exception ex = e.Exception;
handleException(ex);
}
}
}
@@ -34,5 +34,5 @@ using System.Resources;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.2.11")]
[assembly: AssemblyFileVersion("1.2.12")]
[assembly: NeutralResourcesLanguageAttribute("")]
@@ -95,6 +95,20 @@ namespace ArdupilotMega.Properties {
}
}
public static System.Drawing.Bitmap APM_rover_firmware {
get {
object obj = ResourceManager.GetObject("APM_rover_firmware", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
public static System.Drawing.Icon apm2 {
get {
object obj = ResourceManager.GetObject("apm2", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
public static System.Drawing.Bitmap attocurrent {
get {
object obj = ResourceManager.GetObject("attocurrent", resourceCulture);
@@ -1246,8 +1246,14 @@
<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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cameraGimalYaw" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cameraGimalYaw.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="APM_rover_firmware" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\APM_rover-firmware.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="apm2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\apm2.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff