APM Planner 1.1.43

Add logging system - re andrew radford
move libs
add tlog support to georef images.
experimental antenna tracking - pololu maestro
tweak "follow me" mode, better error checking
update dataflashlog format for ac2
lang change mod - re hazy
remove arduinocpp project
This commit is contained in:
Michael Oborne 2012-02-27 07:13:23 +08:00
parent ba68d6d8a1
commit 57ed9fc62b
53 changed files with 6149 additions and 1580 deletions

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArdupilotMega.Antenna
{
interface ITrackerOutput
{
SerialPort ComPort { get; set; }
double TrimPan { get; set; }
double TrimTilt { get; set; }
int PanStartRange { get; set; }
int TiltStartRange { get; set; }
int PanEndRange { get; set; }
int TiltEndRange { get; set; }
bool PanReverse { get; set; }
bool TiltReverse { get; set; }
bool Init();
bool Setup();
bool Pan(double Angle);
bool Tilt(double Angle);
bool PanAndTilt(double Pan,double Tilt);
bool Close();
}
}

View File

@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArdupilotMega.Antenna
{
class Maestro : ITrackerOutput
{
public SerialPort ComPort { get; set; }
/// <summary>
/// 0-360
/// </summary>
public double TrimPan { get; set; }
/// <summary>
/// -90 - 90
/// </summary>
public double TrimTilt { get; set; }
public int PanStartRange { get; set; }
public int TiltStartRange { get; set; }
public int PanEndRange { get; set; }
public int TiltEndRange { get; set; }
public bool PanReverse { get { return _panreverse == -1; } set { _panreverse = value == true ? -1 : 1 ; } }
public bool TiltReverse { get { return _tiltreverse == -1; } set { _tiltreverse = value == true ? -1 : 1; } }
int _panreverse = 1;
int _tiltreverse = 1;
byte PanAddress = 0;
byte TiltAddress = 1;
public bool Init()
{
if ((PanStartRange - PanEndRange) == 0)
{
System.Windows.Forms.MessageBox.Show("Invalid Pan Range", "Error");
return false;
}
if ((TiltStartRange - TiltEndRange) == 0)
{
System.Windows.Forms.MessageBox.Show("Invalid Tilt Range", "Error");
return false;
}
try
{
ComPort.Open();
}
catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Connect failed " + ex.Message,"Error"); return false; }
return true;
}
public bool Setup()
{
int target = 100;
// speed
var buffer = new byte[] { 0x87, PanAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) };
ComPort.Write(buffer, 0, buffer.Length);
buffer = new byte[] { 0x87, TiltAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) };
ComPort.Write(buffer, 0, buffer.Length);
// accel
target = 3;
buffer = new byte[] { 0x89, PanAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) };
ComPort.Write(buffer, 0, buffer.Length);
buffer = new byte[] { 0x89, TiltAddress, (byte)(target & 0x7F), (byte)((target >> 7) & 0x7F) };
ComPort.Write(buffer, 0, buffer.Length);
return true;
}
double wrap_180(double input)
{
if (input > 180)
return input - 360;
if (input < -180)
return input + 360;
return input;
}
public bool Pan(double Angle)
{
// using a byte so it will autowrap
double range = Math.Abs(PanStartRange - PanEndRange);
double centerrange = (range / 2) - TrimPan;
short PointAtAngle = Constrain(wrap_180(Angle - TrimPan), PanStartRange, PanEndRange);
byte target = (byte)((((PointAtAngle / range) * 2.0) * 127 + 127) * _panreverse);
Console.WriteLine("P " + Angle + " " + target + " " + PointAtAngle);
var buffer = new byte[] { 0xff,PanAddress,target};
ComPort.Write(buffer, 0, buffer.Length);
return true;
}
public bool Tilt(double Angle)
{
double range = Math.Abs(TiltStartRange - TiltEndRange);
short PointAtAngle = Constrain((Angle - TrimTilt), TiltStartRange - TrimTilt, TiltEndRange - TrimTilt);
byte target = (byte)((((PointAtAngle / range ) * 2) * 127 + 127) * _tiltreverse);
Console.WriteLine("T " + Angle + " " + target + " " + PointAtAngle);
var buffer = new byte[] { 0xff, TiltAddress, target };
ComPort.Write(buffer, 0, buffer.Length);
return true;
}
public bool PanAndTilt(double pan, double tilt)
{
if (Tilt(tilt) && Pan(pan))
return true;
return false;
}
public bool Close()
{
ComPort.Close();
return true;
}
short Constrain(double input, double min, double max)
{
if (input < min)
return (short)min;
if (input > max)
return (short)max;
return (short)input;
}
}
}

View File

@ -0,0 +1,269 @@
namespace ArdupilotMega.Antenna
{
partial class Tracker
{
/// <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 Windows Form 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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Tracker));
this.CMB_interface = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.CMB_baudrate = new System.Windows.Forms.ComboBox();
this.CMB_serialport = new System.Windows.Forms.ComboBox();
this.BUT_connect = new ArdupilotMega.MyButton();
this.TRK_pantrim = new System.Windows.Forms.TrackBar();
this.TXT_panstart = new System.Windows.Forms.TextBox();
this.TXT_panstop = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.TXT_tiltstop = new System.Windows.Forms.TextBox();
this.TXT_tiltstart = new System.Windows.Forms.TextBox();
this.TRK_tilttrim = new System.Windows.Forms.TrackBar();
((System.ComponentModel.ISupportInitialize)(this.TRK_pantrim)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.TRK_tilttrim)).BeginInit();
this.SuspendLayout();
//
// CMB_interface
//
this.CMB_interface.FormattingEnabled = true;
this.CMB_interface.Items.AddRange(new object[] {
"Maestro"});
this.CMB_interface.Location = new System.Drawing.Point(83, 10);
this.CMB_interface.Name = "CMB_interface";
this.CMB_interface.Size = new System.Drawing.Size(121, 21);
this.CMB_interface.TabIndex = 0;
this.CMB_interface.Text = "Maestro";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(49, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Interface";
//
// CMB_baudrate
//
this.CMB_baudrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CMB_baudrate.FormattingEnabled = true;
this.CMB_baudrate.Items.AddRange(new object[] {
"4800",
"9600",
"14400",
"19200",
"28800",
"38400",
"57600",
"115200"});
this.CMB_baudrate.Location = new System.Drawing.Point(337, 9);
this.CMB_baudrate.Name = "CMB_baudrate";
this.CMB_baudrate.Size = new System.Drawing.Size(121, 21);
this.CMB_baudrate.TabIndex = 5;
//
// CMB_serialport
//
this.CMB_serialport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CMB_serialport.FormattingEnabled = true;
this.CMB_serialport.Location = new System.Drawing.Point(210, 10);
this.CMB_serialport.Name = "CMB_serialport";
this.CMB_serialport.Size = new System.Drawing.Size(121, 21);
this.CMB_serialport.TabIndex = 3;
//
// BUT_connect
//
this.BUT_connect.Location = new System.Drawing.Point(476, 9);
this.BUT_connect.Name = "BUT_connect";
this.BUT_connect.Size = new System.Drawing.Size(75, 23);
this.BUT_connect.TabIndex = 4;
this.BUT_connect.Text = "Connect";
this.BUT_connect.UseVisualStyleBackColor = true;
this.BUT_connect.Click += new System.EventHandler(this.BUT_connect_Click);
//
// TRK_pantrim
//
this.TRK_pantrim.Location = new System.Drawing.Point(83, 65);
this.TRK_pantrim.Maximum = 180;
this.TRK_pantrim.Minimum = -180;
this.TRK_pantrim.Name = "TRK_pantrim";
this.TRK_pantrim.Size = new System.Drawing.Size(375, 45);
this.TRK_pantrim.TabIndex = 6;
this.TRK_pantrim.Scroll += new System.EventHandler(this.TRK_pantrim_Scroll);
//
// TXT_panstart
//
this.TXT_panstart.Location = new System.Drawing.Point(13, 65);
this.TXT_panstart.Name = "TXT_panstart";
this.TXT_panstart.Size = new System.Drawing.Size(64, 20);
this.TXT_panstart.TabIndex = 7;
this.TXT_panstart.Text = "-90";
//
// TXT_panstop
//
this.TXT_panstop.Location = new System.Drawing.Point(464, 65);
this.TXT_panstop.Name = "TXT_panstop";
this.TXT_panstop.Size = new System.Drawing.Size(64, 20);
this.TXT_panstop.TabIndex = 8;
this.TXT_panstop.Text = "90";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(461, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 13);
this.label2.TabIndex = 9;
this.label2.Text = "Right";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(261, 49);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.TabIndex = 10;
this.label3.Text = "Center";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(13, 49);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(25, 13);
this.label4.TabIndex = 11;
this.label4.Text = "Left";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(13, 125);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 17;
this.label5.Text = "Down";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(261, 125);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(38, 13);
this.label6.TabIndex = 16;
this.label6.Text = "Center";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(461, 125);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(21, 13);
this.label7.TabIndex = 15;
this.label7.Text = "Up";
//
// TXT_tiltstop
//
this.TXT_tiltstop.Location = new System.Drawing.Point(464, 141);
this.TXT_tiltstop.Name = "TXT_tiltstop";
this.TXT_tiltstop.Size = new System.Drawing.Size(64, 20);
this.TXT_tiltstop.TabIndex = 14;
this.TXT_tiltstop.Text = "90";
//
// TXT_tiltstart
//
this.TXT_tiltstart.Location = new System.Drawing.Point(13, 141);
this.TXT_tiltstart.Name = "TXT_tiltstart";
this.TXT_tiltstart.Size = new System.Drawing.Size(64, 20);
this.TXT_tiltstart.TabIndex = 13;
this.TXT_tiltstart.Text = "0";
//
// TRK_tilttrim
//
this.TRK_tilttrim.Location = new System.Drawing.Point(83, 141);
this.TRK_tilttrim.Maximum = 90;
this.TRK_tilttrim.Minimum = -90;
this.TRK_tilttrim.Name = "TRK_tilttrim";
this.TRK_tilttrim.Size = new System.Drawing.Size(375, 45);
this.TRK_tilttrim.TabIndex = 12;
this.TRK_tilttrim.Value = 45;
this.TRK_tilttrim.Scroll += new System.EventHandler(this.TRK_tilttrim_Scroll);
//
// Tracker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(569, 195);
this.Controls.Add(this.label5);
this.Controls.Add(this.label6);
this.Controls.Add(this.label7);
this.Controls.Add(this.TXT_tiltstop);
this.Controls.Add(this.TXT_tiltstart);
this.Controls.Add(this.TRK_tilttrim);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.TXT_panstop);
this.Controls.Add(this.TXT_panstart);
this.Controls.Add(this.TRK_pantrim);
this.Controls.Add(this.CMB_baudrate);
this.Controls.Add(this.BUT_connect);
this.Controls.Add(this.CMB_serialport);
this.Controls.Add(this.label1);
this.Controls.Add(this.CMB_interface);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Tracker";
this.Text = "Tracker";
((System.ComponentModel.ISupportInitialize)(this.TRK_pantrim)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.TRK_tilttrim)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox CMB_interface;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox CMB_baudrate;
private MyButton BUT_connect;
private System.Windows.Forms.ComboBox CMB_serialport;
private System.Windows.Forms.TrackBar TRK_pantrim;
private System.Windows.Forms.TextBox TXT_panstart;
private System.Windows.Forms.TextBox TXT_panstop;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox TXT_tiltstop;
private System.Windows.Forms.TextBox TXT_tiltstart;
private System.Windows.Forms.TrackBar TRK_tilttrim;
}
}

View File

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ArdupilotMega.Antenna
{
public partial class Tracker : Form
{
System.Threading.Thread t12;
static bool threadrun = false;
static ITrackerOutput tracker;
public Tracker()
{
InitializeComponent();
MainV2.fixtheme(this);
CMB_serialport.DataSource = SerialPort.GetPortNames();
if (threadrun)
{
BUT_connect.Text = "Disconnect";
}
}
private void BUT_connect_Click(object sender, EventArgs e)
{
if (threadrun)
{
threadrun = false;
BUT_connect.Text = "Connect";
tracker.Close();
return;
}
tracker = new ArdupilotMega.Antenna.Maestro();
try
{
tracker.ComPort = new SerialPort()
{
PortName = CMB_serialport.Text,
BaudRate = int.Parse(CMB_baudrate.Text)
};
}
catch (Exception ex) { MessageBox.Show("Bad Port settings " + ex.Message); return; }
try
{
tracker.PanStartRange = int.Parse(TXT_panstart.Text);
tracker.PanEndRange = int.Parse(TXT_panstop.Text);
tracker.TrimPan = TRK_pantrim.Value;
tracker.TiltStartRange = int.Parse(TXT_tiltstart.Text);
tracker.TiltEndRange = int.Parse(TXT_tiltstop.Text);
tracker.TrimTilt = TRK_tilttrim.Value;
}
catch (Exception ex) { MessageBox.Show("Bad User input " + ex.Message); return; }
if (tracker.Init())
{
if (tracker.Setup())
{
tracker.PanAndTilt(0, 0);
t12 = new System.Threading.Thread(new System.Threading.ThreadStart(mainloop))
{
IsBackground = true,
Name = "Antenna Tracker"
};
t12.Start();
/*
for (int a = ting.PanStartRange; a < ting.PanEndRange; a++)
{
System.Threading.Thread.Sleep(100);
ting.Pan(a);
}
for (int a = ting.TiltStartRange; a < ting.TiltEndRange; a++)
{
System.Threading.Thread.Sleep(100);
ting.Tilt(a);
}
*/
}
}
}
void mainloop()
{
threadrun = true;
while (threadrun)
{
try
{
// 10 hz - position updates default to 3 hz on the stream rate
tracker.PanAndTilt(MainV2.cs.AZToMAV, MainV2.cs.ELToMAV);
System.Threading.Thread.Sleep(100);
}
catch { }
}
}
private void TRK_pantrim_Scroll(object sender, EventArgs e)
{
if (tracker != null)
tracker.TrimPan = TRK_pantrim.Value;
}
private void TRK_tilttrim_Scroll(object sender, EventArgs e)
{
if (tracker != null)
tracker.TrimTilt = TRK_tilttrim.Value;
}
}
}

View File

@ -0,0 +1,197 @@
<?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="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA
AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADOxkjAtnoOAKpJ4vyiK
c+8nh3D/J4Zv/yeHcP8oi3PvKpJ4vy6fg4AzsZIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjGo2AyspPfLZ+D/yiQ
d/8hlXj/G6F9/xeqg/8XqYL/GKqD/xuhfv8ilnn/KZB3/y2fhP8yspPfN8ajYAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvRrDA1vpzfL6uN/yel
hP8XvJD/DMyY/wfQl/8FzJP/A8qS/wPJkf8EypL/BsyU/wnRmP8PzZn/Gb2R/yemhP8tqoz/Mb2a3zbQ
qkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAA4y6ZgMbWV/yin
iP8WwZP/Btqf/wDPlf8AyI7/A8aP/yfNnv9T2LP/UNax/03XsP8506b/G8ya/wHKkf8F0Zf/CNuf/xLB
kv8fpYT/J7KQ/y7IomAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAANcajny+w
kf8hqoj/CNSd/wDRlf8Axor/Hcyd/3Lhwf+p7Nj/o+vV/57m0/+X5dD/k+TN/4/jzf+K5Mz/fuHH/0PW
rf8HzJT/ANCT/wDRlv8OpX//HayI/yrFn58AAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAADDC
nmAtro7/H62J/wPWmv8Ay47/AMaO/3XhxP+e6tT/mObP/5Pjy/+Q4sr/jODJ/4ffx/+C3MT/f9vC/3nb
wf9y2r7/adq7/2DauP8ZzZv/Fdae/8T/9/9WxKj/HKuI/y7IomAAAAAAAAAAAAAAAAD///8AAAAAAAAA
AAAiuZMwKKyM/x6ohf8C1Zr/AMmL/wHGjv+49OL///////////9+3ML/f9zD/4Dcwv9+28L/e9rA/3bZ
vv9w1rr/Z9S4/17Rs/9Qz63/Qcyn/3LewP////////////n///8MpH7/JbKP/zXQqUAAAAAAAAAAAP//
/wAAAAAAAAAAABymhN8dnn//BNGa/wDKjP8AxY3/sfHf/////////////////2nXt/9w1rv/c9e8/3TX
vP9x17z/a9W5/2TTtf9Y0K//SMyp/zXFoP9i07X/////////////////f/LR/wDQlf8epYT/Mb2a3wAA
AAAAAAAA////AAAAAAADlnJgFZR1/wq4iv8AzpH/AMCD/4rmzf//////////////////////WdGv/2PU
tf9p1rf/atS4/2nUtv9i0rT/Vc+u/0fKpv8zxZz/Ws+w//////////////////////8GyJL/ANCS/xLB
kv8tq4z/OMajYAAAAAD///8AAAAAAACHZt8NkW//ANKV/wDChP9i27r//////////////////////9Dx
6P9MzKn/Vc+v/17Rsv9g0rP/XNCx/1XNrv9Fyaf/McSd/1fPr///////////////////////QM2m/ynK
oP8JzJX/C9yh/ymmhf80spPfAAAAAP///wAAcUwwAHtc/wCrfP8AyIv/AMKK////////////////////
/////////////5Dgyv9Gyqb/TMyq/07Nq/9MzKn/Qcmj/y/Fnf9Wzq3//////////////////////57k
0v8av5T/Lceg/yzOo/8M05v/Hr6T/zCghf80spIw////AABoRYAAclT/AL2H/wDBhf9R1rL/////////
////////4vfw//////////////////H8+P9KzKn/Ocah/zTFnv8qwpj/Us2t////////////////////
////////DLqM/yDBlv8wxp//OM6m/xPPm/8Xz53/LZF5/y+fg4////8AAGNAvwB7Wf8Aw4j/ALyC/4bj
yP+g5tL/g93E/2HSsv9Pzqz/Us6s//////////////////////9Yzq//Gr2S/0jLp///////////////
/////////////yrDm/8SvI//JMGY/zDHn/81zKT/Is2e/xTUnf8nl3v/LJJ5v////wAAXz3vAIlg/wDA
hf8AuoD/quzZ/5Hjyv9628D/ada2/1jRsP9Jy6f/a9a4//////////////////////+Y4s7/////////
//////////////////+c4tD/AbaH/xW8kf8jwZj/LcWd/y/Jn/8kzJ3/E9Ca/yGjgf8ri3Tv////AABd
PP8Ak2b/AL6D/w/Ekv+m6tf/j+HJ/3vawP9p1rf/W9Gx/0rNqf85yJ//Nsaf////////////////////
/////////////////////////////wCwe/8AtoT/ELqP/xu+k/8jwZj/KMeb/yHKm/8QzZf/HqyG/ymI
cf////8AAF07/wCSZP8AvYL/GMWU/6Dn1P+K38f/ddi+/27Wuf+E3MX/leHN/6fm1f+l5tX/neLQ////
////////////////////////////////////////j9/J/27Vuv9Tzq7/JsKY/xa/kv8aw5T/FcaW/wvL
lf8aqoT/J4dw/////wAAXTv/AJFk/wC9gP8GwY3/mObQ/5rkz/+26dv/y/Hl/8Dt3/+06tz/pebV/5bg
zP+g5NL//////////////v///f7+//7+/v//////7fn2////////////tOnb/6Ll0v+v6Nj/jeDI/zXK
o/8IxJD/BMqS/xaqgv8lh2//////AABeO+8AgVf/AL1//wDBif/R9uv/1PPq/8Tv5P+36t3/rujY/6Lk
0v+U4cv/jt7J//j8+///////+/38//f8+//2+/r/+Pz7//3+/v/m9/P/9Pv6//D6+P9/28L/jd7J/5jj
z/+h5dL/qOvX/4Hmyf8f1J//E596/yOJcO////8AAGA8vwB3U/8p06P/hufM/8Ty5f/D7+T/s+vb/6bm
1P+c4c//j9/K/4vcyP/t+fb///7///j8/P/0+/r/8vr5//P7+f/1+/r/+/39///////i9fL/ZNO1/3HW
vP992sH/htzG/4vhyv+S5dD/mO7W/6X74v80noT/Io90v////wAAZkCAAHla/33ny/945cb/nunV/7Xr
3v+l5tT/luDN/4ndxv992cL/1vLq//v9/P/1+/n/8vv4//L69//z+/j/9Pv5/7Xo2//x+vn/////////
//+y59n/aNS3/3LWvP932r//fNzD/4Ljyf+J7ND/l/bd/yORdf8knH6A////AABuRzAAdlT/Xc6x/23o
xv9s4MH/qurZ/5jiz/+I3cb/edjA/8ju5f/3/Pv/8vv4//H6+P/y+/j/6/f0/7np3v/7/fz//v7+/6fk
1f+56tz///////////9h0bT/aNW4/23Wu/9v3L//dOLG/37w0f9m1rn/Hpt8/ymujTD///8AAAAAAACD
X98po4X/Z+7K/1vgvP+A4sf/jOHK/3rZwv+r59f/9Pv6/+/69//v+vf/8vr4/9fy6/9n0rf/VM6t/6Di
0v/N7+f/adO4/1PMrf9t1Lr/i9zI/1/Rs/9h0rX/ZNe4/2bbvf9s5sb/ePfV/z2ylf8lrozfAAAAAP//
/wAAAAAAAJNsYAWQbf9U1rP/Vee//0rYsf993sb/pebV//P7+v/s+Pb/6/f1/+749v+s5tj/Vc2u/1jP
r/9ZzrD/btW5/1bOr/9Wza//Vs6v/1fOr/9Z0LD/WdCy/1vTtP9d1rX/Xt+8/2btyP9k4L//IaaF/y7D
nmAAAAAA////AAAAAAAAAAAAD6J9zyCjgv9S68L/P9+0/2Pevv/5////7/v6/+v59//j9/L/gtvF/1PN
r/9Wz7D/Wc+x/1nQsf9Zz7H/WM6w/1fPsP9UzrD/VM+w/1TPrv9U0a//U9Oy/1Tatv9Z5sD/Y/LL/zSx
lP8qupbPAAAAAAAAAAD///8AAAAAAAAAAAAYto4wGaeE/y23lP8+5rn/6/////j////w//3/ve/i/2bV
uP9Tzq7/Vc+v/1jPsP9Z0LL/WM+w/1fOsf9Wz7D/Us2w/1HOrf9Qzq3/T9Cu/0zSr/9M2LP/TeC5/1bt
xP9HxaX/KLKQ/zTPqDAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAkvpdgG6iF/y++m//e/////P///3rl
yf9G0K3/VdKy/1bPsf9Wz7H/Vs6w/1bPsP9Sza//Ucyu/0/Nrf9NzKz/S82s/0fOrP9G0a7/QdWv/0Le
tP9I6L7/Q8Ok/yitjP8yyKJgAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAmwJlgG6iF/yK3
kP8k3q7/H9el/x7Pn/8tzKT/Q9Cs/1HQsP9Q0K7/TM6u/0nMrf9Hzaz/RMyp/0LNqf8+zqn/ONGo/zTV
qf833rD/O+S4/zvCof8orIv/MMSfYAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAA
AAAkvpdgG6iE/xukgv8gy53/HNql/xzRn/8czJz/HcmZ/yXJnP8qyp7/Lcqg/yzLn/8nypz/JMqc/yTO
n/8l1KT/KN2r/y3Tpv8nq4n/JaqJ/yzAm2AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAato8wFKN/zxCScv8RnHn/DbqM/wjIlP8GyZT/BsaS/wbFkf8GxZH/B8WR/wfH
k/8IypX/DMmV/xG3jP8WoX3/Fph2/xqkgs8ft5EwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJVvYACGZM8Aelr/AHlZ/wCFX/8AiWL/AJlr/wCb
bP8AlGf/AI5k/wB/W/8AeFj/AHtb/wCHZd8ClXBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwSzAAaESAAGI/vwBf
Pd8AXTz/AF08/wBdPP8AXz3fAGJAvwBoRIAAcUswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AP///wD///8A/+AD//+AAP/+AAA//AAAH/gAAA/wAAAH4AAAA+AAAAPAAAABwAAAAYAA
AACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAwAAAAcAAAAHgAAAD4AAAA/AA
AAf4AAAP/AAAH/4AAD//gAD//+AD//////8=
</value>
</data>
</root>

View File

@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Management;
using System.Windows.Forms;
using System.Threading;
using log4net;
namespace ArdupilotMega
{
class ArduinoDetect
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// detects STK version 1 or 2
/// </summary>
@ -27,7 +27,7 @@ namespace ArdupilotMega
serialPort.BaudRate = 57600;
serialPort.Open();
System.Threading.Thread.Sleep(100);
Thread.Sleep(100);
int a = 0;
while (a < 20) // 20 * 50 = 1 sec
@ -36,7 +36,7 @@ namespace ArdupilotMega
serialPort.DiscardInBuffer();
serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2);
a++;
System.Threading.Thread.Sleep(50);
Thread.Sleep(50);
//Console.WriteLine("btr {0}", serialPort.BytesToRead);
if (serialPort.BytesToRead >= 2)
@ -53,15 +53,15 @@ namespace ArdupilotMega
serialPort.Close();
Console.WriteLine("Not a 1280");
log.Warn("Not a 1280");
System.Threading.Thread.Sleep(500);
Thread.Sleep(500);
serialPort.DtrEnable = true;
serialPort.BaudRate = 115200;
serialPort.Open();
System.Threading.Thread.Sleep(100);
Thread.Sleep(100);
a = 0;
while (a < 4)
@ -69,7 +69,7 @@ namespace ArdupilotMega
byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 };
temp = ArduinoDetect.genstkv2packet(serialPort, temp);
a++;
System.Threading.Thread.Sleep(50);
Thread.Sleep(50);
try
{
@ -81,11 +81,13 @@ namespace ArdupilotMega
}
}
catch { }
catch
{
}
}
serialPort.Close();
Console.WriteLine("Not a 2560");
log.Warn("Not a 2560");
return "";
}
@ -106,7 +108,7 @@ namespace ArdupilotMega
serialPort.BaudRate = 57600;
serialPort.Open();
System.Threading.Thread.Sleep(100);
Thread.Sleep(100);
int a = 0;
while (a < 20) // 20 * 50 = 1 sec
@ -115,7 +117,7 @@ namespace ArdupilotMega
serialPort.DiscardInBuffer();
serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2);
a++;
System.Threading.Thread.Sleep(50);
Thread.Sleep(50);
//Console.WriteLine("btr {0}", serialPort.BytesToRead);
if (serialPort.BytesToRead >= 2)
@ -132,15 +134,15 @@ namespace ArdupilotMega
serialPort.Close();
Console.WriteLine("Not a 1280");
log.Warn("Not a 1280");
System.Threading.Thread.Sleep(500);
Thread.Sleep(500);
serialPort.DtrEnable = true;
serialPort.BaudRate = 115200;
serialPort.Open();
System.Threading.Thread.Sleep(100);
Thread.Sleep(100);
a = 0;
while (a < 4)
@ -148,7 +150,7 @@ namespace ArdupilotMega
byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 };
temp = ArduinoDetect.genstkv2packet(serialPort, temp);
a++;
System.Threading.Thread.Sleep(50);
Thread.Sleep(50);
try
{
@ -192,7 +194,7 @@ namespace ArdupilotMega
}
serialPort.Close();
Console.WriteLine("Not a 2560");
log.Warn("Not a 2560");
return "";
}
@ -281,11 +283,11 @@ namespace ArdupilotMega
key = buffer[pos];
pos++;
Console.Write("{0:X4}: key {1} size {2}\n ", pos - 2, key, size + 1);
log.InfoFormat("{0:X4}: key {1} size {2}\n ", pos - 2, key, size + 1);
if (key == 0xff)
{
Console.WriteLine("end sentinal at {0}", pos - 2);
log.InfoFormat("end sentinal at {0}", pos - 2);
break;
}
@ -301,7 +303,6 @@ namespace ArdupilotMega
Console.Write(" {0:X2}", buffer[pos]);
pos++;
}
Console.WriteLine();
}
}
@ -325,7 +326,7 @@ namespace ArdupilotMega
if (key == 0xff)
{
Console.WriteLine("end sentinal at {0}", pos - 2);
log.InfoFormat("end sentinal at {0}", pos - 2);
break;
}
@ -341,7 +342,6 @@ namespace ArdupilotMega
Console.Write(" {0:X2}", buffer[pos]);
pos++;
}
Console.WriteLine();
}
}
}

View File

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.IO.Ports;
using System.Threading;
using log4net;
// Written by Michael Oborne
@ -10,6 +12,7 @@ namespace ArdupilotMega
{
class ArduinoSTK : SerialPort, ArduinoComms
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event ProgressEventHandler Progress;
public new void Open()
@ -48,7 +51,7 @@ namespace ArdupilotMega
a++;
Thread.Sleep(50);
Console.WriteLine("btr {0}", this.BytesToRead);
log.InfoFormat("btr {0}", this.BytesToRead);
if (this.BytesToRead >= 2)
{
byte b1 = (byte)this.ReadByte();
@ -96,14 +99,14 @@ namespace ArdupilotMega
{
byte b1 = (byte)this.ReadByte();
byte b2 = (byte)this.ReadByte();
Console.WriteLine("bytes {0:X} {1:X}", b1, b2);
log.DebugFormat("bytes {0:X} {1:X}", b1, b2);
if (b1 == 0x14 && b2 == 0x10)
{
return true;
}
}
Console.WriteLine("btr {0}", this.BytesToRead);
log.DebugFormat("btr {0}", this.BytesToRead);
Thread.Sleep(10);
a++;
}
@ -210,7 +213,7 @@ namespace ArdupilotMega
byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'F' };
this.Write(command, 0, command.Length);
Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending);
log.Info((startfrom + (length - totalleft)) + " - " + sending);
this.Write(data, startfrom + (length - totalleft), sending);
command = new byte[] { (byte)' ' };
this.Write(command, 0, command.Length);
@ -223,7 +226,7 @@ namespace ArdupilotMega
if (!sync())
{
Console.WriteLine("No Sync");
log.Info("No Sync");
return false;
}
}
@ -247,7 +250,7 @@ namespace ArdupilotMega
throw new Exception("Address must be an even number");
}
Console.WriteLine("Sending address " + ((ushort)(address / 2)));
log.Info("Sending address " + ((ushort)(address / 2)));
address /= 2;
address = (ushort)address;
@ -295,7 +298,7 @@ namespace ArdupilotMega
byte[] command = new byte[] { (byte)'d', (byte)(sending >> 8), (byte)(sending & 0xff), (byte)'E' };
this.Write(command, 0, command.Length);
Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending);
log.Info((startfrom + (length - totalleft)) + " - " + sending);
this.Write(data, startfrom + (length - totalleft), sending);
command = new byte[] { (byte)' ' };
this.Write(command, 0, command.Length);
@ -304,7 +307,7 @@ namespace ArdupilotMega
if (!sync())
{
Console.WriteLine("No Sync");
log.Info("No Sync");
return false;
}
}

View File

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.IO.Ports;
using System.Threading;
using log4net;
// Written by Michael Oborne
@ -10,6 +12,7 @@ namespace ArdupilotMega
{
class ArduinoSTKv2 : SerialPort,ArduinoComms
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event ProgressEventHandler Progress;
public new void Open()
@ -250,7 +253,7 @@ namespace ArdupilotMega
byte[] command = new byte[] { (byte)0x13, (byte)(sending >> 8), (byte)(sending & 0xff) };
Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending);
log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending);
Array.Resize<byte>(ref command, sending + 10); // sending + head
@ -266,7 +269,7 @@ namespace ArdupilotMega
if (command[1] != 0)
{
Console.WriteLine("No Sync");
log.InfoFormat("No Sync");
return false;
}
}
@ -290,7 +293,7 @@ namespace ArdupilotMega
throw new Exception("Address must be an even number");
}
Console.WriteLine("Sending address " + ((address / 2)));
log.InfoFormat("Sending address " + ((address / 2)));
int tempstart = address / 2; // words
byte[] temp = new byte[] { 0x6, (byte)((tempstart >> 24) & 0xff), (byte)((tempstart >> 16) & 0xff), (byte)((tempstart >> 8) & 0xff), (byte)((tempstart >> 0) & 0xff) };
@ -342,7 +345,7 @@ namespace ArdupilotMega
byte[] command = new byte[] { (byte)0x15, (byte)(sending >> 8), (byte)(sending & 0xff) };
Console.WriteLine((startfrom + (length - totalleft)) + " - " + sending);
log.InfoFormat((startfrom + (length - totalleft)) + " - " + sending);
Array.Resize<byte>(ref command, sending + 10); // sending + head
@ -358,7 +361,7 @@ namespace ArdupilotMega
if (command[1] != 0)
{
Console.WriteLine("No Sync");
log.InfoFormat("No Sync");
return false;
}
}

View File

@ -147,6 +147,10 @@
<Reference Include="KMLib">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\kml-library\KmlTestbed\bin\Release\KMLib.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Lib\log4net.dll</HintPath>
</Reference>
<Reference Include="MetaDataExtractor">
<HintPath>..\..\..\..\..\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\MetaDataExtractor.dll</HintPath>
</Reference>
@ -225,6 +229,14 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Antenna\ITrackerOutput.cs" />
<Compile Include="Antenna\Maestro.cs" />
<Compile Include="Antenna\Tracker.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Antenna\Tracker.Designer.cs">
<DependentUpon>Tracker.cs</DependentUpon>
</Compile>
<Compile Include="Controls\ProgressReporterDialogue.cs">
<SubType>Form</SubType>
</Compile>
@ -445,7 +457,10 @@
<DependentUpon>temp.cs</DependentUpon>
</Compile>
<Compile Include="Radio\Uploader.cs" />
<Compile Include="Utility.cs" />
<Compile Include="LangUtility.cs" />
<EmbeddedResource Include="Antenna\Tracker.resx">
<DependentUpon>Tracker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\ProgressReporterDialogue.resx">
<DependentUpon>ProgressReporterDialogue.cs</DependentUpon>
</EmbeddedResource>

View File

@ -11,6 +11,6 @@
<UpdateUrlHistory />
</PropertyGroup>
<PropertyGroup>
<ReferencePath>C:\Users\hog\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\;C:\Users\hog\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\;C:\Users\hog\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\</ReferencePath>
<ReferencePath>C:\Users\hog\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\;C:\Users\hog\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\;C:\Users\hog\Desktop\DIYDrones\myquad\MetaDataExtractorCSharp240d\bin\Release\;C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\Lib\</ReferencePath>
</PropertyGroup>
</Project>

View File

@ -5,8 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArdupilotMega", "ArdupilotM
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{E64A1A41-A5B0-458E-8284-BB63705354DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArduinoCPP", "..\..\ArduinoCPP\ArduinoCPP.csproj", "{C38A02C5-3179-4047-8DC3-945341008A74}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -43,18 +41,6 @@ Global
{E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|Win32.ActiveCfg = Release|x86
{E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|x86.ActiveCfg = Release|x86
{E64A1A41-A5B0-458E-8284-BB63705354DA}.Release|x86.Build.0 = Release|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Any CPU.ActiveCfg = Debug|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Mixed Platforms.Build.0 = Debug|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Debug|Win32.ActiveCfg = Debug|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Debug|x86.ActiveCfg = Debug|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Debug|x86.Build.0 = Debug|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Release|Any CPU.ActiveCfg = Release|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Release|Mixed Platforms.ActiveCfg = Release|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Release|Mixed Platforms.Build.0 = Release|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Release|Win32.ActiveCfg = Release|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Release|x86.ActiveCfg = Release|x86
{C38A02C5-3179-4047-8DC3-945341008A74}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Camera));
this.num_agl = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.num_focallength = new System.Windows.Forms.NumericUpDown();
@ -74,15 +75,13 @@
0,
0,
0});
this.num_agl.Location = new System.Drawing.Point(12, 38);
resources.ApplyResources(this.num_agl, "num_agl");
this.num_agl.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.num_agl.Name = "num_agl";
this.num_agl.Size = new System.Drawing.Size(64, 20);
this.num_agl.TabIndex = 1;
this.num_agl.Value = new decimal(new int[] {
200,
0,
@ -92,12 +91,8 @@
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(82, 40);
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Height m (agl)";
//
// num_focallength
//
@ -107,7 +102,7 @@
0,
0,
65536});
this.num_focallength.Location = new System.Drawing.Point(12, 64);
resources.ApplyResources(this.num_focallength, "num_focallength");
this.num_focallength.Maximum = new decimal(new int[] {
180,
0,
@ -119,8 +114,6 @@
0,
0});
this.num_focallength.Name = "num_focallength";
this.num_focallength.Size = new System.Drawing.Size(64, 20);
this.num_focallength.TabIndex = 6;
this.num_focallength.Value = new decimal(new int[] {
5,
0,
@ -130,181 +123,113 @@
//
// TXT_fovH
//
this.TXT_fovH.Location = new System.Drawing.Point(361, 12);
resources.ApplyResources(this.TXT_fovH, "TXT_fovH");
this.TXT_fovH.Name = "TXT_fovH";
this.TXT_fovH.Size = new System.Drawing.Size(100, 20);
this.TXT_fovH.TabIndex = 10;
//
// TXT_fovV
//
this.TXT_fovV.Location = new System.Drawing.Point(361, 39);
resources.ApplyResources(this.TXT_fovV, "TXT_fovV");
this.TXT_fovV.Name = "TXT_fovV";
this.TXT_fovV.Size = new System.Drawing.Size(100, 20);
this.TXT_fovV.TabIndex = 11;
//
// TXT_fovAV
//
this.TXT_fovAV.Location = new System.Drawing.Point(361, 92);
resources.ApplyResources(this.TXT_fovAV, "TXT_fovAV");
this.TXT_fovAV.Name = "TXT_fovAV";
this.TXT_fovAV.Size = new System.Drawing.Size(100, 20);
this.TXT_fovAV.TabIndex = 14;
//
// TXT_fovAH
//
this.TXT_fovAH.Location = new System.Drawing.Point(361, 65);
resources.ApplyResources(this.TXT_fovAH, "TXT_fovAH");
this.TXT_fovAH.Name = "TXT_fovAH";
this.TXT_fovAH.Size = new System.Drawing.Size(100, 20);
this.TXT_fovAH.TabIndex = 13;
//
// TXT_cmpixel
//
this.TXT_cmpixel.Location = new System.Drawing.Point(361, 118);
resources.ApplyResources(this.TXT_cmpixel, "TXT_cmpixel");
this.TXT_cmpixel.Name = "TXT_cmpixel";
this.TXT_cmpixel.Size = new System.Drawing.Size(100, 20);
this.TXT_cmpixel.TabIndex = 16;
//
// TXT_imgwidth
//
this.TXT_imgwidth.Location = new System.Drawing.Point(12, 90);
resources.ApplyResources(this.TXT_imgwidth, "TXT_imgwidth");
this.TXT_imgwidth.Name = "TXT_imgwidth";
this.TXT_imgwidth.Size = new System.Drawing.Size(64, 20);
this.TXT_imgwidth.TabIndex = 17;
this.TXT_imgwidth.Text = "4608";
this.TXT_imgwidth.TextChanged += new System.EventHandler(this.TXT_imgwidth_TextChanged);
//
// TXT_imgheight
//
this.TXT_imgheight.Location = new System.Drawing.Point(12, 116);
resources.ApplyResources(this.TXT_imgheight, "TXT_imgheight");
this.TXT_imgheight.Name = "TXT_imgheight";
this.TXT_imgheight.Size = new System.Drawing.Size(64, 20);
this.TXT_imgheight.TabIndex = 18;
this.TXT_imgheight.Text = "3456";
this.TXT_imgheight.TextChanged += new System.EventHandler(this.TXT_imgheight_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(82, 71);
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(69, 13);
this.label1.TabIndex = 19;
this.label1.Text = "Focal Length";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(298, 19);
resources.ApplyResources(this.label6, "label6");
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 13);
this.label6.TabIndex = 21;
this.label6.Text = "FOV H (m)";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(299, 72);
resources.ApplyResources(this.label7, "label7");
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(45, 13);
this.label7.TabIndex = 22;
this.label7.Text = "Angle H";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(300, 99);
resources.ApplyResources(this.label8, "label8");
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(44, 13);
this.label8.TabIndex = 23;
this.label8.Text = "Angle V";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(299, 46);
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(55, 13);
this.label10.TabIndex = 25;
this.label10.Text = "FOV V (m)";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(299, 125);
resources.ApplyResources(this.label12, "label12");
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(50, 13);
this.label12.TabIndex = 27;
this.label12.Text = "CM/Pixel";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(82, 93);
resources.ApplyResources(this.label13, "label13");
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(60, 13);
this.label13.TabIndex = 28;
this.label13.Text = "Pixel Width";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(82, 119);
resources.ApplyResources(this.label14, "label14");
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(63, 13);
this.label14.TabIndex = 29;
this.label14.Text = "Pixel Height";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(82, 171);
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(74, 13);
this.label3.TabIndex = 33;
this.label3.Text = "Sensor Height";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(82, 145);
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(71, 13);
this.label4.TabIndex = 32;
this.label4.Text = "Sensor Width";
//
// TXT_sensheight
//
this.TXT_sensheight.Location = new System.Drawing.Point(12, 168);
resources.ApplyResources(this.TXT_sensheight, "TXT_sensheight");
this.TXT_sensheight.Name = "TXT_sensheight";
this.TXT_sensheight.Size = new System.Drawing.Size(64, 20);
this.TXT_sensheight.TabIndex = 31;
this.TXT_sensheight.Text = "4.62";
this.TXT_sensheight.TextChanged += new System.EventHandler(this.TXT_sensheight_TextChanged);
//
// TXT_senswidth
//
this.TXT_senswidth.Location = new System.Drawing.Point(12, 142);
resources.ApplyResources(this.TXT_senswidth, "TXT_senswidth");
this.TXT_senswidth.Name = "TXT_senswidth";
this.TXT_senswidth.Size = new System.Drawing.Size(64, 20);
this.TXT_senswidth.TabIndex = 30;
this.TXT_senswidth.Text = "6.16";
this.TXT_senswidth.TextChanged += new System.EventHandler(this.TXT_senswidth_TextChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(82, 201);
resources.ApplyResources(this.label5, "label5");
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(44, 13);
this.label5.TabIndex = 35;
this.label5.Text = "Overlap";
//
// num_overlap
//
this.num_overlap.DecimalPlaces = 1;
this.num_overlap.Location = new System.Drawing.Point(12, 194);
resources.ApplyResources(this.num_overlap, "num_overlap");
this.num_overlap.Name = "num_overlap";
this.num_overlap.Size = new System.Drawing.Size(64, 20);
this.num_overlap.TabIndex = 34;
this.num_overlap.Value = new decimal(new int[] {
60,
0,
@ -314,20 +239,14 @@
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(82, 227);
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(42, 13);
this.label15.TabIndex = 37;
this.label15.Text = "Sidelap";
//
// num_sidelap
//
this.num_sidelap.DecimalPlaces = 1;
this.num_sidelap.Location = new System.Drawing.Point(12, 220);
resources.ApplyResources(this.num_sidelap, "num_sidelap");
this.num_sidelap.Name = "num_sidelap";
this.num_sidelap.Size = new System.Drawing.Size(64, 20);
this.num_sidelap.TabIndex = 36;
this.num_sidelap.Value = new decimal(new int[] {
30,
0,
@ -337,73 +256,51 @@
//
// CHK_camdirection
//
this.CHK_camdirection.AutoSize = true;
resources.ApplyResources(this.CHK_camdirection, "CHK_camdirection");
this.CHK_camdirection.Checked = true;
this.CHK_camdirection.CheckState = System.Windows.Forms.CheckState.Checked;
this.CHK_camdirection.Location = new System.Drawing.Point(13, 247);
this.CHK_camdirection.Name = "CHK_camdirection";
this.CHK_camdirection.Size = new System.Drawing.Size(150, 17);
this.CHK_camdirection.TabIndex = 38;
this.CHK_camdirection.Text = "Camera top facing forward";
this.CHK_camdirection.UseVisualStyleBackColor = true;
this.CHK_camdirection.CheckedChanged += new System.EventHandler(this.CHK_camdirection_CheckedChanged);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(261, 198);
resources.ApplyResources(this.label9, "label9");
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(86, 13);
this.label9.TabIndex = 42;
this.label9.Text = "Across Flight line";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(261, 171);
resources.ApplyResources(this.label11, "label11");
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(94, 13);
this.label11.TabIndex = 41;
this.label11.Text = "Flight line distance";
//
// TXT_distacflphotos
//
this.TXT_distacflphotos.Location = new System.Drawing.Point(361, 195);
resources.ApplyResources(this.TXT_distacflphotos, "TXT_distacflphotos");
this.TXT_distacflphotos.Name = "TXT_distacflphotos";
this.TXT_distacflphotos.Size = new System.Drawing.Size(100, 20);
this.TXT_distacflphotos.TabIndex = 40;
//
// TXT_distflphotos
//
this.TXT_distflphotos.Location = new System.Drawing.Point(361, 168);
resources.ApplyResources(this.TXT_distflphotos, "TXT_distflphotos");
this.TXT_distflphotos.Name = "TXT_distflphotos";
this.TXT_distflphotos.Size = new System.Drawing.Size(100, 20);
this.TXT_distflphotos.TabIndex = 39;
//
// CMB_camera
//
this.CMB_camera.FormattingEnabled = true;
this.CMB_camera.Location = new System.Drawing.Point(13, 13);
resources.ApplyResources(this.CMB_camera, "CMB_camera");
this.CMB_camera.Name = "CMB_camera";
this.CMB_camera.Size = new System.Drawing.Size(143, 21);
this.CMB_camera.TabIndex = 43;
this.CMB_camera.SelectedIndexChanged += new System.EventHandler(this.CMB_camera_SelectedIndexChanged);
//
// BUT_save
//
this.BUT_save.Location = new System.Drawing.Point(163, 10);
resources.ApplyResources(this.BUT_save, "BUT_save");
this.BUT_save.Name = "BUT_save";
this.BUT_save.Size = new System.Drawing.Size(75, 23);
this.BUT_save.TabIndex = 44;
this.BUT_save.Text = "Save";
this.BUT_save.UseVisualStyleBackColor = true;
this.BUT_save.Click += new System.EventHandler(this.BUT_save_Click);
//
// Camera
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(473, 275);
this.Controls.Add(this.BUT_save);
this.Controls.Add(this.CMB_camera);
this.Controls.Add(this.label9);
@ -438,7 +335,6 @@
this.Controls.Add(this.label2);
this.Controls.Add(this.num_agl);
this.Name = "Camera";
this.Text = "Camera";
this.Load += new System.EventHandler(this.Camera_Load);
((System.ComponentModel.ISupportInitialize)(this.num_agl)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.num_focallength)).EndInit();

View File

@ -117,4 +117,828 @@
<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="num_agl.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 38</value>
</data>
<data name="num_agl.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="num_agl.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;num_agl.Name" xml:space="preserve">
<value>num_agl</value>
</data>
<data name="&gt;&gt;num_agl.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;num_agl.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;num_agl.ZOrder" xml:space="preserve">
<value>32</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 40</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 13</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Height m (agl)</value>
</data>
<data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value>
</data>
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>31</value>
</data>
<data name="num_focallength.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 64</value>
</data>
<data name="num_focallength.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<data name="num_focallength.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;num_focallength.Name" xml:space="preserve">
<value>num_focallength</value>
</data>
<data name="&gt;&gt;num_focallength.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;num_focallength.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;num_focallength.ZOrder" xml:space="preserve">
<value>30</value>
</data>
<data name="TXT_fovH.Location" type="System.Drawing.Point, System.Drawing">
<value>361, 12</value>
</data>
<data name="TXT_fovH.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="TXT_fovH.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="&gt;&gt;TXT_fovH.Name" xml:space="preserve">
<value>TXT_fovH</value>
</data>
<data name="&gt;&gt;TXT_fovH.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_fovH.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_fovH.ZOrder" xml:space="preserve">
<value>29</value>
</data>
<data name="TXT_fovV.Location" type="System.Drawing.Point, System.Drawing">
<value>361, 39</value>
</data>
<data name="TXT_fovV.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="TXT_fovV.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="&gt;&gt;TXT_fovV.Name" xml:space="preserve">
<value>TXT_fovV</value>
</data>
<data name="&gt;&gt;TXT_fovV.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_fovV.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_fovV.ZOrder" xml:space="preserve">
<value>28</value>
</data>
<data name="TXT_fovAV.Location" type="System.Drawing.Point, System.Drawing">
<value>361, 92</value>
</data>
<data name="TXT_fovAV.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="TXT_fovAV.TabIndex" type="System.Int32, mscorlib">
<value>14</value>
</data>
<data name="&gt;&gt;TXT_fovAV.Name" xml:space="preserve">
<value>TXT_fovAV</value>
</data>
<data name="&gt;&gt;TXT_fovAV.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_fovAV.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_fovAV.ZOrder" xml:space="preserve">
<value>26</value>
</data>
<data name="TXT_fovAH.Location" type="System.Drawing.Point, System.Drawing">
<value>361, 65</value>
</data>
<data name="TXT_fovAH.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="TXT_fovAH.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="&gt;&gt;TXT_fovAH.Name" xml:space="preserve">
<value>TXT_fovAH</value>
</data>
<data name="&gt;&gt;TXT_fovAH.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_fovAH.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_fovAH.ZOrder" xml:space="preserve">
<value>27</value>
</data>
<data name="TXT_cmpixel.Location" type="System.Drawing.Point, System.Drawing">
<value>361, 118</value>
</data>
<data name="TXT_cmpixel.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="TXT_cmpixel.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
</data>
<data name="&gt;&gt;TXT_cmpixel.Name" xml:space="preserve">
<value>TXT_cmpixel</value>
</data>
<data name="&gt;&gt;TXT_cmpixel.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_cmpixel.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_cmpixel.ZOrder" xml:space="preserve">
<value>25</value>
</data>
<data name="TXT_imgwidth.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 90</value>
</data>
<data name="TXT_imgwidth.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<data name="TXT_imgwidth.TabIndex" type="System.Int32, mscorlib">
<value>17</value>
</data>
<data name="TXT_imgwidth.Text" xml:space="preserve">
<value>4608</value>
</data>
<data name="&gt;&gt;TXT_imgwidth.Name" xml:space="preserve">
<value>TXT_imgwidth</value>
</data>
<data name="&gt;&gt;TXT_imgwidth.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_imgwidth.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_imgwidth.ZOrder" xml:space="preserve">
<value>24</value>
</data>
<data name="TXT_imgheight.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 116</value>
</data>
<data name="TXT_imgheight.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<data name="TXT_imgheight.TabIndex" type="System.Int32, mscorlib">
<value>18</value>
</data>
<data name="TXT_imgheight.Text" xml:space="preserve">
<value>3456</value>
</data>
<data name="&gt;&gt;TXT_imgheight.Name" xml:space="preserve">
<value>TXT_imgheight</value>
</data>
<data name="&gt;&gt;TXT_imgheight.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_imgheight.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_imgheight.ZOrder" xml:space="preserve">
<value>23</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 71</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 13</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Focal Length</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>22</value>
</data>
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label6.Location" type="System.Drawing.Point, System.Drawing">
<value>298, 19</value>
</data>
<data name="label6.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
</data>
<data name="label6.TabIndex" type="System.Int32, mscorlib">
<value>21</value>
</data>
<data name="label6.Text" xml:space="preserve">
<value>FOV H (m)</value>
</data>
<data name="&gt;&gt;label6.Name" xml:space="preserve">
<value>label6</value>
</data>
<data name="&gt;&gt;label6.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label6.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label6.ZOrder" xml:space="preserve">
<value>21</value>
</data>
<data name="label7.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label7.Location" type="System.Drawing.Point, System.Drawing">
<value>299, 72</value>
</data>
<data name="label7.Size" type="System.Drawing.Size, System.Drawing">
<value>45, 13</value>
</data>
<data name="label7.TabIndex" type="System.Int32, mscorlib">
<value>22</value>
</data>
<data name="label7.Text" xml:space="preserve">
<value>Angle H</value>
</data>
<data name="&gt;&gt;label7.Name" xml:space="preserve">
<value>label7</value>
</data>
<data name="&gt;&gt;label7.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label7.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label7.ZOrder" xml:space="preserve">
<value>20</value>
</data>
<data name="label8.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label8.Location" type="System.Drawing.Point, System.Drawing">
<value>300, 99</value>
</data>
<data name="label8.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 13</value>
</data>
<data name="label8.TabIndex" type="System.Int32, mscorlib">
<value>23</value>
</data>
<data name="label8.Text" xml:space="preserve">
<value>Angle V</value>
</data>
<data name="&gt;&gt;label8.Name" xml:space="preserve">
<value>label8</value>
</data>
<data name="&gt;&gt;label8.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label8.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label8.ZOrder" xml:space="preserve">
<value>19</value>
</data>
<data name="label10.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label10.Location" type="System.Drawing.Point, System.Drawing">
<value>299, 46</value>
</data>
<data name="label10.Size" type="System.Drawing.Size, System.Drawing">
<value>55, 13</value>
</data>
<data name="label10.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="label10.Text" xml:space="preserve">
<value>FOV V (m)</value>
</data>
<data name="&gt;&gt;label10.Name" xml:space="preserve">
<value>label10</value>
</data>
<data name="&gt;&gt;label10.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label10.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label10.ZOrder" xml:space="preserve">
<value>18</value>
</data>
<data name="label12.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label12.Location" type="System.Drawing.Point, System.Drawing">
<value>299, 125</value>
</data>
<data name="label12.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 13</value>
</data>
<data name="label12.TabIndex" type="System.Int32, mscorlib">
<value>27</value>
</data>
<data name="label12.Text" xml:space="preserve">
<value>CM/Pixel</value>
</data>
<data name="&gt;&gt;label12.Name" xml:space="preserve">
<value>label12</value>
</data>
<data name="&gt;&gt;label12.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label12.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label12.ZOrder" xml:space="preserve">
<value>17</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label13.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 93</value>
</data>
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 13</value>
</data>
<data name="label13.TabIndex" type="System.Int32, mscorlib">
<value>28</value>
</data>
<data name="label13.Text" xml:space="preserve">
<value>Pixel Width</value>
</data>
<data name="&gt;&gt;label13.Name" xml:space="preserve">
<value>label13</value>
</data>
<data name="&gt;&gt;label13.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label13.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>16</value>
</data>
<data name="label14.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label14.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 119</value>
</data>
<data name="label14.Size" type="System.Drawing.Size, System.Drawing">
<value>63, 13</value>
</data>
<data name="label14.TabIndex" type="System.Int32, mscorlib">
<value>29</value>
</data>
<data name="label14.Text" xml:space="preserve">
<value>Pixel Height</value>
</data>
<data name="&gt;&gt;label14.Name" xml:space="preserve">
<value>label14</value>
</data>
<data name="&gt;&gt;label14.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label14.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label14.ZOrder" xml:space="preserve">
<value>15</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 171</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 13</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>33</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Sensor Height</value>
</data>
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 145</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 13</value>
</data>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Sensor Width</value>
</data>
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>12</value>
</data>
<data name="TXT_sensheight.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 168</value>
</data>
<data name="TXT_sensheight.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<data name="TXT_sensheight.TabIndex" type="System.Int32, mscorlib">
<value>31</value>
</data>
<data name="TXT_sensheight.Text" xml:space="preserve">
<value>4.62</value>
</data>
<data name="&gt;&gt;TXT_sensheight.Name" xml:space="preserve">
<value>TXT_sensheight</value>
</data>
<data name="&gt;&gt;TXT_sensheight.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_sensheight.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_sensheight.ZOrder" xml:space="preserve">
<value>13</value>
</data>
<data name="TXT_senswidth.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 142</value>
</data>
<data name="TXT_senswidth.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<data name="TXT_senswidth.TabIndex" type="System.Int32, mscorlib">
<value>30</value>
</data>
<data name="TXT_senswidth.Text" xml:space="preserve">
<value>6.16</value>
</data>
<data name="&gt;&gt;TXT_senswidth.Name" xml:space="preserve">
<value>TXT_senswidth</value>
</data>
<data name="&gt;&gt;TXT_senswidth.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_senswidth.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_senswidth.ZOrder" xml:space="preserve">
<value>14</value>
</data>
<data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 201</value>
</data>
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 13</value>
</data>
<data name="label5.TabIndex" type="System.Int32, mscorlib">
<value>35</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>Overlap</value>
</data>
<data name="&gt;&gt;label5.Name" xml:space="preserve">
<value>label5</value>
</data>
<data name="&gt;&gt;label5.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label5.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="num_overlap.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 194</value>
</data>
<data name="num_overlap.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<data name="num_overlap.TabIndex" type="System.Int32, mscorlib">
<value>34</value>
</data>
<data name="&gt;&gt;num_overlap.Name" xml:space="preserve">
<value>num_overlap</value>
</data>
<data name="&gt;&gt;num_overlap.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;num_overlap.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;num_overlap.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="label15.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label15.Location" type="System.Drawing.Point, System.Drawing">
<value>82, 227</value>
</data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>42, 13</value>
</data>
<data name="label15.TabIndex" type="System.Int32, mscorlib">
<value>37</value>
</data>
<data name="label15.Text" xml:space="preserve">
<value>Sidelap</value>
</data>
<data name="&gt;&gt;label15.Name" xml:space="preserve">
<value>label15</value>
</data>
<data name="&gt;&gt;label15.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label15.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label15.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="num_sidelap.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 220</value>
</data>
<data name="num_sidelap.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 20</value>
</data>
<data name="num_sidelap.TabIndex" type="System.Int32, mscorlib">
<value>36</value>
</data>
<data name="&gt;&gt;num_sidelap.Name" xml:space="preserve">
<value>num_sidelap</value>
</data>
<data name="&gt;&gt;num_sidelap.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;num_sidelap.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;num_sidelap.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="CHK_camdirection.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="CHK_camdirection.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 247</value>
</data>
<data name="CHK_camdirection.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 17</value>
</data>
<data name="CHK_camdirection.TabIndex" type="System.Int32, mscorlib">
<value>38</value>
</data>
<data name="CHK_camdirection.Text" xml:space="preserve">
<value>Camera top facing forward</value>
</data>
<data name="&gt;&gt;CHK_camdirection.Name" xml:space="preserve">
<value>CHK_camdirection</value>
</data>
<data name="&gt;&gt;CHK_camdirection.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;CHK_camdirection.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;CHK_camdirection.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label9.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label9.Location" type="System.Drawing.Point, System.Drawing">
<value>261, 198</value>
</data>
<data name="label9.Size" type="System.Drawing.Size, System.Drawing">
<value>86, 13</value>
</data>
<data name="label9.TabIndex" type="System.Int32, mscorlib">
<value>42</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>Across Flight line</value>
</data>
<data name="&gt;&gt;label9.Name" xml:space="preserve">
<value>label9</value>
</data>
<data name="&gt;&gt;label9.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label9.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label9.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="label11.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label11.Location" type="System.Drawing.Point, System.Drawing">
<value>261, 171</value>
</data>
<data name="label11.Size" type="System.Drawing.Size, System.Drawing">
<value>94, 13</value>
</data>
<data name="label11.TabIndex" type="System.Int32, mscorlib">
<value>41</value>
</data>
<data name="label11.Text" xml:space="preserve">
<value>Flight line distance</value>
</data>
<data name="&gt;&gt;label11.Name" xml:space="preserve">
<value>label11</value>
</data>
<data name="&gt;&gt;label11.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label11.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label11.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="TXT_distacflphotos.Location" type="System.Drawing.Point, System.Drawing">
<value>361, 195</value>
</data>
<data name="TXT_distacflphotos.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="TXT_distacflphotos.TabIndex" type="System.Int32, mscorlib">
<value>40</value>
</data>
<data name="&gt;&gt;TXT_distacflphotos.Name" xml:space="preserve">
<value>TXT_distacflphotos</value>
</data>
<data name="&gt;&gt;TXT_distacflphotos.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_distacflphotos.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_distacflphotos.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="TXT_distflphotos.Location" type="System.Drawing.Point, System.Drawing">
<value>361, 168</value>
</data>
<data name="TXT_distflphotos.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="TXT_distflphotos.TabIndex" type="System.Int32, mscorlib">
<value>39</value>
</data>
<data name="&gt;&gt;TXT_distflphotos.Name" xml:space="preserve">
<value>TXT_distflphotos</value>
</data>
<data name="&gt;&gt;TXT_distflphotos.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;TXT_distflphotos.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;TXT_distflphotos.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="CMB_camera.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 13</value>
</data>
<data name="CMB_camera.Size" type="System.Drawing.Size, System.Drawing">
<value>143, 21</value>
</data>
<data name="CMB_camera.TabIndex" type="System.Int32, mscorlib">
<value>43</value>
</data>
<data name="&gt;&gt;CMB_camera.Name" xml:space="preserve">
<value>CMB_camera</value>
</data>
<data name="&gt;&gt;CMB_camera.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;CMB_camera.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;CMB_camera.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="BUT_save.Location" type="System.Drawing.Point, System.Drawing">
<value>163, 10</value>
</data>
<data name="BUT_save.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="BUT_save.TabIndex" type="System.Int32, mscorlib">
<value>44</value>
</data>
<data name="BUT_save.Text" xml:space="preserve">
<value>Save</value>
</data>
<data name="&gt;&gt;BUT_save.Name" xml:space="preserve">
<value>BUT_save</value>
</data>
<data name="&gt;&gt;BUT_save.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
<data name="&gt;&gt;BUT_save.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;BUT_save.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>473, 275</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Camera</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>Camera</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -18,6 +18,7 @@ using System.Net;
using System.Net.Sockets;
using System.Xml; // config file
using System.Runtime.InteropServices; // dll imports
using log4net;
using ZedGraph; // Graphs
using ArdupilotMega;
using System.Reflection;
@ -213,6 +214,13 @@ namespace ArdupilotMega
this.Lng = pll.Lng;
}
public PointLatLngAlt(Locationwp locwp)
{
this.Lat = locwp.lat;
this.Lng = locwp.lng;
this.Alt = locwp.alt;
}
public PointLatLngAlt(PointLatLngAlt plla)
{
this.Lat = plla.Lat;
@ -280,6 +288,7 @@ namespace ArdupilotMega
public class Common
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public enum distances
{
Meters,
@ -323,6 +332,57 @@ namespace ArdupilotMega
OF_LOITER = 10
}
public enum ac2ch7modes
{
CH7_DO_NOTHING = 0,
CH7_SET_HOVER = 1,
CH7_FLIP = 2,
CH7_SIMPLE_MODE = 3,
CH7_RTL = 4,
CH7_AUTO_TRIM = 5,
CH7_ADC_FILTER = 6,
CH7_SAVE_WP = 7
}
public enum ac2ch6modes
{
// CH_6 Tuning
// -----------
CH6_NONE = 0,
// Attitude
CH6_STABILIZE_KP = 1,
CH6_STABILIZE_KI = 2,
CH6_YAW_KP = 3,
// Rate
CH6_RATE_KP = 4,
CH6_RATE_KI = 5,
CH6_RATE_KD = 21,
CH6_YAW_RATE_KP = 6,
// Altitude rate controller
CH6_THROTTLE_KP = 7,
// Extras
CH6_TOP_BOTTOM_RATIO = 8,
CH6_RELAY = 9,
CH6_TRAVERSE_SPEED = 10,
CH6_NAV_P = 11,
CH6_LOITER_P = 12,
CH6_HELI_EXTERNAL_GYRO = 13,
// altitude controller
CH6_THR_HOLD_KP = 14,
CH6_Z_GAIN = 15,
CH6_DAMP = 16,
// optical flow controller
CH6_OPTFLOW_KP = 17,
CH6_OPTFLOW_KI = 18,
CH6_OPTFLOW_KD = 19,
CH6_NAV_I = 20
}
public static void linearRegression()
{
double[] values = { 4.8, 4.8, 4.5, 3.9, 4.4, 3.6, 3.6, 2.9, 3.5, 3.0, 2.5, 2.2, 2.6, 2.1, 2.2 };
@ -352,9 +412,9 @@ namespace ArdupilotMega
double a = v1 / v2;
double b = yAvg - a * xAvg;
Console.WriteLine("y = ax + b");
Console.WriteLine("a = {0}, the slope of the trend line.", Math.Round(a, 2));
Console.WriteLine("b = {0}, the intercept of the trend line.", Math.Round(b, 2));
log.Debug("y = ax + b");
log.DebugFormat("a = {0}, the slope of the trend line.", Math.Round(a, 2));
log.DebugFormat("b = {0}, the intercept of the trend line.", Math.Round(b, 2));
//Console.ReadLine();
}
@ -518,7 +578,7 @@ namespace ArdupilotMega
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
log.Info(((HttpWebResponse)response).StatusDescription);
if (((HttpWebResponse)response).StatusCode != HttpStatusCode.OK)
return false;
// Get the stream containing content returned by the server.
@ -536,7 +596,7 @@ namespace ArdupilotMega
while (dataStream.CanRead && bytes > 0)
{
Application.DoEvents();
Console.WriteLine(saveto + " " + bytes);
log.Info(saveto + " " + bytes);
int len = dataStream.Read(buf1, 0, buf1.Length);
bytes -= len;
fs.Write(buf1, 0, len);
@ -551,7 +611,7 @@ namespace ArdupilotMega
return true;
}
catch (Exception ex) { Console.WriteLine("getFilefromNet(): " + ex.ToString()); return false; }
catch (Exception ex) { log.Info("getFilefromNet(): " + ex.ToString()); return false; }
}
public static Type getModes()

View File

@ -8,7 +8,13 @@ namespace ArdupilotMega
{
class SerialPort : System.IO.Ports.SerialPort,ICommsSerial
{
public new void Open()
{
if (base.IsOpen)
return;
base.Open();
}
public void toggleDTR()
{

View File

@ -1,16 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Text;
using System.IO.Ports;
using System.Threading;
using System.Net; // dns, ip address
using System.Net.Sockets; // tcplistner
using log4net;
namespace System.IO.Ports
{
public class TcpSerial : ArdupilotMega.ICommsSerial
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
TcpClient client = new TcpClient();
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
byte[] rbuffer = new byte[0];
@ -73,7 +76,7 @@ namespace System.IO.Ports
{
if (client.Client.Connected)
{
Console.WriteLine("tcpserial socket already open");
log.Warn("tcpserial socket already open");
return;
}
@ -186,7 +189,7 @@ namespace System.IO.Ports
VerifyConnected();
int size = client.Available;
byte[] crap = new byte[size];
Console.WriteLine("TcpSerial DiscardInBuffer {0}",size);
log.InfoFormat("TcpSerial DiscardInBuffer {0}",size);
Read(crap, 0, size);
}

View File

@ -1,16 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Text;
using System.IO.Ports;
using System.Threading;
using System.Net; // dns, ip address
using System.Net.Sockets; // tcplistner
using log4net;
namespace System.IO.Ports
{
public class UdpSerial : ArdupilotMega.ICommsSerial
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
UdpClient client = new UdpClient();
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
byte[] rbuffer = new byte[0];
@ -73,7 +71,7 @@ namespace System.IO.Ports
{
if (client.Client.Connected)
{
Console.WriteLine("udpserial socket already open");
log.Info("udpserial socket already open");
return;
}
@ -97,12 +95,16 @@ namespace System.IO.Ports
try
{
client.Receive(ref RemoteIpEndPoint);
Console.WriteLine("NetSerial connecting to {0} : {1}", RemoteIpEndPoint.Address, RemoteIpEndPoint.Port);
log.InfoFormat("NetSerial connecting to {0} : {1}", RemoteIpEndPoint.Address, RemoteIpEndPoint.Port);
client.Connect(RemoteIpEndPoint);
}
catch (Exception e) {
if (client != null && client.Client.Connected) { client.Close(); }
Console.WriteLine(e.ToString());
catch (Exception e)
{
if (client != null && client.Client.Connected)
{
client.Close();
}
log.Info(e.ToString());
System.Windows.Forms.MessageBox.Show("Please check your Firewall settings\nPlease try running this command\n1. Run the following command in an elevated command prompt to disable Windows Firewall temporarily:\n \nNetsh advfirewall set allprofiles state off\n \nNote: This is just for test; please turn it back on with the command 'Netsh advfirewall set allprofiles state on'.\n");
throw new Exception("The socket/serialproxy is closed " + e);
}
@ -208,7 +210,7 @@ namespace System.IO.Ports
VerifyConnected();
int size = client.Available;
byte[] crap = new byte[size];
Console.WriteLine("UdpSerial DiscardInBuffer {0}",size);
log.InfoFormat("UdpSerial DiscardInBuffer {0}",size);
Read(crap, 0, size);
}

View File

@ -1,13 +1,16 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.ComponentModel;
using ArdupilotMega.Mavlink;
using log4net;
namespace ArdupilotMega
{
public class CurrentState : ICloneable
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// multipliers
public float multiplierdist = 1;
public float multiplierspeed = 1;
@ -858,7 +861,7 @@ namespace ArdupilotMega
//Console.WriteLine(DateTime.Now.Millisecond + " done ");
}
}
catch { Console.WriteLine("CurrentState Binding error"); }
catch { log.InfoFormat("CurrentState Binding error"); }
}
public object Clone()

View File

@ -30,8 +30,8 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = 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();
this.Params = new System.Windows.Forms.DataGridView();
this.Command = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -141,6 +141,8 @@
this.RLL2SRV_P = new System.Windows.Forms.NumericUpDown();
this.label52 = new System.Windows.Forms.Label();
this.TabAC = new System.Windows.Forms.TabPage();
this.TUNE_LOW = new System.Windows.Forms.NumericUpDown();
this.TUNE_HIGH = new System.Windows.Forms.NumericUpDown();
this.myLabel2 = new ArdupilotMega.MyLabel();
this.TUNE = new System.Windows.Forms.ComboBox();
this.myLabel1 = new ArdupilotMega.MyLabel();
@ -345,6 +347,8 @@
((System.ComponentModel.ISupportInitialize)(this.RLL2SRV_I)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RLL2SRV_P)).BeginInit();
this.TabAC.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).BeginInit();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.THR_RATE_D)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.THR_RATE_IMAX)).BeginInit();
@ -403,14 +407,14 @@
this.Params.AllowUserToAddRows = false;
this.Params.AllowUserToDeleteRows = false;
resources.ApplyResources(this.Params, "Params");
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Maroon;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.Maroon;
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.Params.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.Params.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Command,
@ -419,14 +423,14 @@
this.mavScale,
this.RawValue});
this.Params.Name = "Params";
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.ActiveCaption;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.ActiveCaption;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.Params.RowHeadersVisible = false;
this.Params.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.Params_CellValueChanged);
//
@ -1087,6 +1091,8 @@
//
// TabAC
//
this.TabAC.Controls.Add(this.TUNE_LOW);
this.TabAC.Controls.Add(this.TUNE_HIGH);
this.TabAC.Controls.Add(this.myLabel2);
this.TabAC.Controls.Add(this.TUNE);
this.TabAC.Controls.Add(this.myLabel1);
@ -1106,6 +1112,16 @@
resources.ApplyResources(this.TabAC, "TabAC");
this.TabAC.Name = "TabAC";
//
// TUNE_LOW
//
resources.ApplyResources(this.TUNE_LOW, "TUNE_LOW");
this.TUNE_LOW.Name = "TUNE_LOW";
//
// TUNE_HIGH
//
resources.ApplyResources(this.TUNE_HIGH, "TUNE_HIGH");
this.TUNE_HIGH.Name = "TUNE_HIGH";
//
// myLabel2
//
resources.ApplyResources(this.myLabel2, "myLabel2");
@ -1138,7 +1154,8 @@
resources.GetString("TUNE.Items17"),
resources.GetString("TUNE.Items18"),
resources.GetString("TUNE.Items19"),
resources.GetString("TUNE.Items20")});
resources.GetString("TUNE.Items20"),
resources.GetString("TUNE.Items21")});
resources.ApplyResources(this.TUNE, "TUNE");
this.TUNE.Name = "TUNE";
//
@ -2190,6 +2207,8 @@
((System.ComponentModel.ISupportInitialize)(this.RLL2SRV_P)).EndInit();
this.TabAC.ResumeLayout(false);
this.TabAC.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).EndInit();
this.groupBox5.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.THR_RATE_D)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.THR_RATE_IMAX)).EndInit();
@ -2500,5 +2519,7 @@
private System.Windows.Forms.Label label29;
private System.Windows.Forms.NumericUpDown STAB_D;
private System.Windows.Forms.Label lblSTAB_D;
private System.Windows.Forms.NumericUpDown TUNE_LOW;
private System.Windows.Forms.NumericUpDown TUNE_HIGH;
}
}

View File

@ -164,6 +164,10 @@ namespace ArdupilotMega.GCSViews
// set distance/speed unit states
CMB_distunits.DataSource = Enum.GetNames(typeof(Common.distances));
CMB_speedunits.DataSource = Enum.GetNames(typeof(Common.speeds));
CH7_OPT.DataSource = Enum.GetNames(typeof(Common.ac2ch7modes));
TUNE.DataSource = Enum.GetNames(typeof(Common.ac2ch6modes));
if (MainV2.config["distunits"] != null)
CMB_distunits.Text = MainV2.config["distunits"].ToString();
if (MainV2.config["speedunits"] != null)
@ -180,13 +184,13 @@ namespace ArdupilotMega.GCSViews
CMB_language.DisplayMember = "DisplayName";
CMB_language.DataSource = languages;
ci = Thread.CurrentThread.CurrentUICulture;
ci = Thread.CurrentThread.CurrentUICulture;
for (int i = 0; i < languages.Count; i++)
{
if (ci.IsChildOf(languages[i]))
{
CMB_language.SelectedIndex = i;
break;
if (ci.IsChildOf(languages[i]))
{
CMB_language.SelectedIndex = i;
break;
}
}
CMB_language.SelectedIndexChanged += CMB_language_SelectedIndexChanged;
@ -231,7 +235,9 @@ namespace ArdupilotMega.GCSViews
string data = resources.GetString("MAVParam");
if (data == null)
return;
{
data = global::ArdupilotMega.Properties.Resources.MAVParam;
}
string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
@ -549,23 +555,23 @@ namespace ArdupilotMega.GCSViews
if (text.Length > 0)
{
if (text[0].GetType() == typeof(NumericUpDown))
{
decimal option = (decimal)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString()));
((NumericUpDown)text[0]).Value = option;
((NumericUpDown)text[0]).BackColor = Color.Green;
}
{
decimal option = (decimal)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString()));
((NumericUpDown)text[0]).Value = option;
((NumericUpDown)text[0]).BackColor = Color.Green;
}
else if (text[0].GetType() == typeof(ComboBox))
{
int option = (int)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString()));
((ComboBox)text[0]).SelectedIndex = option;
((ComboBox)text[0]).BackColor = Color.Green;
}
{
int option = (int)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString()));
((ComboBox)text[0]).SelectedIndex = option;
((ComboBox)text[0]).BackColor = Color.Green;
}
}
}
catch { ((Control)text[0]).BackColor = Color.Red; }
Params.Focus();
}
}
private void BUT_load_Click(object sender, EventArgs e)
{
@ -593,12 +599,12 @@ namespace ArdupilotMega.GCSViews
continue;
if (index2 != -1)
line = line.Replace(',', '.');
line = line.Replace(',','.');
string name = line.Substring(0, index);
float value = float.Parse(line.Substring(index + 1), new System.Globalization.CultureInfo("en-US"));
MAVLink.modifyParamForDisplay(true, name, ref value);
MAVLink.modifyParamForDisplay(true,name,ref value);
// set param table as well
foreach (DataGridViewRow row in Params.Rows)
@ -753,6 +759,8 @@ namespace ArdupilotMega.GCSViews
MainV2.cam.Start();
MainV2.config["video_options"] = CMB_videoresolutions.SelectedIndex;
BUT_videostart.Enabled = false;
}
catch (Exception ex) { MessageBox.Show("Camera Fail: " + ex.Message); }
@ -807,10 +815,9 @@ namespace ArdupilotMega.GCSViews
{
DsError.ThrowExceptionForHR(hr);
}
catch (Exception ex)
{
MessageBox.Show("Can not add video source\n" + ex.ToString());
return;
catch (Exception ex) {
MessageBox.Show("Can not add video source\n" + ex.ToString());
return;
}
// Find the stream config interface
@ -839,6 +846,11 @@ namespace ArdupilotMega.GCSViews
DsUtils.FreeAMMediaType(media);
CMB_videoresolutions.DataSource = modes;
if (MainV2.getConfig("video_options") != "" && CMB_videosources.Text != "")
{
CMB_videoresolutions.SelectedIndex = int.Parse(MainV2.getConfig("video_options"));
}
}
private void CHK_hudshow_CheckedChanged(object sender, EventArgs e)
@ -935,7 +947,7 @@ namespace ArdupilotMega.GCSViews
}
catch { MessageBox.Show("Error: getting param list"); }

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Reflection;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO.Ports;
using System.IO;
using System.Runtime.InteropServices;
using System.Xml;
using System.Net;
using log4net;
namespace ArdupilotMega.GCSViews
{
partial class Firmware : MyUserControl
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.C))
{
OpenFileDialog fd = new OpenFileDialog();
fd.Filter = "Firmware (*.hex)|*.hex";
var fd = new OpenFileDialog {Filter = "Firmware (*.hex)|*.hex"};
fd.ShowDialog();
if (File.Exists(fd.FileName))
{
@ -69,7 +65,7 @@ namespace ArdupilotMega.GCSViews
internal void Firmware_Load(object sender, EventArgs e)
{
Console.WriteLine("FW load");
log.Info("FW load");
string url = "";
string url2560 = "";
@ -141,11 +137,14 @@ namespace ArdupilotMega.GCSViews
}
}
List<string> list = new List<string>();
}
catch (Exception ex) { MessageBox.Show("Failed to get Firmware List : " + ex.Message); }
Console.WriteLine("FW load done");
catch (Exception ex)
{
MessageBox.Show("Failed to get Firmware List : " + ex.Message);
}
log.Info("FW load done");
}
void updateDisplayName(software temp)
@ -192,7 +191,7 @@ namespace ArdupilotMega.GCSViews
}
else
{
Console.WriteLine("No Home " + temp.name + " " + temp.url);
log.Info("No Home " + temp.name + " " + temp.url);
}
}
@ -354,7 +353,7 @@ namespace ArdupilotMega.GCSViews
Console.WriteLine("Detected a " + board);
log.Info("Detected a " + board);
string baseurl = "";
if (board == "2560")
@ -375,7 +374,7 @@ namespace ArdupilotMega.GCSViews
return;
}
Console.WriteLine("Using " + baseurl);
log.Info("Using " + baseurl);
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create(baseurl);
@ -387,7 +386,7 @@ namespace ArdupilotMega.GCSViews
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
log.Info(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
@ -425,7 +424,7 @@ namespace ArdupilotMega.GCSViews
progress.Value = 100;
this.Refresh();
Console.WriteLine("Downloaded");
log.Info("Downloaded");
}
catch (Exception ex) { lbl_status.Text = "Failed download"; MessageBox.Show("Failed to download new firmware : " + ex.ToString()); return; }
@ -443,9 +442,18 @@ namespace ArdupilotMega.GCSViews
sr = new StreamReader(filename);
FLASH = readIntelHEXv2(sr);
sr.Close();
Console.WriteLine("\n\nSize: {0}\n\n", FLASH.Length);
log.InfoFormat("\n\nSize: {0}\n\n", FLASH.Length);
}
catch (Exception ex)
{
if (sr != null)
{
sr.Dispose();
}
lbl_status.Text = "Failed read HEX";
MessageBox.Show("Failed to read firmware.hex : " + ex.Message);
return;
}
catch (Exception ex) { if (sr != null) { sr.Dispose(); } lbl_status.Text = "Failed read HEX"; MessageBox.Show("Failed to read firmware.hex : " + ex.Message); return; }
ArduinoComms port = new ArduinoSTK();
if (board == "1280")
@ -460,8 +468,10 @@ namespace ArdupilotMega.GCSViews
}
else if (board == "2560" || board == "2560-2")
{
port = new ArduinoSTKv2();
port.BaudRate = 115200;
port = new ArduinoSTKv2
{
BaudRate = 115200
};
}
port.DataBits = 8;
port.StopBits = StopBits.One;
@ -478,7 +488,7 @@ namespace ArdupilotMega.GCSViews
if (port.connectAP())
{
Console.WriteLine("starting");
log.Info("starting");
lbl_status.Text = "Uploading " + FLASH.Length + " bytes to APM";
progress.Value = 0;
this.Refresh();
@ -486,7 +496,7 @@ namespace ArdupilotMega.GCSViews
// this is enough to make ap_var reset
//port.upload(new byte[256], 0, 2, 0);
port.Progress += new ProgressEventHandler(port_Progress);
port.Progress += port_Progress;
if (!port.uploadflash(FLASH, 0, FLASH.Length, 0))
{
@ -500,7 +510,7 @@ namespace ArdupilotMega.GCSViews
progress.Value = 100;
Console.WriteLine("Uploaded");
log.Info("Uploaded");
this.Refresh();
@ -518,7 +528,7 @@ namespace ArdupilotMega.GCSViews
progress.Value = (int)((start / (float)FLASH.Length) * 100);
progress.Refresh();
port.setaddress(start);
Console.WriteLine("Downloading " + length + " at " + start);
log.Info("Downloading " + length + " at " + start);
port.downloadflash(length).CopyTo(flashverify, start);
start += length;
}
@ -575,14 +585,19 @@ namespace ArdupilotMega.GCSViews
progress.Value = 100;
lbl_status.Text = "Done";
}
catch (Exception ex) { lbl_status.Text = "Failed upload"; MessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); }
catch (Exception ex)
{
lbl_status.Text = "Failed upload";
MessageBox.Show("Check port settings or Port in use? " + ex);
port.Close();
}
flashing = false;
MainV2.givecomport = false;
}
void port_Progress(int progress,string status)
{
Console.WriteLine("Progress {0} ", progress);
log.InfoFormat("Progress {0} ", progress);
this.progress.Value = progress;
this.progress.Refresh();
}
@ -607,7 +622,7 @@ namespace ArdupilotMega.GCSViews
int length = Convert.ToInt32(line.Substring(1, 2), 16);
int address = Convert.ToInt32(line.Substring(3, 4), 16);
int option = Convert.ToInt32(line.Substring(7, 2), 16);
Console.WriteLine("len {0} add {1} opt {2}", length, address, option);
log.InfoFormat("len {0} add {1} opt {2}", length, address, option);
if (option == 0)
{

View File

@ -55,7 +55,7 @@
this.zg1 = new ZedGraph.ZedGraphControl();
this.lbl_winddir = new ArdupilotMega.MyLabel();
this.lbl_windvel = new ArdupilotMega.MyLabel();
this.gMapControl1 = new myGMAP();
this.gMapControl1 = new ArdupilotMega.myGMAP();
this.panel1 = new System.Windows.Forms.Panel();
this.TXT_lat = new ArdupilotMega.MyLabel();
this.Zoomlevel = new System.Windows.Forms.NumericUpDown();

View File

@ -75,12 +75,14 @@ namespace ArdupilotMega.GCSViews
public static GMapControl mymap = null;
PointLatLngAlt GuidedModeWP = new PointLatLngAlt();
public static PointLatLngAlt GuidedModeWP = new PointLatLngAlt();
AviWriter aviwriter;
public SplitContainer MainHcopy = null;
public static FlightData instance;
protected override void Dispose(bool disposing)
{
threadrun = 0;
@ -94,6 +96,8 @@ namespace ArdupilotMega.GCSViews
{
InitializeComponent();
instance = this;
mymap = gMapControl1;
myhud = hud1;
MainHcopy = MainH;
@ -1013,11 +1017,27 @@ namespace ArdupilotMega.GCSViews
if (MainV2.comPort.logreadmode)
{
MainV2.comPort.logreadmode = false;
ZedGraphTimer.Stop();
}
else
{
BUT_clear_track_Click(sender, e);
MainV2.comPort.logreadmode = true;
list1.Clear();
list2.Clear();
list3.Clear();
list4.Clear();
list5.Clear();
list6.Clear();
list7.Clear();
list8.Clear();
list9.Clear();
list10.Clear();
tickStart = Environment.TickCount;
zg1.GraphPane.XAxis.Scale.Min = 0;
zg1.GraphPane.XAxis.Scale.Max = 1;
ZedGraphTimer.Start();
}
}

View File

@ -1391,7 +1391,7 @@
<value>gMapControl1</value>
</data>
<data name="&gt;&gt;gMapControl1.Type" xml:space="preserve">
<value>GMap.NET.WindowsForms.GMapControl, GMap.NET.WindowsForms, Version=1.5.5.5, Culture=neutral, PublicKeyToken=b85b9027b614afef</value>
<value>ArdupilotMega.myGMAP, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
<data name="&gt;&gt;gMapControl1.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>

View File

@ -18,6 +18,7 @@ using System.Resources;
using System.Reflection;
using System.ComponentModel;
using System.Threading;
using log4net;
using SharpKml.Base;
using SharpKml.Dom;
@ -27,6 +28,7 @@ namespace ArdupilotMega.GCSViews
{
partial class FlightPlanner : MyUserControl
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
int selectedrow = 0;
bool quickadd = false;
bool isonline = true;
@ -598,7 +600,7 @@ namespace ArdupilotMega.GCSViews
void Commands_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
Console.WriteLine(e.Exception.ToString() + " " + e.Context + " col " + e.ColumnIndex);
log.Info(e.Exception.ToString() + " " + e.Context + " col " + e.ColumnIndex);
e.Cancel = false;
e.ThrowException = false;
//throw new NotImplementedException();
@ -700,7 +702,7 @@ namespace ArdupilotMega.GCSViews
{
try
{
Console.WriteLine(Element.ToString() + " " + Element.Parent);
log.Info(Element.ToString() + " " + Element.Parent);
}
catch { }
@ -924,7 +926,7 @@ namespace ArdupilotMega.GCSViews
drawnpolygons.Markers.Add(m);
drawnpolygons.Markers.Add(mBorders);
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
catch (Exception ex) { log.Info(ex.ToString()); }
}
/// <summary>
@ -1052,7 +1054,7 @@ namespace ArdupilotMega.GCSViews
System.Diagnostics.Debug.WriteLine(temp - System.Diagnostics.Stopwatch.GetTimestamp());
}
}
catch (Exception e) { Console.WriteLine("writekml - bad wp data " + e.ToString()); }
catch (Exception e) { log.Info("writekml - bad wp data " + e.ToString()); }
}
if (usable > 0)
@ -1128,7 +1130,7 @@ namespace ArdupilotMega.GCSViews
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
log.Info(ex.ToString());
}
System.Diagnostics.Debug.WriteLine(DateTime.Now);
@ -1213,18 +1215,18 @@ namespace ArdupilotMega.GCSViews
param = port.param;
Console.WriteLine("Getting WP #");
log.Info("Getting WP #");
int cmdcount = port.getWPCount();
for (ushort a = 0; a < cmdcount; a++)
{
Console.WriteLine("Getting WP" + a);
log.Info("Getting WP" + a);
cmds.Add(port.getWP(a));
}
port.setWPACK();
Console.WriteLine("Done");
log.Info("Done");
}
catch (Exception ex) { error = 1; MessageBox.Show("Error : " + ex.ToString()); }
try
@ -1237,7 +1239,7 @@ namespace ArdupilotMega.GCSViews
{
processToScreen(cmds);
}
catch (Exception exx) { Console.WriteLine(exx.ToString()); }
catch (Exception exx) { log.Info(exx.ToString()); }
}
MainV2.givecomport = false;
@ -1248,7 +1250,7 @@ namespace ArdupilotMega.GCSViews
});
}
catch (Exception exx) { Console.WriteLine(exx.ToString()); }
catch (Exception exx) { log.Info(exx.ToString()); }
});
t12.IsBackground = true;
t12.Name = "Read wps";
@ -2523,7 +2525,7 @@ namespace ArdupilotMega.GCSViews
double x = bottomleft.Lat - Math.Abs(fulllatdiff);
double y = bottomleft.Lng - Math.Abs(fulllngdiff);
Console.WriteLine("{0} < {1} {2} < {3}", x, (topright.Lat), y, (topright.Lng));
log.InfoFormat("{0} < {1} {2} < {3}", x, (topright.Lat), y, (topright.Lng));
while (x < (topright.Lat + Math.Abs(fulllatdiff)) && y < (topright.Lng + Math.Abs(fulllngdiff)))
{

View File

@ -24,7 +24,7 @@ namespace ArdupilotMega.GCSViews
public void BUT_updatecheck_Click(object sender, EventArgs e)
{
MainV2.doupdate();
MainV2.DoUpdate();
}
private void CHK_showconsole_CheckedChanged(object sender, EventArgs e)

View File

@ -9,6 +9,7 @@ using System.IO.Ports;
using System.IO;
using System.Xml; // config file
using System.Runtime.InteropServices; // dll imports
using log4net;
using ZedGraph; // Graphs
using ArdupilotMega;
using ArdupilotMega.Mavlink;
@ -21,6 +22,7 @@ namespace ArdupilotMega.GCSViews
{
public partial class Simulation : MyUserControl
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
MAVLink comPort = MainV2.comPort;
UdpClient XplanesSEND;
UdpClient MavLink;
@ -570,7 +572,6 @@ namespace ArdupilotMega.GCSViews
// re-request servo data
if (!(lastdata.AddSeconds(8) > DateTime.Now))
{
Console.WriteLine("REQ streams - sim");
try
{
if (CHK_quad.Checked && !RAD_aerosimrc.Checked)// || chkSensor.Checked && RAD_JSBSim.Checked)
@ -610,12 +611,6 @@ namespace ArdupilotMega.GCSViews
{
Byte[] receiveBytes = MavLink.Receive(ref RemoteIpEndPoint);
Console.WriteLine("sending " + receiveBytes[5]);
if (receiveBytes[5] == 39)
{
Console.WriteLine("wp no " + receiveBytes[9]); // ??
}
comPort.BaseStream.Write(receiveBytes, 0, receiveBytes.Length);
}
@ -633,7 +628,7 @@ namespace ArdupilotMega.GCSViews
processArduPilot();
}
}
catch (Exception ex) { Console.WriteLine("SIM Main loop exception " + ex.ToString()); }
catch (Exception ex) { log.Info("SIM Main loop exception " + ex.ToString()); }
if (hzcounttime.Second != DateTime.Now.Second)
{
@ -689,7 +684,7 @@ namespace ArdupilotMega.GCSViews
JSBSimSEND.Client.Send(System.Text.Encoding.ASCII.GetBytes("resume\r\n"));
}
catch { Console.WriteLine("JSB console fail"); }
catch { log.Info("JSB console fail"); }
}
private void SetupUDPXplanes()
@ -1348,7 +1343,7 @@ namespace ArdupilotMega.GCSViews
quad.update(ref m, lastfdmdata);
}
catch (Exception e) { Console.WriteLine("Quad hill error " + e.ToString()); }
catch (Exception e) { log.Info("Quad hill error " + e.ToString()); }
byte[] FlightGear = new byte[8 * 11];// StructureToByteArray(fg);
@ -1385,7 +1380,7 @@ namespace ArdupilotMega.GCSViews
{
XplanesSEND.Send(FlightGear, FlightGear.Length);
}
catch (Exception) { Console.WriteLine("Socket Write failed, FG closed?"); }
catch (Exception) { log.Info("Socket Write failed, FG closed?"); }
updateScreenDisplay(lastfdmdata.latitude, lastfdmdata.longitude, lastfdmdata.altitude * .3048, lastfdmdata.phi, lastfdmdata.theta, lastfdmdata.psi, lastfdmdata.psi, m[0], m[1], m[2], m[3]);
@ -1491,7 +1486,7 @@ namespace ArdupilotMega.GCSViews
}
}
}
catch (Exception e) { Console.WriteLine("Error updateing screen stuff " + e.ToString()); }
catch (Exception e) { log.Info("Error updateing screen stuff " + e.ToString()); }
packetssent++;
@ -1580,7 +1575,7 @@ namespace ArdupilotMega.GCSViews
{
XplanesSEND.Send(FlightGear, FlightGear.Length);
}
catch (Exception) { Console.WriteLine("Socket Write failed, FG closed?"); }
catch (Exception) { log.Info("Socket Write failed, FG closed?"); }
}
@ -1661,7 +1656,7 @@ namespace ArdupilotMega.GCSViews
XplanesSEND.Send(Xplane, Xplane.Length);
}
catch (Exception e) { Console.WriteLine("Xplanes udp send error " + e.Message); }
catch (Exception e) { log.Info("Xplanes udp send error " + e.Message); }
}
}

View File

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using log4net;
using YLScsDrawing.Drawing3d;
using ArdupilotMega.HIL;
@ -101,6 +103,7 @@ namespace ArdupilotMega.HIL
public class QuadCopter : Aircraft
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
QuadCopter self;
int framecount = 0;

View File

@ -11,7 +11,7 @@ using System.Drawing.Imaging;
using System.Threading;
using System.Drawing.Drawing2D;
using log4net;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using OpenTK.Graphics;
@ -24,6 +24,8 @@ namespace hud
{
public class HUD : GLControl
{
private static readonly ILog log = LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
object paintlock = new object();
object streamlock = new object();
MemoryStream _streamjpg = new MemoryStream();
@ -189,10 +191,10 @@ namespace hud
{
GraphicsMode test = this.GraphicsMode;
Console.WriteLine(test.ToString());
Console.WriteLine("Vendor: " + GL.GetString(StringName.Vendor));
Console.WriteLine("Version: " + GL.GetString(StringName.Version));
Console.WriteLine("Device: " + GL.GetString(StringName.Renderer));
log.Info(test.ToString());
log.Info("Vendor: " + GL.GetString(StringName.Vendor));
log.Info("Version: " + GL.GetString(StringName.Version));
log.Info("Device: " + GL.GetString(StringName.Renderer));
//Console.WriteLine("Extensions: " + GL.GetString(StringName.Extensions));
int[] viewPort = new int[4];
@ -212,7 +214,7 @@ namespace hud
GL.Enable(EnableCap.Blend);
}
catch (Exception ex) { Console.WriteLine("HUD opengl onload " + ex.ToString()); }
catch (Exception ex) { log.Info("HUD opengl onload " + ex.ToString()); }
try
{
@ -266,7 +268,7 @@ namespace hud
if (inOnPaint)
{
Console.WriteLine("Was in onpaint Hud th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread);
log.Info("Was in onpaint Hud th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread);
return;
}
@ -295,7 +297,7 @@ namespace hud
}
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
catch (Exception ex) { log.Info(ex.ToString()); }
inOnPaint = false;
@ -1323,7 +1325,7 @@ namespace hud
}
catch (Exception ex)
{
Console.WriteLine("hud error "+ex.ToString());
log.Info("hud error "+ex.ToString());
}
}
@ -1531,7 +1533,7 @@ namespace hud
base.OnHandleCreated(e);
}
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); opengl = false; } // macs fail here
catch (Exception ex) { log.Info(ex.ToString()); opengl = false; } // macs fail here
}
protected override void OnHandleDestroyed(EventArgs e)
@ -1543,7 +1545,7 @@ namespace hud
base.OnHandleDestroyed(e);
}
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); opengl = false; }
catch (Exception ex) { log.Info(ex.ToString()); opengl = false; }
}
protected override void OnResize(EventArgs e)

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using log4net;
using Microsoft.DirectX.DirectInput;
using System.Reflection;
@ -10,6 +11,7 @@ namespace ArdupilotMega
{
public class Joystick
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
Device joystick;
JoystickState state;
public bool enabled = false;
@ -148,12 +150,12 @@ namespace ArdupilotMega
{
//Console.WriteLine("Name: " + property.Name + ", Value: " + property.GetValue(obj, null));
Console.WriteLine("test name {0} old {1} new {2} ", property.Name, values[property.Name], int.Parse(property.GetValue(nextstate, null).ToString()));
Console.WriteLine("{0} {1}", (int)values[property.Name], (int.Parse(property.GetValue(nextstate, null).ToString()) + threshold));
log.InfoFormat("test name {0} old {1} new {2} ", property.Name, values[property.Name], int.Parse(property.GetValue(nextstate, null).ToString()));
log.InfoFormat("{0} {1}", (int)values[property.Name], (int.Parse(property.GetValue(nextstate, null).ToString()) + threshold));
if ((int)values[property.Name] > (int.Parse(property.GetValue(nextstate, null).ToString()) + threshold) ||
(int)values[property.Name] < (int.Parse(property.GetValue(nextstate, null).ToString()) - threshold))
{
Console.WriteLine("{0}", property.Name);
log.Info(property.Name);
joystick.Unacquire();
return (joystickaxis)Enum.Parse(typeof(joystickaxis), property.Name);
}
@ -337,7 +339,7 @@ namespace ArdupilotMega
//Console.WriteLine("{0} {1} {2} {3}", MainV2.cs.rcoverridech1, MainV2.cs.rcoverridech2, MainV2.cs.rcoverridech3, MainV2.cs.rcoverridech4);
}
catch (Exception ex) { Console.WriteLine("Joystick thread error "+ex.ToString()); } // so we cant fall out
catch (Exception ex) { log.Info("Joystick thread error "+ex.ToString()); } // so we cant fall out
}
}
@ -484,7 +486,7 @@ namespace ArdupilotMega
state = joystick.CurrentJoystickState;
ushort ans = pickchannel(channel, JoyChannels[channel].axis, JoyChannels[channel].reverse, JoyChannels[channel].expo);
Console.WriteLine("{0} = {1} = {2}",channel,ans, state.X);
log.DebugFormat("{0} = {1} = {2}",channel,ans, state.X);
return ans;
}

View File

@ -0,0 +1,64 @@
//this file contains some simple extension methods
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.ComponentModel;
using System.Windows.Forms;
namespace ArdupilotMega
{
static class CultureInfoEx
{
public static CultureInfo GetCultureInfo(string name)
{
try { return new CultureInfo(name); }
catch (Exception) { return null; }
}
public static bool IsChildOf(this CultureInfo cX, CultureInfo cY)
{
if (cX == null || cY == null)
return false;
CultureInfo c = cX;
while (!c.Equals(CultureInfo.InvariantCulture))
{
if (c.Equals(cY))
return true;
c = c.Parent;
}
return false;
}
}
static class ComponentResourceManagerEx
{
public static void ApplyResource(this ComponentResourceManager rm, Control ctrl)
{
rm.ApplyResources(ctrl, ctrl.Name);
foreach (Control subctrl in ctrl.Controls)
ApplyResource(rm, subctrl);
if (ctrl.ContextMenu != null)
ApplyResource(rm, ctrl.ContextMenu);
if (ctrl is DataGridView)
{
foreach (DataGridViewColumn col in (ctrl as DataGridView).Columns)
rm.ApplyResources(col, col.Name);
}
}
public static void ApplyResource(this ComponentResourceManager rm, Menu menu)
{
rm.ApplyResources(menu, menu.Name);
foreach (MenuItem submenu in menu.MenuItems)
ApplyResource(rm, submenu);
}
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
@ -15,16 +16,17 @@ using Core.Geometry;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Core;
using log4net;
namespace ArdupilotMega
{
public partial class Log : Form
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
ICommsSerial comPort;
int logcount = 0;
serialstatus status = serialstatus.Connecting;
byte[] buffer = new byte[4000];
StreamWriter sw;
int currentlog = 0;
bool threadrun = true;
@ -72,14 +74,15 @@ namespace ArdupilotMega
comPort.toggleDTR();
//comPort.Open();
}
catch (Exception)
catch (Exception ex)
{
log.Error("Error opening comport", ex);
MessageBox.Show("Error opening comport");
}
System.Threading.Thread t11 = new System.Threading.Thread(delegate()
var t11 = new System.Threading.Thread(delegate()
{
DateTime start = DateTime.Now;
var start = DateTime.Now;
threadrun = true;
@ -89,7 +92,9 @@ namespace ArdupilotMega
{
comPort.Write("\n\n\n\n"); // more in "connecting"
}
catch { }
catch
{
}
while (threadrun)
{
@ -105,11 +110,13 @@ namespace ArdupilotMega
comPort_DataReceived((object)null, (SerialDataReceivedEventArgs)null);
}
}
catch (Exception ex) { Console.WriteLine("crash in comport reader " + ex.ToString()); } // cant exit unless told to
catch (Exception ex)
{
log.Error("crash in comport reader " + ex);
} // cant exit unless told to
}
Console.WriteLine("Comport thread close");
});
t11.Name = "comport reader";
log.Info("Comport thread close");
}) {Name = "comport reader"};
t11.Start();
MainV2.threads.Add(t11);
@ -303,7 +310,7 @@ namespace ArdupilotMega
}
}
Console.WriteLine("exit while");
log.Info("exit while");
}
catch (Exception ex) { MessageBox.Show("Error reading data" + ex.ToString()); }
}
@ -532,7 +539,7 @@ namespace ArdupilotMega
Style style2 = new Style();
Color color = Color.FromArgb(0xff, (stylecode >> 16) & 0xff, (stylecode >> 8) & 0xff, (stylecode >> 0) & 0xff);
Console.WriteLine("colour " + color.ToArgb().ToString("X") + " " + color.ToKnownColor().ToString());
log.Info("colour " + color.ToArgb().ToString("X") + " " + color.ToKnownColor().ToString());
style2.Add(new LineStyle(color, 4));

View File

@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.IO;
using log4net;
using ZedGraph; // Graphs
using System.Xml;
@ -13,6 +15,7 @@ namespace ArdupilotMega
{
public partial class LogBrowse : Form
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
int m_iColumnCount = 0;
DataTable m_dtCSV = new DataTable();
@ -180,7 +183,7 @@ namespace ArdupilotMega
if (inner.Name.StartsWith("F"))
{
dataGridView1.Columns[a].HeaderText = inner.ReadString();
Console.WriteLine(a + " " + dataGridView1.Columns[a].HeaderText);
log.Info(a + " " + dataGridView1.Columns[a].HeaderText);
a++;
}
@ -194,7 +197,7 @@ namespace ArdupilotMega
}
}
catch { Console.WriteLine("DGV logbrowse error"); }
catch { log.Info("DGV logbrowse error"); }
}
public void CreateChart(ZedGraphControl zgc)
@ -308,7 +311,7 @@ namespace ArdupilotMega
break;
}
}
catch { error++; Console.WriteLine("Bad Data : " + type + " " + col + " " + a); if (error >= 500) { MessageBox.Show("There is to much bad data - failing"); break; } }
catch { error++; log.Info("Bad Data : " + type + " " + col + " " + a); if (error >= 500) { MessageBox.Show("There is to much bad data - failing"); break; } }
}
a++;
}

View File

@ -13,11 +13,13 @@ using System.Threading;
using ArdupilotMega.Controls;
using ArdupilotMega.Mavlink;
using System.ComponentModel;
using log4net;
namespace ArdupilotMega
{
public partial class MAVLink
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public ICommsSerial BaseStream = new SerialPort();
private const double CONNECT_TIMEOUT_SECONDS = 30;
@ -220,7 +222,7 @@ namespace ArdupilotMega
// incase we are in setup mode
BaseStream.WriteLine("planner\rgcs\r");
Console.WriteLine(DateTime.Now.Millisecond + " start ");
log.Info(DateTime.Now.Millisecond + " start ");
if (lastbad[0] == '!' && lastbad[1] == 'G' || lastbad[0] == 'G' && lastbad[1] == '!') // waiting for gps lock
{
@ -255,7 +257,7 @@ namespace ArdupilotMega
try
{
Console.WriteLine("MAv Data: len " + buffer.Length + " btr " + BaseStream.BytesToRead);
log.Info("MAv Data: len " + buffer.Length + " btr " + BaseStream.BytesToRead);
}
catch { }
@ -271,7 +273,7 @@ namespace ArdupilotMega
sysid = buffer[3];
compid = buffer[4];
recvpacketcount = buffer[2];
Console.WriteLine("ID sys {0} comp {1} ver{2}", sysid, compid, mavlinkversion);
log.InfoFormat("ID sys {0} comp {1} ver{2}", sysid, compid, mavlinkversion);
break;
}
@ -311,7 +313,7 @@ namespace ArdupilotMega
//frmProgressReporter.Close();
MainV2.givecomport = false;
frmProgressReporter.UpdateProgressAndStatus(100, "Done.");
Console.WriteLine("Done open " + sysid + " " + compid);
log.Info("Done open " + sysid + " " + compid);
packetslost = 0;
}
@ -349,7 +351,7 @@ namespace ArdupilotMega
}
if (!run)
{
Console.WriteLine("Mavlink : NOT VALID PACKET sendPacket() " + indata.GetType().ToString());
log.Info("Mavlink : NOT VALID PACKET sendPacket() " + indata.GetType().ToString());
}
}
@ -484,7 +486,7 @@ namespace ArdupilotMega
{
if (!param.ContainsKey(paramname))
{
Console.WriteLine("Param doesnt exist " + paramname);
log.Info("Param doesnt exist " + paramname);
return false;
}
@ -507,7 +509,7 @@ namespace ArdupilotMega
generatePacket(MAVLINK_MSG_ID_PARAM_SET, req);
Console.WriteLine("setParam '{0}' = '{1}' sysid {2} compid {3}", paramname, req.param_value, sysid, compid);
log.InfoFormat("setParam '{0}' = '{1}' sysid {2} compid {3}", paramname, req.param_value, sysid, compid);
DateTime start = DateTime.Now;
int retrys = 3;
@ -518,7 +520,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("setParam Retry " + retrys);
log.Info("setParam Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_PARAM_SET, req);
start = DateTime.Now;
retrys--;
@ -546,7 +548,7 @@ namespace ArdupilotMega
if (st != paramname)
{
Console.WriteLine("MAVLINK bad param responce - {0} vs {1}", paramname, st);
log.InfoFormat("MAVLINK bad param responce - {0} vs {1}", paramname, st);
continue;
}
@ -635,7 +637,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("getParamList Retry {0} sys {1} comp {2}", retrys, sysid, compid);
log.InfoFormat("getParamList Retry {0} sys {1} comp {2}", retrys, sysid, compid);
generatePacket(MAVLINK_MSG_ID_PARAM_REQUEST_LIST, req);
start = DateTime.Now;
retrys--;
@ -676,7 +678,7 @@ namespace ArdupilotMega
continue;
}
Console.WriteLine(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (param_total - 1) + " name: " + paramID);
log.Info(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (param_total - 1) + " name: " + paramID);
modifyParamForDisplay(true, paramID, ref par.param_value);
param[paramID] = (par.param_value);
@ -753,7 +755,7 @@ namespace ArdupilotMega
generatePacket(MAVLINK_MSG_ID_REQUEST_DATA_STREAM, req);
System.Threading.Thread.Sleep(20);
generatePacket(MAVLINK_MSG_ID_REQUEST_DATA_STREAM, req);
Console.WriteLine("Stopall Done");
log.Info("Stopall Done");
}
catch { }
@ -801,7 +803,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("setWPCurrent Retry " + retrys);
log.Info("setWPCurrent Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_MISSION_SET_CURRENT, req);
start = DateTime.Now;
retrys--;
@ -864,7 +866,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("doAction Retry " + retrys);
log.Info("doAction Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_COMMAND_LONG, req);
start = DateTime.Now;
retrys--;
@ -918,7 +920,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("setWPCurrent Retry " + retrys);
log.Info("setWPCurrent Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_WAYPOINT_SET_CURRENT, req);
start = DateTime.Now;
retrys--;
@ -976,7 +978,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("doAction Retry " + retrys);
log.Info("doAction Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_ACTION, req);
start = DateTime.Now;
retrys--;
@ -1092,7 +1094,7 @@ namespace ArdupilotMega
return;
}
Console.WriteLine("Request stream {0} at {1} hz : currently {2}", Enum.Parse(typeof(MAV_DATA_STREAM), id.ToString()), hzrate, pps);
log.InfoFormat("Request stream {0} at {1} hz : currently {2}", Enum.Parse(typeof(MAV_DATA_STREAM), id.ToString()), hzrate, pps);
getDatastream(id, hzrate);
}
@ -1165,7 +1167,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport);
log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport);
generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST_LIST, req);
start = DateTime.Now;
retrys--;
@ -1187,13 +1189,13 @@ namespace ArdupilotMega
var count = buffer.ByteArrayToStructure<__mavlink_mission_count_t>(6);
Console.WriteLine("wpcount: " + count.count);
log.Info("wpcount: " + count.count);
MainV2.givecomport = false;
return (byte)count.count; // should be ushort, but apm has limited wp count < byte
}
else
{
Console.WriteLine(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_MISSION_COUNT + " " + this.BaseStream.BytesToRead);
log.Info(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_MISSION_COUNT + " " + this.BaseStream.BytesToRead);
}
}
}
@ -1216,7 +1218,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport);
log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport);
generatePacket(MAVLINK_MSG_ID_WAYPOINT_REQUEST_LIST, req);
start = DateTime.Now;
retrys--;
@ -1233,13 +1235,13 @@ namespace ArdupilotMega
if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_COUNT)
{
Console.WriteLine("wpcount: " + buffer[9]);
log.Info("wpcount: " + buffer[9]);
MainV2.givecomport = false;
return buffer[9]; // should be ushort, but apm has limited wp count < byte
}
else
{
Console.WriteLine(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_WAYPOINT_COUNT + " " + this.BaseStream.BytesToRead);
log.Info(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_WAYPOINT_COUNT + " " + this.BaseStream.BytesToRead);
}
}
}
@ -1277,7 +1279,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("getWP Retry " + retrys);
log.Info("getWP Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST, req);
start = DateTime.Now;
retrys--;
@ -1324,7 +1326,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("getWP Retry " + retrys);
log.Info("getWP Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_WAYPOINT_REQUEST, req);
start = DateTime.Now;
retrys--;
@ -1419,13 +1421,13 @@ namespace ArdupilotMega
}
}
*/
Console.WriteLine("getWP {0} {1} {2} {3} {4} opt {5}", loc.id, loc.p1, loc.alt, loc.lat, loc.lng, loc.options);
log.InfoFormat("getWP {0} {1} {2} {3} {4} opt {5}", loc.id, loc.p1, loc.alt, loc.lat, loc.lng, loc.options);
break;
}
else
{
Console.WriteLine(DateTime.Now + " PC getwp " + buffer[5]);
log.Info(DateTime.Now + " PC getwp " + buffer[5]);
}
}
}
@ -1529,7 +1531,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("setWPTotal Retry " + retrys);
log.Info("setWPTotal Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_MISSION_COUNT, req);
start = DateTime.Now;
retrys--;
@ -1584,7 +1586,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("setWPTotal Retry " + retrys);
log.Info("setWPTotal Retry " + retrys);
generatePacket(MAVLINK_MSG_ID_WAYPOINT_COUNT, req);
start = DateTime.Now;
retrys--;
@ -1707,7 +1709,7 @@ namespace ArdupilotMega
*/
req.seq = index;
Console.WriteLine("setWP {6} frame {0} cmd {1} p1 {2} x {3} y {4} z {5}", req.frame, req.command, req.param1, req.x, req.y, req.z, index);
log.InfoFormat("setWP {6} frame {0} cmd {1} p1 {2} x {3} y {4} z {5}", req.frame, req.command, req.param1, req.x, req.y, req.z, index);
// request
#if MAVLINK10
@ -1725,7 +1727,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("setWP Retry " + retrys);
log.Info("setWP Retry " + retrys);
#if MAVLINK10
generatePacket(MAVLINK_MSG_ID_MISSION_ITEM, req);
#else
@ -1749,7 +1751,7 @@ namespace ArdupilotMega
var ans = buffer.ByteArrayToStructure<__mavlink_mission_ack_t>(6);
Console.WriteLine("set wp " + index + " ACK 47 : " + buffer[5] + " ans " + Enum.Parse(typeof(MAV_MISSION_RESULT), ans.type.ToString()));
log.Info("set wp " + index + " ACK 47 : " + buffer[5] + " ans " + Enum.Parse(typeof(MAV_MISSION_RESULT), ans.type.ToString()));
break;
}
else if (buffer[5] == MAVLINK_MSG_ID_MISSION_REQUEST)
@ -1761,13 +1763,13 @@ namespace ArdupilotMega
if (ans.seq == (index + 1))
{
Console.WriteLine("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]);
log.Info("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]);
MainV2.givecomport = false;
break;
}
else
{
Console.WriteLine("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
log.Info("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
//break;
}
}
@ -1778,7 +1780,7 @@ namespace ArdupilotMega
#else
if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_ACK)
{ //__mavlink_waypoint_request_t
Console.WriteLine("set wp " + index + " ACK 47 : " + buffer[5]);
log.Info("set wp " + index + " ACK 47 : " + buffer[5]);
break;
}
else if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_REQUEST)
@ -1787,13 +1789,13 @@ namespace ArdupilotMega
if (ans.seq == (index + 1))
{
Console.WriteLine("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]);
log.Info("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]);
MainV2.givecomport = false;
break;
}
else
{
Console.WriteLine("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
log.InfoFormat("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
//break;
}
}
@ -1914,7 +1916,7 @@ namespace ArdupilotMega
{
if (readcount > 300)
{
Console.WriteLine("MAVLink readpacket No valid mavlink packets");
log.Info("MAVLink readpacket No valid mavlink packets");
break;
}
readcount++;
@ -1949,27 +1951,22 @@ namespace ArdupilotMega
{
MainV2.cs.datetime = DateTime.Now;
int to = 0;
DateTime to = DateTime.Now.AddMilliseconds(BaseStream.ReadTimeout);
while (BaseStream.BytesToRead <= 0)
{
if (to > BaseStream.ReadTimeout)
if (DateTime.Now > to)
{
Console.WriteLine("MAVLINK: wait time out btr {0} len {1}", BaseStream.BytesToRead, length);
log.InfoFormat("MAVLINK: S wait time out btr {0} len {1}", BaseStream.BytesToRead, length);
throw new Exception("Timeout");
}
System.Threading.Thread.Sleep(1);
// if (!MainV2.instance.InvokeRequired)
// {
// System.Windows.Forms.Application.DoEvents(); // when connecting this is in the main thread
// }
to++;
}
if (BaseStream.IsOpen)
temp[count] = (byte)BaseStream.ReadByte();
}
}
catch (Exception e) { Console.WriteLine("MAVLink readpacket read error: " + e.Message); break; }
catch (Exception e) { log.Info("MAVLink readpacket read error: " + e.Message); break; }
if (temp[0] != 254 && temp[0] != 'U' || lastbad[0] == 'I' && lastbad[1] == 'M' || lastbad[1] == 'G' || lastbad[1] == 'A') // out of sync "AUTO" "GUIDED" "IMU"
{
@ -1996,7 +1993,7 @@ namespace ArdupilotMega
{
if (sysid != temp[3] || compid != temp[4])
{
Console.WriteLine("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", temp[3], temp[4], sysid, compid);
log.InfoFormat("Mavlink Bad Packet (not addressed to this MAV) got {0} {1} vs {2} {3}", temp[3], temp[4], sysid, compid);
return new byte[0];
}
}
@ -2009,21 +2006,15 @@ namespace ArdupilotMega
}
else
{
int to = 0;
DateTime to = DateTime.Now.AddMilliseconds(BaseStream.ReadTimeout);
while (BaseStream.BytesToRead < (length - 4))
{
if (to > 1000)
if (DateTime.Now > to)
{
Console.WriteLine("MAVLINK: wait time out btr {0} len {1}", BaseStream.BytesToRead, length);
log.InfoFormat("MAVLINK: L wait time out btr {0} len {1}", BaseStream.BytesToRead, length);
break;
}
System.Threading.Thread.Sleep(1);
if (!MainV2.instance.InvokeRequired)
{
System.Windows.Forms.Application.DoEvents(); // when connecting this is in the main thread
}
to++;
//Console.WriteLine("data " + 0 + " " + length + " aval " + BaseStream.BytesToRead);
}
if (BaseStream.IsOpen)
@ -2083,7 +2074,7 @@ namespace ArdupilotMega
if (temp.Length > 5 && temp[1] != MAVLINK_MESSAGE_LENGTHS[temp[5]])
{
Console.WriteLine("Mavlink Bad Packet (Len Fail) len {0} pkno {1}", temp.Length, temp[5]);
log.InfoFormat("Mavlink Bad Packet (Len Fail) len {0} pkno {1}", temp.Length, temp[5]);
#if MAVLINK10
if (temp.Length == 11 && temp[0] == 'U' && temp[5] == 0)
throw new Exception("Mavlink 0.9 Heartbeat, Please upgrade your AP, This planner is for Mavlink 1.0\n\n");
@ -2098,7 +2089,7 @@ namespace ArdupilotMega
{
packetno = temp[5];
}
Console.WriteLine("Mavlink Bad Packet (crc fail) len {0} crc {1} pkno {2}", temp.Length, crc, packetno);
log.InfoFormat("Mavlink Bad Packet (crc fail) len {0} crc {1} pkno {2}", temp.Length, crc, packetno);
return new byte[0];
}
@ -2120,7 +2111,7 @@ namespace ArdupilotMega
packetslost += temp[2] - recvpacketcount;
}
Console.WriteLine("lost {0} pkts {1}", temp[2], (int)packetslost);
log.InfoFormat("lost {0} pkts {1}", temp[2], (int)packetslost);
}
packetsnotlost++;
@ -2155,7 +2146,7 @@ namespace ArdupilotMega
int ind = logdata.IndexOf('\0');
if (ind != -1)
logdata = logdata.Substring(0, ind);
Console.WriteLine(DateTime.Now + " " + logdata);
log.Info(DateTime.Now + " " + logdata);
if (MainV2.talk != null && MainV2.config["speechenable"] != null && MainV2.config["speechenable"].ToString() == "True")
{
@ -2250,7 +2241,7 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
Console.WriteLine("getFencePoint Retry " + retrys + " - giv com " + MainV2.givecomport);
log.Info("getFencePoint Retry " + retrys + " - giv com " + MainV2.givecomport);
generatePacket(MAVLINK_MSG_ID_FENCE_FETCH_POINT, req);
start = DateTime.Now;
retrys--;
@ -2386,7 +2377,7 @@ namespace ArdupilotMega
temp[a] = (byte)logplaybackfile.ReadByte();
if (temp[0] != 'U' && temp[0] != 254)
{
Console.WriteLine("lost sync byte {0} pos {1}", temp[0], logplaybackfile.BaseStream.Position);
log.InfoFormat("lost sync byte {0} pos {1}", temp[0], logplaybackfile.BaseStream.Position);
a = 0;
continue;
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
@ -20,11 +21,14 @@ using System.Globalization;
using System.Threading;
using System.Net.Sockets;
using IronPython.Hosting;
using log4net;
namespace ArdupilotMega
{
public partial class MainV2 : Form
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
[DllImport("user32.dll")]
public static extern int FindWindow(string szClass, string szTitle);
[DllImport("user32.dll")]
@ -250,7 +254,7 @@ namespace ArdupilotMega
string[] devs = new string[0];
Console.WriteLine("Get Comports");
log.Debug("Geting Comports");
if (MONO)
{
@ -775,7 +779,7 @@ namespace ArdupilotMega
if ((buffer[0] == 'A' || buffer[0] == 'P') && (buffer[1] == 'A' || buffer[1] == 'P')) // this is the apvar header
{
Console.WriteLine("Valid eeprom contents");
log.Info("Valid eeprom contents");
}
else
{
@ -961,11 +965,11 @@ namespace ArdupilotMega
break;
}
}
catch (Exception ee) { Console.WriteLine(ee.Message); } // silent fail on bad entry
catch (Exception ee) { log.Info(ee.Message); } // silent fail on bad entry
}
}
}
catch (Exception ex) { Console.WriteLine("Bad Config File: " + ex.ToString()); } // bad config file
catch (Exception ex) { log.Info("Bad Config File: " + ex.ToString()); } // bad config file
}
}
@ -1179,7 +1183,7 @@ namespace ArdupilotMega
}
catch (Exception e)
{
Console.WriteLine("Serial Reader fail :" + e.Message);
log.Info("Serial Reader fail :" + e.Message);
try
{
comPort.Close();
@ -1247,7 +1251,7 @@ namespace ArdupilotMega
try
{
listener = new TcpListener(IPAddress.Any, 56781);
System.Threading.Thread t13 = new System.Threading.Thread(new System.Threading.ThreadStart(listernforclients))
var t13 = new Thread(listernforclients)
{
Name = "motion jpg stream",
IsBackground = true
@ -1257,10 +1261,11 @@ namespace ArdupilotMega
}
catch (Exception ex)
{
log.Error("Error starting TCP listener thread: ", ex);
MessageBox.Show(ex.ToString());
}
System.Threading.Thread t12 = new System.Threading.Thread(new ThreadStart(joysticksend))
var t12 = new Thread(new ThreadStart(joysticksend))
{
IsBackground = true,
Priority = ThreadPriority.AboveNormal,
@ -1268,18 +1273,28 @@ namespace ArdupilotMega
};
t12.Start();
System.Threading.Thread t11 = new System.Threading.Thread(new ThreadStart(SerialReader))
var t11 = new Thread(SerialReader)
{
IsBackground = true,
Name = "Main Serial reader"
};
t11.Start();
if (Debugger.IsAttached)
{
log.Info("Skipping update test as it appears we are debugging");
}
else
{
try
{
checkForUpdate();
CheckForUpdate();
}
catch (Exception ex)
{
log.Error("Update check failed", ex);
}
}
catch { Console.WriteLine("update check failed"); }
}
public static String ComputeWebSocketHandshakeSecurityHash09(String secWebSocketKey)
@ -1310,7 +1325,7 @@ namespace ArdupilotMega
{
listener.Start();
}
catch { Console.WriteLine("do you have the planner open already"); return; } // in use
catch { log.Info("do you have the planner open already"); return; } // in use
// Enter the listening loop.
while (true)
{
@ -1318,10 +1333,10 @@ namespace ArdupilotMega
// You could also user server.AcceptSocket() here.
try
{
Console.WriteLine("Listening for client - 1 client at a time");
log.Info("Listening for client - 1 client at a time");
TcpClient client = listener.AcceptTcpClient();
// Get a stream object for reading and writing
Console.WriteLine("Accepted Client " + client.Client.RemoteEndPoint.ToString());
log.Info("Accepted Client " + client.Client.RemoteEndPoint.ToString());
//client.SendBufferSize = 100 * 1024; // 100kb
//client.LingerState.Enabled = true;
//client.NoDelay = true;
@ -1344,7 +1359,7 @@ namespace ArdupilotMega
int len = stream.Read(request, 0, request.Length);
string head = System.Text.ASCIIEncoding.ASCII.GetString(request, 0, len);
Console.WriteLine(head);
log.Info(head);
int index = head.IndexOf('\n');
@ -1380,7 +1395,7 @@ namespace ArdupilotMega
while (client.Connected)
{
System.Threading.Thread.Sleep(200);
Console.WriteLine(stream.DataAvailable + " " + client.Available);
log.Info(stream.DataAvailable + " " + client.Available);
while (client.Available > 0)
{
@ -1563,7 +1578,7 @@ namespace ArdupilotMega
}
stream.Close();
}
catch (Exception ee) { Console.WriteLine("Failed mjpg " + ee.Message); }
catch (Exception ee) { log.Info("Failed mjpg " + ee.Message); }
}
}
@ -1575,8 +1590,8 @@ namespace ArdupilotMega
private void MainV2_Resize(object sender, EventArgs e)
{
Console.WriteLine("myview width " + MyView.Width + " height " + MyView.Height);
Console.WriteLine("this width " + this.Width + " height " + this.Height);
log.Info("myview width " + MyView.Width + " height " + MyView.Height);
log.Info("this width " + this.Width + " height " + this.Height);
}
private void MenuHelp_Click(object sender, EventArgs e)
@ -1598,49 +1613,58 @@ namespace ArdupilotMega
temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28);
}
static string baseurl = "http://ardupilot-mega.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/";
public static void updatecheck(Label loadinglabel)
{
var baseurl = ConfigurationManager.AppSettings["UpdateLocation"];
try
{
bool update = updatecheck(loadinglabel, baseurl, "");
System.Diagnostics.Process P = new System.Diagnostics.Process();
var process = new Process();
string exePath = Path.GetDirectoryName(Application.ExecutablePath);
if (MONO)
{
P.StartInfo.FileName = "mono";
P.StartInfo.Arguments = " \"" + Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "Updater.exe\"";
process.StartInfo.FileName = "mono";
process.StartInfo.Arguments = " \"" + exePath + Path.DirectorySeparatorChar + "Updater.exe\"";
}
else
{
P.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "Updater.exe";
P.StartInfo.Arguments = "";
process.StartInfo.FileName = exePath + Path.DirectorySeparatorChar + "Updater.exe";
process.StartInfo.Arguments = "";
try
{
foreach (string newupdater in Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "Updater.exe*.new"))
foreach (string newupdater in Directory.GetFiles(exePath, "Updater.exe*.new"))
{
File.Copy(newupdater, newupdater.Remove(newupdater.Length - 4), true);
File.Delete(newupdater);
}
}
catch (Exception)
catch (Exception ex)
{
log.Error("Exception during update", ex);
}
}
if (loadinglabel != null)
updatelabel(loadinglabel,"Starting Updater");
Console.WriteLine("Start " + P.StartInfo.FileName + " with " + P.StartInfo.Arguments);
P.Start();
UpdateLabel(loadinglabel,"Starting Updater");
log.Info("Starting new process: " + process.StartInfo.FileName + " with " + process.StartInfo.Arguments);
process.Start();
log.Info("Quitting existing process");
try
{
Application.Exit();
}
catch { }
catch
{
}
}
catch (Exception ex)
{
log.Error("Update Failed", ex);
MessageBox.Show("Update Failed " + ex.Message);
}
catch (Exception ex) { MessageBox.Show("Update Failed " + ex.Message); }
}
private static void updatelabel(Label loadinglabel, string text)
private static void UpdateLabel(Label loadinglabel, string text)
{
MainV2.instance.Invoke((MethodInvoker)delegate
{
@ -1650,59 +1674,64 @@ namespace ArdupilotMega
});
}
private static void checkForUpdate()
private static void CheckForUpdate()
{
var baseurl = ConfigurationManager.AppSettings["UpdateLocation"];
string path = Path.GetFileNameWithoutExtension(Application.ExecutablePath) + ".exe";
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create(baseurl + path);
request.Timeout = 5000;
Console.Write(baseurl + path + " ");
// Set the Method property of the request to POST.
request.Method = "HEAD";
string requestUriString = baseurl + path;
log.Debug("Checking for update at: " + requestUriString);
var webRequest = WebRequest.Create(requestUriString);
webRequest.Timeout = 5000;
((HttpWebRequest)request).IfModifiedSince = File.GetLastWriteTimeUtc(path);
// Set the Method property of the request to POST.
webRequest.Method = "HEAD";
((HttpWebRequest)webRequest).IfModifiedSince = File.GetLastWriteTimeUtc(path);
// Get the response.
WebResponse response = request.GetResponse();
var response = webRequest.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
log.Debug("Response status: " + ((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
//dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
bool getfile = false;
bool shouldGetFile = false;
if (File.Exists(path))
{
FileInfo fi = new FileInfo(path);
var fi = new FileInfo(path);
Console.WriteLine(response.Headers[HttpResponseHeader.ETag]);
log.Info(response.Headers[HttpResponseHeader.ETag]);
if (fi.Length != response.ContentLength) // && response.Headers[HttpResponseHeader.ETag] != "0")
{
StreamWriter sw = new StreamWriter(path + ".etag");
using (var sw = new StreamWriter(path + ".etag"))
{
sw.WriteLine(response.Headers[HttpResponseHeader.ETag]);
sw.Close();
getfile = true;
Console.WriteLine("NEW FILE " + path);
}
shouldGetFile = true;
log.Info("Newer file found: " + path);
}
}
else
{
getfile = true;
Console.WriteLine("NEW FILE " + path);
shouldGetFile = true;
log.Info("Newer file found: " + path);
// get it
}
response.Close();
if (getfile)
if (shouldGetFile)
{
DialogResult dr = MessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo);
var dr = MessageBox.Show("Update Found\n\nDo you wish to update now?", "Update Now", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
doupdate();
DoUpdate();
}
else
{
@ -1711,32 +1740,41 @@ namespace ArdupilotMega
}
}
public static void doupdate()
public static void DoUpdate()
{
//System.Threading.Thread t12 = new System.Threading.Thread(delegate()
var loading = new Form
{
Form loading = new Form();
loading.Width = 400;
loading.Height = 150;
loading.StartPosition = FormStartPosition.CenterScreen;
loading.TopMost = true;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainV2));
loading.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
Width = 400,
Height = 150,
StartPosition = FormStartPosition.CenterScreen,
TopMost = true,
MinimizeBox = false,
MaximizeBox = false
};
var resources = new ComponentResourceManager(typeof(MainV2));
loading.Icon = ((Icon)(resources.GetObject("$this.Icon")));
Label loadinglabel = new Label();
loadinglabel.Location = new System.Drawing.Point(50, 40);
loadinglabel.Name = "load";
loadinglabel.AutoSize = true;
loadinglabel.Text = "Checking...";
loadinglabel.Size = new System.Drawing.Size(100, 20);
var loadinglabel = new Label
{
Location = new System.Drawing.Point(50, 40),
Name = "load",
AutoSize = true,
Text = "Checking...",
Size = new System.Drawing.Size(100, 20)
};
loading.Controls.Add(loadinglabel);
loading.Show();
try { MainV2.updatecheck(loadinglabel); } catch (Exception ex) { Console.WriteLine(ex.ToString()); }
try
{
MainV2.updatecheck(loadinglabel);
}
catch (Exception ex)
{
log.Error("Error in updatecheck", ex);
}
//);
//t12.Name = "Update check thread";
//t12.Start();
@ -1749,7 +1787,7 @@ namespace ArdupilotMega
List<string> files = new List<string>();
// Create a request using a URL that can receive a post.
Console.WriteLine(baseurl);
log.Info(baseurl);
WebRequest request = WebRequest.Create(baseurl);
request.Timeout = 10000;
// Set the Method property of the request to POST.
@ -1759,7 +1797,7 @@ namespace ArdupilotMega
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
log.Info(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
@ -1802,7 +1840,7 @@ namespace ArdupilotMega
continue;
}
if (loadinglabel != null)
updatelabel(loadinglabel, "Checking " + file);
UpdateLabel(loadinglabel, "Checking " + file);
string path = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + subdir + file;
@ -1818,7 +1856,7 @@ namespace ArdupilotMega
// Get the response.
response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
log.Info(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
//dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
@ -1829,7 +1867,7 @@ namespace ArdupilotMega
{
FileInfo fi = new FileInfo(path);
Console.WriteLine(response.Headers[HttpResponseHeader.ETag]);
log.Info(response.Headers[HttpResponseHeader.ETag]);
if (fi.Length != response.ContentLength) // && response.Headers[HttpResponseHeader.ETag] != "0")
{
@ -1837,13 +1875,13 @@ namespace ArdupilotMega
sw.WriteLine(response.Headers[HttpResponseHeader.ETag]);
sw.Close();
getfile = true;
Console.WriteLine("NEW FILE " + file);
log.Info("NEW FILE " + file);
}
}
else
{
getfile = true;
Console.WriteLine("NEW FILE " + file);
log.Info("NEW FILE " + file);
// get it
}
@ -1866,7 +1904,7 @@ namespace ArdupilotMega
}
}
if (loadinglabel != null)
updatelabel(loadinglabel, "Getting " + file);
UpdateLabel(loadinglabel, "Getting " + file);
// from head
long bytes = response.ContentLength;
@ -1878,7 +1916,7 @@ namespace ArdupilotMega
// Get the response.
response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
log.Info(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
@ -1899,12 +1937,12 @@ namespace ArdupilotMega
if (dt.Second != DateTime.Now.Second)
{
if (loadinglabel != null)
updatelabel(loadinglabel, "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes");
UpdateLabel(loadinglabel, "Getting " + file + ": " + (((double)(contlen - bytes) / (double)contlen) * 100).ToString("0.0") + "%"); //+ Math.Abs(bytes) + " bytes");
dt = DateTime.Now;
}
}
catch { }
Console.WriteLine(file + " " + bytes);
log.Info(file + " " + bytes);
int len = dataStream.Read(buf1, 0, 1024);
if (len == 0)
break;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using log4net;
namespace ArdupilotMega.Mavlink
{
@ -11,6 +12,8 @@ namespace ArdupilotMega.Mavlink
/// </summary>
public static class MavlinkUtil
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Create a new mavlink packet object from a byte array as recieved over mavlink
/// Endianess will be detetected using packet inspection
@ -55,7 +58,7 @@ namespace ArdupilotMega.Mavlink
}
catch (Exception ex)
{
Console.WriteLine("ByteArrayToStructure FAIL: error " + ex);
log.Error("ByteArrayToStructure FAIL", ex);
}
obj = Marshal.PtrToStructure(i, obj.GetType());
@ -105,7 +108,10 @@ namespace ArdupilotMega.Mavlink
// copy byte array to ptr
Marshal.Copy(temparray, startoffset, i, len);
}
catch (Exception ex) { Console.WriteLine("ByteArrayToStructure FAIL: error " + ex.ToString()); }
catch (Exception ex)
{
log.Error("ByteArrayToStructure FAIL", ex);
}
obj = Marshal.PtrToStructure(i, obj.GetType());

View File

@ -5,12 +5,15 @@ using System.Net;
using System.IO;
using System.Text;
using System.Threading;
using log4net;
using log4net.Config;
namespace ArdupilotMega
{
static class Program
{
private static readonly ILog log = LogManager.GetLogger("Program");
/// <summary>
/// The main entry point for the application.
@ -21,23 +24,29 @@ namespace ArdupilotMega
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
//System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Application.ThreadException += Application_ThreadException;
Application.Idle += new EventHandler(Application_Idle);
Application.Idle += Application_Idle;
//MessageBox.Show("NOTE: This version may break advanced mission scripting");
//Common.linearRegression();
Application.EnableVisualStyles();
XmlConfigurator.Configure();
log.Info("******************* Logging Configured *******************");
Application.SetCompatibleTextRenderingDefault(false);
try
{
System.Threading.Thread.CurrentThread.Name = "Base Thread";
Thread.CurrentThread.Name = "Base Thread";
Application.Run(new MainV2());
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
catch (Exception ex)
{
log.Fatal("Fatal app exception",ex);
Console.WriteLine(ex.ToString());
}
}
static void Application_Idle(object sender, EventArgs e)
@ -111,7 +120,10 @@ namespace ArdupilotMega
dataStream.Close();
response.Close();
}
catch { MessageBox.Show("Error sending Error report!! Youre most likerly are not on the internet"); }
catch
{
MessageBox.Show("Error sending Error report!! Youre most likerly are not on the internet");
}
}
}
}

View File

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

View File

@ -228,6 +228,21 @@ namespace ArdupilotMega.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to == MAVLink Parameters == (this is a copy fo the wiki page FYI)
///
///This is a list of all the user-modifiable MAVLink parameters and what they do. You can modify them via the MAVLink parameters window in any compatible GCS, such as the Mission Planner, HK GCS or !QGroundControl.
///
///It includes both fixed wing (APM) and rotary wing (!ArduCopter) parameters. Some may only be relevant for one platform or another.
///
///|| *EEPROM variable name* || *Min* || *Max* || *Default* || *Multiplier* || *Enabled (0 = no, 1 = yes)* [rest of string was truncated]&quot;;.
/// </summary>
public static string MAVParam {
get {
return ResourceManager.GetString("MAVParam", resourceCulture);
}
}
public static System.Drawing.Bitmap octo {
get {
object obj = ResourceManager.GetObject("octo", resourceCulture);

View File

@ -1222,8 +1222,11 @@
<data name="iconWarning48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\iconWarning48.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="y6" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\y6.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="MAVParam" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MAVParam.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

View File

@ -49,8 +49,6 @@ namespace ArdupilotMega
{
ArduinoSTK comPort = new ArduinoSTK();
string version = "";
uploader.Uploader uploader = new uploader.Uploader();
try
@ -186,244 +184,9 @@ namespace ArdupilotMega
catch { }
}
private void BUT_getcurrent_Click(object sender, EventArgs e)
{
SerialPort comPort = new SerialPort();
try {
comPort.PortName = MainV2.comPort.BaseStream.PortName;
comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate;
comPort.ReadTimeout = 4000;
comPort.Open();
}
catch { MessageBox.Show("Invalid ComPort or in use"); return; }
lbl_status.Text = "Connecting";
if (doConnect(comPort))
{
comPort.DiscardInBuffer();
lbl_status.Text = "Doing Command ATI & RTI";
ATI.Text = doCommand(comPort, "ATI1").Trim();
RTI.Text = doCommand(comPort, "RTI1").Trim();
RSSI.Text = doCommand(comPort, "ATI7").Trim();
lbl_status.Text = "Doing Command ATI5";
string answer = doCommand(comPort, "ATI5");
string[] items = answer.Split('\n');
foreach (string item in items)
{
if (item.StartsWith("S"))
{
string[] values = item.Split(':', '=');
if (values.Length == 3)
{
Control[] controls = this.Controls.Find(values[0].Trim(), false);
if (controls.Length > 0)
{
if (controls[0].GetType() == typeof(CheckBox))
{
((CheckBox)controls[0]).Checked = values[2].Trim() == "1";
}
else
{
controls[0].Text = values[2].Trim();
}
}
}
}
}
// remote
foreach (Control ctl in this.Controls)
{
if (ctl.Name.StartsWith("RS") && ctl.Name != "RSSI")
ctl.ResetText();
}
comPort.DiscardInBuffer();
lbl_status.Text = "Doing Command RTI5";
answer = doCommand(comPort, "RTI5");
items = answer.Split('\n');
foreach (string item in items)
{
if (item.StartsWith("S"))
{
string[] values = item.Split(':', '=');
if (values.Length == 3)
{
Control[] controls = this.Controls.Find("R" + values[0].Trim(), false);
if (controls[0].GetType() == typeof(CheckBox))
{
((CheckBox)controls[0]).Checked = values[2].Trim() == "1";
}
else if (controls[0].GetType() == typeof(TextBox))
{
((TextBox)controls[0]).Text = values[2].Trim();
}
else if (controls[0].GetType() == typeof(ComboBox))
{
((ComboBox)controls[0]).SelectedText = values[2].Trim();
}
}
else
{
Console.WriteLine("Odd config line :" + item);
}
}
}
// off hook
doCommand(comPort, "ATO");
lbl_status.Text = "Done";
}
else
{
// off hook
doCommand(comPort, "ATO");
lbl_status.Text = "Fail";
MessageBox.Show("Failed to enter command mode");
}
comPort.Close();
}
string Serial_ReadLine(SerialPort comPort)
{
StringBuilder sb = new StringBuilder();
DateTime Deadline = DateTime.Now.AddMilliseconds(comPort.ReadTimeout);
while (DateTime.Now < Deadline)
{
if (comPort.BytesToRead > 0)
{
byte data = (byte)comPort.ReadByte();
sb.Append((char)data);
if (data == '\n')
break;
}
}
return sb.ToString();
}
string doCommand(SerialPort comPort, string cmd, int level = 0)
{
if (!comPort.IsOpen)
return "";
comPort.ReadTimeout = 1000;
// setup to known state
comPort.Write("\r\n");
// alow some time to gather thoughts
Sleep(100);
// ignore all existing data
comPort.DiscardInBuffer();
lbl_status.Text = "Doing Command "+cmd;
Console.WriteLine("Doing Command "+cmd);
// write command
comPort.Write(cmd + "\r\n");
// read echoed line or existing data
string temp;
try
{
temp = Serial_ReadLine(comPort);
}
catch { temp = comPort.ReadExisting(); }
Console.WriteLine("cmd "+cmd + " echo "+ temp);
// delay for command
Sleep(500);
// get responce
string ans = "";
while (comPort.BytesToRead > 0)
{
try
{
ans = ans + Serial_ReadLine(comPort) +"\n";
}
catch { ans = ans + comPort.ReadExisting() + "\n"; }
Sleep(50);
if (ans.Length > 500)
{
break;
}
}
Console.WriteLine("responce " +level+ " " + ans);
// try again
if (ans == "" && level == 0)
return doCommand(comPort, cmd, 1);
return ans;
}
bool doConnect(SerialPort comPort)
{
// clear buffer
comPort.DiscardInBuffer();
// setup a known enviroment
comPort.Write("\r\n");
// wait
Sleep(1100);
// send config string
comPort.Write("+++");
// wait
Sleep(1100);
// check for config responce "OK"
Console.WriteLine("Connect btr " + comPort.BytesToRead + " baud " + comPort.BaudRate);
string conn = comPort.ReadExisting();
Console.WriteLine("Connect first responce "+conn + " " + conn.Length);
if (conn.Contains("OK"))
{
//return true;
}
else
{
// cleanup incase we are already in cmd mode
comPort.Write("\r\n");
}
string version = doCommand(comPort, "ATI");
Console.Write("Connect Version: " + version.Trim() + "\n");
if (version.Contains("on HM-TRP"))
{
return true;
}
return false;
}
private void BUT_savesettings_Click(object sender, EventArgs e)
{
SerialPort comPort = new SerialPort();
ArdupilotMega.ICommsSerial comPort = new SerialPort();
try {
comPort.PortName = MainV2.comPort.BaseStream.PortName;
@ -595,6 +358,242 @@ namespace ArdupilotMega
comPort.Close();
}
private void BUT_getcurrent_Click(object sender, EventArgs e)
{
ArdupilotMega.ICommsSerial comPort = new SerialPort();
try
{
comPort.PortName = MainV2.comPort.BaseStream.PortName;
comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate;
comPort.ReadTimeout = 4000;
comPort.Open();
}
catch { MessageBox.Show("Invalid ComPort or in use"); return; }
lbl_status.Text = "Connecting";
if (doConnect(comPort))
{
comPort.DiscardInBuffer();
lbl_status.Text = "Doing Command ATI & RTI";
ATI.Text = doCommand(comPort, "ATI1").Trim();
RTI.Text = doCommand(comPort, "RTI1").Trim();
RSSI.Text = doCommand(comPort, "ATI7").Trim();
lbl_status.Text = "Doing Command ATI5";
string answer = doCommand(comPort, "ATI5");
string[] items = answer.Split('\n');
foreach (string item in items)
{
if (item.StartsWith("S"))
{
string[] values = item.Split(':', '=');
if (values.Length == 3)
{
Control[] controls = this.Controls.Find(values[0].Trim(), false);
if (controls.Length > 0)
{
if (controls[0].GetType() == typeof(CheckBox))
{
((CheckBox)controls[0]).Checked = values[2].Trim() == "1";
}
else
{
controls[0].Text = values[2].Trim();
}
}
}
}
}
// remote
foreach (Control ctl in this.Controls)
{
if (ctl.Name.StartsWith("RS") && ctl.Name != "RSSI")
ctl.ResetText();
}
comPort.DiscardInBuffer();
lbl_status.Text = "Doing Command RTI5";
answer = doCommand(comPort, "RTI5");
items = answer.Split('\n');
foreach (string item in items)
{
if (item.StartsWith("S"))
{
string[] values = item.Split(':', '=');
if (values.Length == 3)
{
Control[] controls = this.Controls.Find("R" + values[0].Trim(), false);
if (controls[0].GetType() == typeof(CheckBox))
{
((CheckBox)controls[0]).Checked = values[2].Trim() == "1";
}
else if (controls[0].GetType() == typeof(TextBox))
{
((TextBox)controls[0]).Text = values[2].Trim();
}
else if (controls[0].GetType() == typeof(ComboBox))
{
((ComboBox)controls[0]).SelectedText = values[2].Trim();
}
}
else
{
Console.WriteLine("Odd config line :" + item);
}
}
}
// off hook
doCommand(comPort, "ATO");
lbl_status.Text = "Done";
}
else
{
// off hook
doCommand(comPort, "ATO");
lbl_status.Text = "Fail";
MessageBox.Show("Failed to enter command mode");
}
comPort.Close();
}
string Serial_ReadLine(ArdupilotMega.ICommsSerial comPort)
{
StringBuilder sb = new StringBuilder();
DateTime Deadline = DateTime.Now.AddMilliseconds(comPort.ReadTimeout);
while (DateTime.Now < Deadline)
{
if (comPort.BytesToRead > 0)
{
byte data = (byte)comPort.ReadByte();
sb.Append((char)data);
if (data == '\n')
break;
}
}
return sb.ToString();
}
string doCommand(ArdupilotMega.ICommsSerial comPort, string cmd, int level = 0)
{
if (!comPort.IsOpen)
return "";
comPort.ReadTimeout = 1000;
// setup to known state
comPort.Write("\r\n");
// alow some time to gather thoughts
Sleep(100);
// ignore all existing data
comPort.DiscardInBuffer();
lbl_status.Text = "Doing Command " + cmd;
Console.WriteLine("Doing Command " + cmd);
// write command
comPort.Write(cmd + "\r\n");
// read echoed line or existing data
string temp;
try
{
temp = Serial_ReadLine(comPort);
}
catch { temp = comPort.ReadExisting(); }
Console.WriteLine("cmd " + cmd + " echo " + temp);
// delay for command
Sleep(500);
// get responce
string ans = "";
while (comPort.BytesToRead > 0)
{
try
{
ans = ans + Serial_ReadLine(comPort) + "\n";
}
catch { ans = ans + comPort.ReadExisting() + "\n"; }
Sleep(50);
if (ans.Length > 500)
{
break;
}
}
Console.WriteLine("responce " + level + " " + ans.Replace('\0',' '));
// try again
if (ans == "" && level == 0)
return doCommand(comPort, cmd, 1);
return ans;
}
bool doConnect(ArdupilotMega.ICommsSerial comPort)
{
// clear buffer
comPort.DiscardInBuffer();
// setup a known enviroment
comPort.Write("\r\n");
// wait
Sleep(1100);
// send config string
comPort.Write("+++");
// wait
Sleep(1100);
// check for config responce "OK"
Console.WriteLine("Connect btr " + comPort.BytesToRead + " baud " + comPort.BaudRate);
string conn = comPort.ReadExisting();
Console.WriteLine("Connect first responce " + conn.Replace('\0',' ') + " " + conn.Length);
if (conn.Contains("OK"))
{
//return true;
}
else
{
// cleanup incase we are already in cmd mode
comPort.Write("\r\n");
}
string version = doCommand(comPort, "ATI");
Console.Write("Connect Version: " + version.Trim() + "\n");
if (version.Contains("on HM-TRP"))
{
return true;
}
return false;
}
private void BUT_syncS2_Click(object sender, EventArgs e)
{
RS2.Text = S2.Text;

View File

@ -30,11 +30,8 @@ namespace ArdupilotMega
scope.SetVariable("cs", MainV2.cs);
scope.SetVariable("Script", this);
Console.WriteLine(DateTime.Now.Millisecond);
engine.CreateScriptSourceFromString("print 'hello world from python'").Execute(scope);
Console.WriteLine(DateTime.Now.Millisecond);
engine.CreateScriptSourceFromString("print cs.roll").Execute(scope);
Console.WriteLine(DateTime.Now.Millisecond);
object thisBoxed = MainV2.cs;

View File

@ -85,11 +85,10 @@
//
// LBL_location
//
this.LBL_location.AutoSize = true;
this.LBL_location.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.LBL_location.Location = new System.Drawing.Point(9, 78);
this.LBL_location.Location = new System.Drawing.Point(3, 64);
this.LBL_location.Name = "LBL_location";
this.LBL_location.Size = new System.Drawing.Size(50, 24);
this.LBL_location.Size = new System.Drawing.Size(365, 59);
this.LBL_location.TabIndex = 4;
this.LBL_location.Text = "0,0,0";
//

View File

@ -87,54 +87,56 @@ namespace ArdupilotMega
void mainloop()
{
DateTime nextsend = DateTime.Now;
threadrun = true;
int counter = 0;
while (threadrun)
{
try
{
string line = comPort.ReadLine();
//string line = string.Format("$GP{0},{1:HHmmss},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},", "GGA", DateTime.Now.ToUniversalTime(), Math.Abs(lat * 100), MainV2.cs.lat < 0 ? "S" : "N", Math.Abs(lng * 100), MainV2.cs.lng < 0 ? "W" : "E", MainV2.cs.gpsstatus, MainV2.cs.satcount, MainV2.cs.gpshdop, MainV2.cs.alt, "M", 0, "M", "");
if (line.StartsWith("$GPGGA")) //
{
int c1 = line.IndexOf(',',0)+ 1;
int c2 = line.IndexOf(',', c1) + 1;
int c3 = line.IndexOf(',', c2) + 1;
int c4 = line.IndexOf(',', c3 ) + 1;
int c5 = line.IndexOf(',', c4 ) + 1;
int c6 = line.IndexOf(',', c5 ) + 1;
int c7 = line.IndexOf(',', c6 ) + 1;
int c8 = line.IndexOf(',', c7 ) + 1;
int c9 = line.IndexOf(',', c8 ) + 1;
int c10 = line.IndexOf(',', c9 ) + 1;
int c11 = line.IndexOf(',', c10 ) + 1;
int c12 = line.IndexOf(',', c11) + 1;
string[] items = line.Trim().Split(',','*');
gotolocation.Lat = double.Parse(line.Substring(c2, c3 - c2 - 1)) / 100.0;
if (items[15] != GetChecksum(line.Trim()))
{
Console.WriteLine("Bad Nmea line " + items[15] + " vs " + GetChecksum(line.Trim()));
continue;
}
if (items[6] == "0")
{
Console.WriteLine("No Fix");
continue;
}
gotolocation.Lat = double.Parse(items[2]) / 100.0;
gotolocation.Lat = (int)gotolocation.Lat + ((gotolocation.Lat - (int)gotolocation.Lat) / 0.60);
if (line.Substring(c3, c4 - c3 - 1) == "S")
if (items[3] == "S")
gotolocation.Lat *= -1;
gotolocation.Lng = double.Parse(line.Substring(c4, c5 - c4 - 1)) / 100.0;
gotolocation.Lng = double.Parse(items[4]) / 100.0;
gotolocation.Lng = (int)gotolocation.Lng + ((gotolocation.Lng - (int)gotolocation.Lng) / 0.60);
if (line.Substring(c5, c6 - c5 - 1) == "W")
if (items[5] == "W")
gotolocation.Lng *= -1;
gotolocation.Alt = intalt; // double.Parse(line.Substring(c9, c10 - c9 - 1)) +
gotolocation.Tag = "Sats "+ items[7] + " hdop " + items[8] ;
}
if (counter % 10 == 0 && gotolocation.Lat != 0 && gotolocation.Lng != 0 && gotolocation.Alt != 0) // 200 * 10 = 2 sec /// lastgotolocation != gotolocation &&
if (DateTime.Now > nextsend && gotolocation.Lat != 0 && gotolocation.Lng != 0 && gotolocation.Alt != 0) // 200 * 10 = 2 sec /// lastgotolocation != gotolocation &&
{
nextsend = DateTime.Now.AddSeconds(2);
Console.WriteLine("Sending follow wp " +DateTime.Now.ToString("h:MM:ss")+" "+ gotolocation.Lat + " " + gotolocation.Lng + " " +gotolocation.Alt);
lastgotolocation = new PointLatLngAlt(gotolocation);
@ -159,14 +161,13 @@ namespace ArdupilotMega
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT, (byte)2);
GCSViews.FlightData.GuidedModeWP = new PointLatLngAlt(gotohere);
MainV2.givecomport = false;
}
catch { MainV2.givecomport = false; }
}
}
System.Threading.Thread.Sleep(200);
counter++;
}
catch { System.Threading.Thread.Sleep(2000); }
}
@ -176,7 +177,7 @@ namespace ArdupilotMega
{
this.BeginInvoke((MethodInvoker)delegate
{
LBL_location.Text = gotolocation.Lat + " " + gotolocation.Lng + " " + gotolocation.Alt;
LBL_location.Text = gotolocation.Lat + " " + gotolocation.Lng + " " + gotolocation.Alt +" "+ gotolocation.Tag;
}
);
@ -200,7 +201,7 @@ namespace ArdupilotMega
break;
case '*':
// Stop processing before the asterisk
continue;
return Checksum.ToString("X2");
default:
// Is this the first value for the checksum?
if (Checksum == 0)

View File

@ -1,7 +1,34 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/></startup>
<appSettings>
<add key="UpdateLocation"
value="http://ardupilot-mega.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/"/>
</appSettings>
<log4net>
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level %logger - %message%newline" />
</layout>
<threshold value="INFO"/>
</appender>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="ArdupilotPlanner.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level %logger - %message (%file:%line) [%thread]%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>
</log4net>
</configuration>

View File

@ -1,7 +1,34 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/></startup>
<appSettings>
<add key="UpdateLocation"
value="http://ardupilot-mega.googlecode.com/git/Tools/ArdupilotMegaPlanner/bin/Release/"/>
</appSettings>
<log4net>
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level %logger - %message%newline" />
</layout>
<threshold value="INFO"/>
</appender>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="ArdupilotPlanner.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level %logger - %message (%file:%line) [%thread]%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>
</log4net>
</configuration>

View File

@ -19,6 +19,7 @@
<F4>Pitch</F4>
<F5>Yaw IN</F5>
<F6>Yaw</F6>
<F7>Mag Heading</F7>
</ATT>
<NTUN>
<F1>WP Dist</F1>

View File

@ -19,6 +19,7 @@
<F4>Pitch</F4>
<F5>Yaw IN</F5>
<F6>Yaw</F6>
<F7>Mag Heading</F7>
</ATT>
<NTUN>
<F1>WP Dist</F1>

View File

@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.IO;
using System.Windows.Forms;
using com.drew.imaging.jpg;
using com.drew.metadata;
using log4net;
using SharpKml.Base;
using SharpKml.Dom;
using SharpKml.Dom.GX;
namespace ArdupilotMega
{
class georefimage : Form
public class Georefimage : Form
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private OpenFileDialog openFileDialog1;
private MyButton BUT_browselog;
private MyButton BUT_browsedir;
@ -31,7 +28,7 @@ namespace ArdupilotMega
int latpos = 5, lngpos = 4, altpos = 7;
internal georefimage() {
internal Georefimage() {
InitializeComponent();
}
@ -51,7 +48,7 @@ namespace ArdupilotMega
}
catch (JpegProcessingException e)
{
Console.WriteLine(e.Message);
log.InfoFormat(e.Message);
return dtaken;
}
@ -61,7 +58,7 @@ namespace ArdupilotMega
if (lcDirectory.ContainsTag(0x9003))
{
dtaken = lcDirectory.GetDate(0x9003);
Console.WriteLine("does " + lcDirectory.GetTagName(0x9003) + " " + dtaken);
log.InfoFormat("does " + lcDirectory.GetTagName(0x9003) + " " + dtaken);
break;
}
@ -96,6 +93,51 @@ namespace ArdupilotMega
{
List<string[]> list = new List<string[]>();
if (fn.ToLower().EndsWith("tlog"))
{
MAVLink mine = new MAVLink();
mine.logplaybackfile = new BinaryReader(File.Open(fn, FileMode.Open, FileAccess.Read, FileShare.Read));
mine.logreadmode = true;
mine.packets.Initialize(); // clear
CurrentState cs = new CurrentState();
string[] oldvalues = {""};
while (mine.logplaybackfile.BaseStream.Position < mine.logplaybackfile.BaseStream.Length)
{
byte[] packet = mine.readPacket();
cs.datetime = mine.lastlogread;
cs.UpdateCurrentSettings(null, true, mine);
// line "GPS: 82686250, 1, 8, -34.1406480, 118.5441900, 0.0000, 309.1900, 315.9500, 0.0000, 279.1200" string
string[] vals = new string[] { "GPS", (new DateTime(cs.datetime.Year,cs.datetime.Month,cs.datetime.Day,0,0,0) - cs.datetime).TotalMilliseconds.ToString(), "1",
"8",cs.lat.ToString(),cs.lng.ToString(),"0.0",cs.alt.ToString(),cs.alt.ToString(),"0.0",cs.groundcourse.ToString()};
if (oldvalues.Length > 2 && oldvalues[latpos] == vals[latpos]
&& oldvalues[lngpos] == vals[lngpos]
&& oldvalues[altpos] == vals[altpos])
continue;
oldvalues = vals;
list.Add(vals);
// 4 5 7
Console.Write((mine.logplaybackfile.BaseStream.Position * 100 / mine.logplaybackfile.BaseStream.Length) + " \r");
}
mine.logplaybackfile.Close();
return list;
}
StreamReader sr = new StreamReader(fn);
string lasttime = "0";
@ -172,7 +214,7 @@ namespace ArdupilotMega
localmax = crap;
}
Console.WriteLine("min " + localmin + " max " + localmax);
log.InfoFormat("min " + localmin + " max " + localmax);
TXT_outputlog.AppendText("Log min " + localmin + " max " + localmax + "\r\n");
}
@ -220,7 +262,7 @@ namespace ArdupilotMega
sw.WriteLine(Path.GetFileNameWithoutExtension(file) + "\t" + crap.ToString("yyyy:MM:dd HH:mm:ss") + "\t" + arr[lngpos] + "\t" + arr[latpos] + "\t" + arr[altpos]);
sw.Flush();
sw2.Flush();
Console.WriteLine(Path.GetFileNameWithoutExtension(file) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos] + " ");
log.InfoFormat(Path.GetFileNameWithoutExtension(file) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos] + " ");
break;
}
//Console.WriteLine(crap);
@ -359,7 +401,7 @@ namespace ArdupilotMega
this.Controls.Add(this.TXT_logfile);
this.Controls.Add(this.BUT_browsedir);
this.Controls.Add(this.BUT_browselog);
this.Name = "georefimage";
this.Name = "Georefimage";
this.ResumeLayout(false);
this.PerformLayout();
@ -367,7 +409,7 @@ namespace ArdupilotMega
private void BUT_browselog_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "Logs|*.log";
openFileDialog1.Filter = "Logs|*.log;*.tlog";
openFileDialog1.ShowDialog();
if (File.Exists(openFileDialog1.FileName))

View File

@ -46,6 +46,7 @@
this.BUT_lang_edit = new ArdupilotMega.MyButton();
this.BUT_georefimage = new ArdupilotMega.MyButton();
this.BUT_follow_me = new ArdupilotMega.MyButton();
this.BUT_ant_track = new ArdupilotMega.MyButton();
this.SuspendLayout();
//
// button1
@ -215,7 +216,7 @@
//
// BUT_follow_me
//
this.BUT_follow_me.Location = new System.Drawing.Point(525, 164);
this.BUT_follow_me.Location = new System.Drawing.Point(527, 164);
this.BUT_follow_me.Name = "BUT_follow_me";
this.BUT_follow_me.Size = new System.Drawing.Size(75, 23);
this.BUT_follow_me.TabIndex = 17;
@ -223,11 +224,22 @@
this.BUT_follow_me.UseVisualStyleBackColor = true;
this.BUT_follow_me.Click += new System.EventHandler(this.BUT_follow_me_Click);
//
// BUT_ant_track
//
this.BUT_ant_track.Location = new System.Drawing.Point(446, 164);
this.BUT_ant_track.Name = "BUT_ant_track";
this.BUT_ant_track.Size = new System.Drawing.Size(75, 23);
this.BUT_ant_track.TabIndex = 18;
this.BUT_ant_track.Text = "Antenna Tracker";
this.BUT_ant_track.UseVisualStyleBackColor = true;
this.BUT_ant_track.Click += new System.EventHandler(this.BUT_ant_track_Click);
//
// temp
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(731, 281);
this.Controls.Add(this.BUT_ant_track);
this.Controls.Add(this.BUT_follow_me);
this.Controls.Add(this.BUT_georefimage);
this.Controls.Add(this.BUT_lang_edit);
@ -274,6 +286,7 @@
private MyButton BUT_lang_edit;
private MyButton BUT_georefimage;
private MyButton BUT_follow_me;
private MyButton BUT_ant_track;
//private SharpVectors.Renderers.Forms.SvgPictureBox svgPictureBox1;
}

View File

@ -13,11 +13,14 @@ using System.Net;
using GMap.NET.WindowsForms;
using GMap.NET.CacheProviders;
using log4net;
namespace ArdupilotMega
{
public partial class temp : Form
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public temp()
{
InitializeComponent();
@ -159,7 +162,7 @@ namespace ArdupilotMega
int start = 0;
int end = 1024*4;
Console.WriteLine(start + " to " + end);
log.Info(start + " to " + end);
port.upload(EEPROM, (short)start, (short)(end - start), (short)start);
if (port.keepalive())
@ -230,7 +233,7 @@ namespace ArdupilotMega
int start = 0;
int end = 1024*4;
Console.WriteLine(start + " to " + end);
log.Info(start + " to " + end);
port.upload(EEPROM, (short)start, (short)(end - start), (short)start);
if (port.keepalive())
@ -295,11 +298,11 @@ namespace ArdupilotMega
int start = 0;
short length = 0x100;
Console.WriteLine(start + " to " + FLASH.Length);
log.Info(start + " to " + FLASH.Length);
while (start < FLASH.Length)
{
Console.WriteLine("Doing " + length + " at " + start);
log.Info("Doing " + length + " at " + start);
port.setaddress(start);
port.downloadflash(length).CopyTo(FLASH, start);
start += length;
@ -335,7 +338,7 @@ namespace ArdupilotMega
sw.Close();
Console.WriteLine("Downloaded");
log.Info("Downloaded");
}
else
{
@ -397,7 +400,7 @@ namespace ArdupilotMega
if (port.connectAP())
{
Console.WriteLine("starting");
log.Info("starting");
port.uploadflash(FLASH, 0, FLASH.Length, 0);
@ -405,7 +408,7 @@ namespace ArdupilotMega
Console.WriteLine("Uploaded");
log.Info("Uploaded");
}
@ -442,7 +445,7 @@ namespace ArdupilotMega
int length = Convert.ToInt32(match.Groups[1].Value.ToString(), 16);
int address = Convert.ToInt32(match.Groups[2].Value.ToString(), 16);
int option = Convert.ToInt32(match.Groups[3].Value.ToString(), 16);
Console.WriteLine("len {0} add {1} opt {2}", length, address, option);
log.InfoFormat("len {0} add {1} opt {2}", length, address, option);
if (option == 0)
{
string data = match.Groups[4].Value.ToString();
@ -484,7 +487,7 @@ namespace ArdupilotMega
int length = Convert.ToInt32(line.Substring(1, 2), 16);
int address = Convert.ToInt32(line.Substring(3, 4), 16);
int option = Convert.ToInt32(line.Substring(7, 2), 16);
Console.WriteLine("len {0} add {1} opt {2}", length, address, option);
log.InfoFormat("len {0} add {1} opt {2}", length, address, option);
if (option == 0)
{
@ -535,12 +538,12 @@ namespace ArdupilotMega
{
port.PortName = ArdupilotMega.MainV2.comportname;
Console.WriteLine("Open Port");
log.Info("Open Port");
port.Open();
Console.WriteLine("Connect AP");
log.Info("Connect AP");
if (port.connectAP())
{
Console.WriteLine("Download AP");
log.Info("Download AP");
byte[] EEPROM = new byte[1024*4];
for (int a = 0; a < 4 * 1024; a += 0x100)
@ -548,7 +551,7 @@ namespace ArdupilotMega
port.setaddress(a);
port.download(0x100).CopyTo(EEPROM,a);
}
Console.WriteLine("Verify State");
log.Info("Verify State");
if (port.keepalive())
{
StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"EEPROM.bin");
@ -586,12 +589,12 @@ namespace ArdupilotMega
{
port.PortName = ArdupilotMega.MainV2.comportname;
Console.WriteLine("Open Port");
log.Info("Open Port");
port.Open();
Console.WriteLine("Connect AP");
log.Info("Connect AP");
if (port.connectAP())
{
Console.WriteLine("Download AP");
log.Info("Download AP");
byte[] EEPROM = new byte[1024 * 4];
for (int a = 0; a < 4 * 1024; a += 0x100)
@ -599,7 +602,7 @@ namespace ArdupilotMega
port.setaddress(a);
port.download(0x100).CopyTo(EEPROM, a);
}
Console.WriteLine("Verify State");
log.Info("Verify State");
if (port.keepalive())
{
StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"EEPROM1280.bin");
@ -607,7 +610,7 @@ namespace ArdupilotMega
bw.Write(EEPROM, 0, EEPROM.Length);
bw.Close();
Console.WriteLine("Download AP");
log.Info("Download AP");
byte[] FLASH = new byte[1024 * 128];
for (int a = 0; a < FLASH.Length; a += 0x100)
@ -650,12 +653,12 @@ namespace ArdupilotMega
{
port.PortName = ArdupilotMega.MainV2.comportname;
Console.WriteLine("Open Port");
log.Info("Open Port");
port.Open();
Console.WriteLine("Connect AP");
log.Info("Connect AP");
if (port.connectAP())
{
Console.WriteLine("Download AP");
log.Info("Download AP");
byte[] EEPROM = new byte[1024 * 4];
for (int a = 0; a < EEPROM.Length; a += 0x100)
@ -663,7 +666,7 @@ namespace ArdupilotMega
port.setaddress(a);
port.download(0x100).CopyTo(EEPROM, a);
}
Console.WriteLine("Verify State");
log.Info("Verify State");
if (port.keepalive())
{
StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"EEPROM2560.bin");
@ -671,7 +674,7 @@ namespace ArdupilotMega
bw.Write(EEPROM, 0, EEPROM.Length);
bw.Close();
Console.WriteLine("Download AP");
log.Info("Download AP");
byte[] FLASH = new byte[1024 * 256];
for (int a = 0; a < FLASH.Length; a += 0x100)
@ -733,7 +736,7 @@ namespace ArdupilotMega
if (port.connectAP())
{
Console.WriteLine("starting");
log.Info("starting");
port.uploadflash(FLASH, 0, FLASH.Length, 0);
@ -741,7 +744,7 @@ namespace ArdupilotMega
port.upload(EEPROM, 0, (short)EEPROM.Length, 0);
Console.WriteLine("Uploaded");
log.Info("Uploaded");
}
@ -800,7 +803,7 @@ namespace ArdupilotMega
foreach (string file in files)
{
Console.WriteLine(DateTime.Now.Millisecond + " Doing "+ file);
log.Info(DateTime.Now.Millisecond + " Doing "+ file);
Regex reg = new Regex(@"Z([0-9]+)\\([0-9]+)\\([0-9]+)");
Match mat = reg.Match(file);
@ -820,7 +823,7 @@ namespace ArdupilotMega
Img.Save(tile,System.Drawing.Imaging.ImageFormat.Jpeg);
tile.Seek(0, SeekOrigin.Begin);
Console.WriteLine(pnt.X + " " + pnt.Y);
log.Info(pnt.X + " " + pnt.Y);
Application.DoEvents();
@ -860,7 +863,7 @@ namespace ArdupilotMega
GMap.NET.CacheProviders.SQLitePureImageCache.VacuumDb(MainMap.CacheLocation + @"\TileDBv3\en\Data.gmdb");
Console.WriteLine("Removed {0} images",removed);
log.InfoFormat("Removed {0} images", removed);
}
private void BUT_lang_edit_Click(object sender, EventArgs e)
{
@ -869,7 +872,7 @@ namespace ArdupilotMega
private void BUT_georefimage_Click(object sender, EventArgs e)
{
new georefimage().Show();
new Georefimage().Show();
}
private void BUT_follow_me_Click(object sender, EventArgs e)
@ -878,5 +881,10 @@ namespace ArdupilotMega
MainV2.fixtheme((Form)si);
si.Show();
}
private void BUT_ant_track_Click(object sender, EventArgs e)
{
new Antenna.Tracker().Show();
}
}
}