APM Planner - 1.0.84

fix ac log download
This commit is contained in:
Michael Oborne 2011-10-18 06:49:49 +08:00
parent b3ca747a69
commit cd2a6026b6
5 changed files with 116 additions and 89 deletions

View File

@ -168,6 +168,8 @@ namespace ArdupilotMega.GCSViews
comPort.ReadBufferSize = 1024 * 1024;
comPort.PortName = MainV2.comportname;
comPort.Open();
System.Threading.Thread t11 = new System.Threading.Thread(delegate()

View File

@ -75,7 +75,8 @@ namespace ArdupilotMega
comPort.DtrEnable = true;
//comPort.Open();
}
catch (Exception) {
catch (Exception)
{
MessageBox.Show("Error opening comport");
}
@ -99,7 +100,7 @@ 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) { Console.WriteLine("crash in comport reader " + ex.ToString()); } // cant exit unless told to
}
Console.WriteLine("Comport thread close");
});
@ -158,7 +159,8 @@ namespace ArdupilotMega
if (!line.Contains("\n"))
line = line + "\n";
}
catch {
catch
{
line = comPort.ReadExisting();
//byte[] data = readline(comPort);
//line = Encoding.ASCII.GetString(data, 0, data.Length);
@ -172,7 +174,7 @@ namespace ArdupilotMega
{
case serialstatus.Connecting:
if (line.Contains("reset to FLY") || line.Contains("interactive setup"))
if (line.Contains("reset to FLY") || line.Contains("interactive setup") || line.Contains("CLI:"))
{
comPort.Write("logs\r");
}
@ -199,6 +201,8 @@ namespace ArdupilotMega
MainV2.cs.firmware = MainV2.Firmwares.ArduPlane;
TXT_seriallog.AppendText("Createing KML for " + logfile);
while (tr.Peek() != -1)
{
processLine(tr.ReadLine());
@ -206,12 +210,16 @@ namespace ArdupilotMega
tr.Close();
try
{
writeKML(logfile + ".kml");
}
catch { } // usualy invalid lat long error
status = serialstatus.Done;
break;
case serialstatus.Createfile:
receivedbytes = 0;
Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath)+ Path.DirectorySeparatorChar +@"logs");
Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs");
logfile = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd hh-mm") + " " + currentlog + ".log";
sw = new StreamWriter(logfile);
status = serialstatus.Waiting;
@ -286,17 +294,20 @@ namespace ArdupilotMega
{
try
{
Application.DoEvents();
line = line.Replace(", ", ",");
line = line.Replace(": ", ":");
string[] items = line.Split(',',':');
string[] items = line.Split(',', ':');
if (items[0].Contains("CMD")) {
if (items[0].Contains("CMD"))
{
if (flightdata.Count == 0)
{
if (int.Parse(items[2]) <= (int)MAVLink.MAV_CMD.LAST) // wps
{
PointLatLngAlt temp = new PointLatLngAlt(double.Parse(items[5],new System.Globalization.CultureInfo("en-US")) / 10000000, double.Parse(items[6],new System.Globalization.CultureInfo("en-US")) / 10000000, double.Parse(items[4],new System.Globalization.CultureInfo("en-US")) / 100, items[1].ToString());
PointLatLngAlt temp = new PointLatLngAlt(double.Parse(items[5], new System.Globalization.CultureInfo("en-US")) / 10000000, double.Parse(items[6], new System.Globalization.CultureInfo("en-US")) / 10000000, double.Parse(items[4], new System.Globalization.CultureInfo("en-US")) / 100, items[1].ToString());
cmd.Add(temp);
}
}
@ -319,7 +330,7 @@ namespace ArdupilotMega
alt = double.Parse(items[7], new System.Globalization.CultureInfo("en-US"));
position[positionindex].Add(new Point3D(double.Parse(items[5],new System.Globalization.CultureInfo("en-US")), double.Parse(items[4],new System.Globalization.CultureInfo("en-US")), alt));
position[positionindex].Add(new Point3D(double.Parse(items[5], new System.Globalization.CultureInfo("en-US")), double.Parse(items[4], new System.Globalization.CultureInfo("en-US")), alt));
oldlastpos = lastpos;
lastpos = (position[positionindex][position[positionindex].Count - 1]);
lastline = line;
@ -443,8 +454,8 @@ namespace ArdupilotMega
stylecode = colours[g % (colours.Length - 1)].ToArgb();
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());
Color color = Color.FromArgb(0xff, (stylecode >> 16) & 0xff, (stylecode >> 8) & 0xff, (stylecode >> 0) & 0xff);
Console.WriteLine("colour " + color.ToArgb().ToString("X") + " " + color.ToKnownColor().ToString());
style2.Add(new LineStyle(color, 4));
@ -529,6 +540,9 @@ namespace ArdupilotMega
}
catch { }
try
{
pmplane.Point = new KmlPoint((float)model.Location.longitude, (float)model.Location.latitude, (float)model.Location.altitude);
pmplane.Point.AltitudeMode = altmode;
@ -540,6 +554,8 @@ namespace ArdupilotMega
pmplane.Model = model;
planes.Add(pmplane);
}
catch { } // bad lat long value
lastmodel = mod.model;
@ -552,7 +568,7 @@ namespace ArdupilotMega
// create kmz - aka zip file
FileStream fs = File.Open(filename.Replace(".log.kml",".kmz"),FileMode.Create);
FileStream fs = File.Open(filename.Replace(".log.kml", ".kmz"), FileMode.Create);
ZipOutputStream zipStream = new ZipOutputStream(fs);
zipStream.SetLevel(9); //0-9, 9 being the highest level of compression
zipStream.UseZip64 = UseZip64.Off; // older zipfile
@ -632,7 +648,7 @@ namespace ArdupilotMega
}
}
private void downloadthread(int startlognum,int endlognum)
private void downloadthread(int startlognum, int endlognum)
{
for (int a = startlognum; a <= endlognum; a++)
{
@ -643,7 +659,8 @@ namespace ArdupilotMega
comPort.Write(a.ToString() + "\r");
status = serialstatus.Createfile;
while (status != serialstatus.Done) {
while (status != serialstatus.Done)
{
System.Threading.Thread.Sleep(100);
}
@ -660,7 +677,7 @@ namespace ArdupilotMega
System.Threading.Thread.Sleep(500);
comPort.Write("dump ");
System.Threading.Thread.Sleep(100);
comPort.Write(a.ToString()+"\r");
comPort.Write(a.ToString() + "\r");
status = serialstatus.Createfile;
while (status != serialstatus.Done)
@ -687,6 +704,7 @@ namespace ArdupilotMega
System.Threading.Thread.Sleep(500);
comPort.Write("erase\r");
System.Threading.Thread.Sleep(100);
TXT_seriallog.AppendText("!!Allow 30 seconds for erase\n");
status = serialstatus.Done;
}
@ -699,7 +717,7 @@ namespace ArdupilotMega
openFileDialog1.Multiselect = true;
try
{
openFileDialog1.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs"+ Path.DirectorySeparatorChar ;
openFileDialog1.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar;
}
catch { } // incase dir doesnt exist
@ -780,7 +798,7 @@ namespace ArdupilotMega
{
foreach (string logfile in openFileDialog1.FileNames)
{
TXT_seriallog.AppendText("\n\nProcessing " + logfile+"\n");
TXT_seriallog.AppendText("\n\nProcessing " + logfile + "\n");
this.Refresh();
try

View File

@ -321,6 +321,13 @@ namespace ArdupilotMega
RichTextBox txtr = (RichTextBox)ctl;
txtr.BorderStyle = BorderStyle.None;
}
else if (((Type)ctl.GetType()) == typeof(CheckedListBox))
{
ctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
ctl.ForeColor = Color.White;
CheckedListBox txtr = (CheckedListBox)ctl;
txtr.BorderStyle = BorderStyle.None;
}
else if (((Type)ctl.GetType()) == typeof(TabPage))
{
ctl.BackColor = Color.FromArgb(0x26, 0x27, 0x28); //Color.FromArgb(0x43, 0x44, 0x45);
@ -682,7 +689,7 @@ namespace ArdupilotMega
private void CMB_serialport_SelectedIndexChanged(object sender, EventArgs e)
{
comportname = CMB_serialport.Text;
if (comportname == "UDP")
if (comportname == "UDP" || comportname == "TCP")
CMB_baudrate.Enabled = false;
else
CMB_baudrate.Enabled = true;

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.0.83")]
[assembly: AssemblyFileVersion("1.0.84")]
[assembly: NeutralResourcesLanguageAttribute("")]

View File

@ -11,7 +11,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>xG04b9X6TXBWirLuQOgI+3TR8H0=</dsig:DigestValue>
<dsig:DigestValue>sVd4w+f3LroCsyok5UsAi4Bq9eI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>