APM Planner 1.1.53

add sensor rate telem
save autopan between sessions
modify connect hb requirement and param timeout
This commit is contained in:
Michael Oborne 2012-03-18 10:29:55 +08:00
parent 80b356367e
commit 64ba673ba4
10 changed files with 2306 additions and 2492 deletions

View File

@ -287,6 +287,8 @@
this.BUT_load = new ArdupilotMega.MyButton();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.BUT_compare = new ArdupilotMega.MyButton();
this.label33 = new System.Windows.Forms.Label();
this.CMB_ratesensors = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit();
this.ConfigTabs.SuspendLayout();
this.TabAP.SuspendLayout();
@ -1715,6 +1717,8 @@
//
// TabPlanner
//
this.TabPlanner.Controls.Add(this.label33);
this.TabPlanner.Controls.Add(this.CMB_ratesensors);
this.TabPlanner.Controls.Add(this.label26);
this.TabPlanner.Controls.Add(this.CMB_videoresolutions);
this.TabPlanner.Controls.Add(this.label12);
@ -2132,6 +2136,25 @@
this.BUT_compare.UseVisualStyleBackColor = true;
this.BUT_compare.Click += new System.EventHandler(this.BUT_compare_Click);
//
// label33
//
resources.ApplyResources(this.label33, "label33");
this.label33.Name = "label33";
//
// CMB_ratesensors
//
this.CMB_ratesensors.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CMB_ratesensors.FormattingEnabled = true;
this.CMB_ratesensors.Items.AddRange(new object[] {
resources.GetString("CMB_ratesensors.Items"),
resources.GetString("CMB_ratesensors.Items1"),
resources.GetString("CMB_ratesensors.Items2"),
resources.GetString("CMB_ratesensors.Items3"),
resources.GetString("CMB_ratesensors.Items4")});
resources.ApplyResources(this.CMB_ratesensors, "CMB_ratesensors");
this.CMB_ratesensors.Name = "CMB_ratesensors";
this.CMB_ratesensors.SelectedIndexChanged += new System.EventHandler(this.CMB_ratesensors_SelectedIndexChanged);
//
// Configuration
//
resources.ApplyResources(this, "$this");
@ -2521,5 +2544,7 @@
private System.Windows.Forms.Label lblSTAB_D;
private System.Windows.Forms.NumericUpDown TUNE_LOW;
private System.Windows.Forms.NumericUpDown TUNE_HIGH;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.ComboBox CMB_ratesensors;
}
}

View File

@ -145,6 +145,7 @@ namespace ArdupilotMega.GCSViews
CMB_rateposition.Text = MainV2.cs.rateposition.ToString();
CMB_raterc.Text = MainV2.cs.raterc.ToString();
CMB_ratestatus.Text = MainV2.cs.ratestatus.ToString();
CMB_ratesensors.Text = MainV2.cs.ratesensors.ToString();
if (MainV2.config["CHK_GDIPlus"] != null)
@ -1183,5 +1184,11 @@ namespace ArdupilotMega.GCSViews
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void CMB_ratesensors_SelectedIndexChanged(object sender, EventArgs e)
{
MainV2.config[((ComboBox)sender).Name] = ((ComboBox)sender).Text;
MainV2.cs.ratesensors = byte.Parse(((ComboBox)sender).Text);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1208,6 +1208,7 @@
this.CHK_autopan.Name = "CHK_autopan";
this.toolTip1.SetToolTip(this.CHK_autopan, resources.GetString("CHK_autopan.ToolTip"));
this.CHK_autopan.UseVisualStyleBackColor = true;
this.CHK_autopan.CheckedChanged += new System.EventHandler(this.CHK_autopan_CheckedChanged);
//
// CB_tuning
//

View File

@ -230,6 +230,9 @@ namespace ArdupilotMega.GCSViews
Zoomlevel.Minimum = gMapControl1.MinZoom;
Zoomlevel.Maximum = gMapControl1.MaxZoom + 1;
Zoomlevel.Value = Convert.ToDecimal(gMapControl1.Zoom);
if (MainV2.config["CHK_autopan"] != null)
CHK_autopan.Checked = bool.Parse(MainV2.config["CHK_autopan"].ToString());
}
private void mainloop()
@ -1765,5 +1768,10 @@ print 'Roll complete'
scr.runScript(tb.Text);
}
}
private void CHK_autopan_CheckedChanged(object sender, EventArgs e)
{
MainV2.config["CHK_autopan"] = CHK_autopan.Checked.ToString();
}
}
}

View File

@ -208,7 +208,7 @@
<value>hud1</value>
</data>
<data name="&gt;&gt;hud1.Type" xml:space="preserve">
<value>hud.HUD, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>hud.HUD, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;hud1.Parent" xml:space="preserve">
<value>SubMainLeft.Panel1</value>
@ -247,7 +247,7 @@
<value>BUT_script</value>
</data>
<data name="&gt;&gt;BUT_script.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_script.Parent" xml:space="preserve">
<value>tabActions</value>
@ -280,7 +280,7 @@
<value>BUT_joystick</value>
</data>
<data name="&gt;&gt;BUT_joystick.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_joystick.Parent" xml:space="preserve">
<value>tabActions</value>
@ -310,7 +310,7 @@
<value>BUT_quickmanual</value>
</data>
<data name="&gt;&gt;BUT_quickmanual.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_quickmanual.Parent" xml:space="preserve">
<value>tabActions</value>
@ -340,7 +340,7 @@
<value>BUT_quickrtl</value>
</data>
<data name="&gt;&gt;BUT_quickrtl.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_quickrtl.Parent" xml:space="preserve">
<value>tabActions</value>
@ -370,7 +370,7 @@
<value>BUT_quickauto</value>
</data>
<data name="&gt;&gt;BUT_quickauto.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_quickauto.Parent" xml:space="preserve">
<value>tabActions</value>
@ -424,7 +424,7 @@
<value>BUT_setwp</value>
</data>
<data name="&gt;&gt;BUT_setwp.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_setwp.Parent" xml:space="preserve">
<value>tabActions</value>
@ -475,7 +475,7 @@
<value>BUT_setmode</value>
</data>
<data name="&gt;&gt;BUT_setmode.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_setmode.Parent" xml:space="preserve">
<value>tabActions</value>
@ -505,7 +505,7 @@
<value>BUT_clear_track</value>
</data>
<data name="&gt;&gt;BUT_clear_track.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_clear_track.Parent" xml:space="preserve">
<value>tabActions</value>
@ -556,7 +556,7 @@
<value>BUT_Homealt</value>
</data>
<data name="&gt;&gt;BUT_Homealt.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_Homealt.Parent" xml:space="preserve">
<value>tabActions</value>
@ -586,7 +586,7 @@
<value>BUT_RAWSensor</value>
</data>
<data name="&gt;&gt;BUT_RAWSensor.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_RAWSensor.Parent" xml:space="preserve">
<value>tabActions</value>
@ -616,7 +616,7 @@
<value>BUTrestartmission</value>
</data>
<data name="&gt;&gt;BUTrestartmission.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUTrestartmission.Parent" xml:space="preserve">
<value>tabActions</value>
@ -646,7 +646,7 @@
<value>BUTactiondo</value>
</data>
<data name="&gt;&gt;BUTactiondo.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUTactiondo.Parent" xml:space="preserve">
<value>tabActions</value>
@ -700,7 +700,7 @@
<value>Gvspeed</value>
</data>
<data name="&gt;&gt;Gvspeed.Type" xml:space="preserve">
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Gvspeed.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -730,7 +730,7 @@
<value>Gheading</value>
</data>
<data name="&gt;&gt;Gheading.Type" xml:space="preserve">
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Gheading.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -760,7 +760,7 @@
<value>Galt</value>
</data>
<data name="&gt;&gt;Galt.Type" xml:space="preserve">
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Galt.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -793,7 +793,7 @@
<value>Gspeed</value>
</data>
<data name="&gt;&gt;Gspeed.Type" xml:space="preserve">
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>AGaugeApp.AGauge, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;Gspeed.Parent" xml:space="preserve">
<value>tabGauges</value>
@ -874,7 +874,7 @@
<value>lbl_logpercent</value>
</data>
<data name="&gt;&gt;lbl_logpercent.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_logpercent.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -925,7 +925,7 @@
<value>BUT_log2kml</value>
</data>
<data name="&gt;&gt;BUT_log2kml.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_log2kml.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -976,7 +976,7 @@
<value>BUT_playlog</value>
</data>
<data name="&gt;&gt;BUT_playlog.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_playlog.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -1003,7 +1003,7 @@
<value>BUT_loadtelem</value>
</data>
<data name="&gt;&gt;BUT_loadtelem.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;BUT_loadtelem.Parent" xml:space="preserve">
<value>tabTLogs</value>
@ -1189,7 +1189,7 @@
<value>lbl_winddir</value>
</data>
<data name="&gt;&gt;lbl_winddir.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_winddir.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1219,7 +1219,7 @@
<value>lbl_windvel</value>
</data>
<data name="&gt;&gt;lbl_windvel.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lbl_windvel.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1391,7 +1391,7 @@
<value>gMapControl1</value>
</data>
<data name="&gt;&gt;gMapControl1.Type" xml:space="preserve">
<value>ArdupilotMega.myGMAP, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.myGMAP, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;gMapControl1.Parent" xml:space="preserve">
<value>splitContainer1.Panel2</value>
@ -1454,7 +1454,7 @@
<value>TXT_lat</value>
</data>
<data name="&gt;&gt;TXT_lat.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_lat.Parent" xml:space="preserve">
<value>panel1</value>
@ -1511,7 +1511,7 @@
<value>label1</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>panel1</value>
@ -1541,7 +1541,7 @@
<value>TXT_long</value>
</data>
<data name="&gt;&gt;TXT_long.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_long.Parent" xml:space="preserve">
<value>panel1</value>
@ -1571,7 +1571,7 @@
<value>TXT_alt</value>
</data>
<data name="&gt;&gt;TXT_alt.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TXT_alt.Parent" xml:space="preserve">
<value>panel1</value>
@ -1772,7 +1772,7 @@
<value>label6</value>
</data>
<data name="&gt;&gt;label6.Type" xml:space="preserve">
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>ArdupilotMega.MyLabel, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;label6.Parent" xml:space="preserve">
<value>$this</value>
@ -1850,6 +1850,6 @@
<value>FlightData</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -190,8 +190,8 @@ namespace ArdupilotMega
Thread.Sleep(1000);
}
byte[] buffer;
byte[] buffer1;
byte[] buffer = new byte[0];
byte[] buffer1 = new byte[0];
DateTime start = DateTime.Now;
DateTime deadline = start.AddSeconds(CONNECT_TIMEOUT_SECONDS);
@ -248,14 +248,18 @@ namespace ArdupilotMega
// incase we are in setup mode
BaseStream.WriteLine("planner\rgcs\r");
buffer = getHeartBeat();
// can see 2 heartbeat packets at any time, and will connect - was one after the other
if (buffer.Length == 0)
buffer = getHeartBeat();
// incase we are in setup mode
BaseStream.WriteLine("planner\rgcs\r");
System.Threading.Thread.Sleep(1);
buffer1 = getHeartBeat();
if (buffer1.Length == 0)
buffer1 = getHeartBeat();
try
{
@ -317,6 +321,7 @@ namespace ArdupilotMega
frmProgressReporter.UpdateProgressAndStatus(100, "Done.");
log.Info("Done open " + sysid + " " + compid);
packetslost = 0;
synclost = 0;
}
byte[] getHeartBeat()
@ -340,19 +345,19 @@ namespace ArdupilotMega
public void sendPacket(object indata)
{
bool run = false;
bool validPacket = false;
byte a = 0;
foreach (Type ty in mavstructs)
{
if (ty == indata.GetType())
{
run = true;
validPacket = true;
generatePacket(a, indata);
return;
}
a++;
}
if (!run)
if (!validPacket)
{
log.Info("Mavlink : NOT VALID PACKET sendPacket() " + indata.GetType().ToString());
}
@ -603,7 +608,7 @@ namespace ArdupilotMega
// clear old
param = new Hashtable();
int retrys = 3;
int retrys = 6;
int param_count = 0;
int param_total = 5;
@ -629,8 +634,8 @@ namespace ArdupilotMega
return param;
}
// 2 seconds between valid packets
if (!(start.AddMilliseconds(2000) > DateTime.Now))
// 4 seconds between valid packets
if (!(start.AddMilliseconds(4000) > DateTime.Now))
{
if (retrys > 0)
{
@ -641,7 +646,7 @@ namespace ArdupilotMega
continue;
}
MainV2.givecomport = false;
throw new Exception("Timeout on read - getParamList " + param_count + " " + param_total);
throw new Exception("Timeout on read - getParamList " + got.Count + " " + param_total + "\n\nYour serial link isn't fast enough\n");
}
byte[] buffer = readPacket();
@ -671,11 +676,12 @@ namespace ArdupilotMega
// check if we already have it
if (got.Contains(par.param_index))
{
//Console.WriteLine("Already got '"+paramID+"'");
log.Info("Already got "+(par.param_index) + " '" + paramID + "'");
this.frmProgressReporter.UpdateProgressAndStatus((got.Count * 100) / param_total, "Already Got param " + paramID);
continue;
}
log.Info(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 " + (par.param_count - 2) + " name: " + paramID);
modifyParamForDisplay(true, paramID, ref par.param_value);
param[paramID] = (par.param_value);
@ -2084,7 +2090,7 @@ namespace ArdupilotMega
if (bpstime.Second != DateTime.Now.Second && !logreadmode)
{
// Console.Write("bps {0} loss {1} left {2} mem {3} \n", bps1, synclost, BaseStream.BytesToRead, System.GC.GetTotalMemory(false));
Console.Write("bps {0} loss {1} left {2} mem {3} \n", bps1, synclost, BaseStream.BytesToRead, System.GC.GetTotalMemory(false));
bps2 = bps1; // prev sec
bps1 = 0; // current sec
bpstime = DateTime.Now;

View File

@ -187,12 +187,14 @@ namespace ArdupilotMega
this.Location = startpos;
}
if (config["MainMaximised"] != null)
this.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), config["MainMaximised"].ToString());
if (config["MainHeight"] != null)
this.Height = int.Parse(config["MainHeight"].ToString());
if (config["MainWidth"] != null)
this.Width = int.Parse(config["MainWidth"].ToString());
if (config["MainMaximised"] != null)
this.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), config["MainMaximised"].ToString());
if (config["CMB_rateattitude"] != null)
MainV2.cs.rateattitude = byte.Parse(config["CMB_rateattitude"].ToString());
@ -202,10 +204,12 @@ namespace ArdupilotMega
MainV2.cs.ratestatus = byte.Parse(config["CMB_ratestatus"].ToString());
if (config["CMB_rateattitude"] != null)
MainV2.cs.raterc = byte.Parse(config["CMB_raterc"].ToString());
if (config["CMB_ratesensors"] != null)
MainV2.cs.raterc = byte.Parse(config["CMB_ratesensors"].ToString());
if (config["speechenable"] != null)
MainV2.speechenable = bool.Parse(config["speechenable"].ToString());
//int fixme;
/*
MainV2.cs.rateattitude = 50;
@ -277,7 +281,7 @@ namespace ArdupilotMega
}
string[] ports = SerialPort.GetPortNames()
.Select(p=>p.TrimEnd())
.Select(p => p.TrimEnd())
.Select(FixBlueToothPortNameBug)
.ToArray();
@ -289,26 +293,26 @@ namespace ArdupilotMega
return allPorts;
}
// .NET bug: sometimes bluetooth ports are enumerated with bogus characters
// eg 'COM10' becomes 'COM10c' - one workaround is to remove the non numeric
// char. Annoyingly, sometimes a numeric char is added, which means this
// does not work in all cases.
// See http://connect.microsoft.com/VisualStudio/feedback/details/236183/system-io-ports-serialport-getportnames-error-with-bluetooth
private string FixBlueToothPortNameBug(string portName)
{
if (!portName.StartsWith("COM"))
return portName;
var newPortName = "COM"; // Start over with "COM"
foreach (var portChar in portName.Substring(3).ToCharArray()) // Remove "COM", put the rest in a character array
{
if (char.IsDigit(portChar))
newPortName += portChar.ToString(); // Good character, append to portName
else
log.WarnFormat("Bad (Non Numeric) character in port name '{0}' - removing", portName);
}
return newPortName;
}
// .NET bug: sometimes bluetooth ports are enumerated with bogus characters
// eg 'COM10' becomes 'COM10c' - one workaround is to remove the non numeric
// char. Annoyingly, sometimes a numeric char is added, which means this
// does not work in all cases.
// See http://connect.microsoft.com/VisualStudio/feedback/details/236183/system-io-ports-serialport-getportnames-error-with-bluetooth
private string FixBlueToothPortNameBug(string portName)
{
if (!portName.StartsWith("COM"))
return portName;
var newPortName = "COM"; // Start over with "COM"
foreach (var portChar in portName.Substring(3).ToCharArray()) // Remove "COM", put the rest in a character array
{
if (char.IsDigit(portChar))
newPortName += portChar.ToString(); // Good character, append to portName
else
log.WarnFormat("Bad (Non Numeric) character in port name '{0}' - removing", portName);
}
return newPortName;
}
internal void ScreenShot()
{
@ -548,7 +552,6 @@ namespace ArdupilotMega
comPort.BaseStream.toggleDTR();
comPort.BaseStream.DtrEnable = false;
comPort.BaseStream.RtsEnable = false;
try
{
@ -557,7 +560,7 @@ namespace ArdupilotMega
try
{
Directory.CreateDirectory(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs");
comPort.logfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + ".tlog", FileMode.CreateNew,FileAccess.ReadWrite,FileShare.Read));
comPort.logfile = new BinaryWriter(File.Open(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"logs" + Path.DirectorySeparatorChar + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + ".tlog", FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read));
}
catch { CustomMessageBox.Show("Failed to create log - wont log this session"); } // soft fail
@ -1503,7 +1506,8 @@ namespace ArdupilotMega
log.Info("Quitting existing process");
try
{
MainV2.instance.BeginInvoke((MethodInvoker)delegate() {
MainV2.instance.BeginInvoke((MethodInvoker)delegate()
{
Application.Exit();
});
}
@ -1786,7 +1790,7 @@ namespace ArdupilotMega
((HttpWebRequest)request).AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
request.Headers.Add("Accept-Encoding", "gzip,deflate");
request.Headers.Add("Accept-Encoding", "gzip,deflate");
// Get the response.
response = request.GetResponse();

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