APM Planner 1.1.7

modify apvar dump detection
remove reference to CLI and LOG/Setup mode
add line feeds for logs/terminal
fix flow_enabled check on form load
This commit is contained in:
Michael Oborne 2011-12-16 20:04:20 +08:00
parent 04ec569313
commit dc31d82f13
13 changed files with 134 additions and 54 deletions

View File

@ -10,7 +10,7 @@ namespace ArdupilotMega
class ArduinoDetect
{
/// <summary>
/// detects a 1280 or a 2560 board
/// detects STK version 1 or 2
/// </summary>
/// <param name="port">comportname</param>
/// <returns>string either (1280/2560) or "" for none</returns>
@ -62,6 +62,85 @@ namespace ArdupilotMega
System.Threading.Thread.Sleep(100);
a = 0;
while (a < 4)
{
byte[] temp = new byte[] { 0x6, 0, 0, 0, 0 };
temp = ArduinoDetect.genstkv2packet(serialPort, temp);
a++;
System.Threading.Thread.Sleep(50);
try
{
if (temp[0] == 6 && temp[1] == 0 && temp.Length == 2)
{
serialPort.Close();
return "2560";
}
}
catch { }
}
serialPort.Close();
Console.WriteLine("Not a 2560");
return "";
}
/// <summary>
/// Detects APM board version
/// </summary>
/// <param name="port"></param>
/// <returns> (1280/2560/2560-2)</returns>
public static string DetectBoard(string port)
{
SerialPort serialPort = new SerialPort();
serialPort.PortName = port;
if (serialPort.IsOpen)
serialPort.Close();
serialPort.DtrEnable = true;
serialPort.BaudRate = 57600;
serialPort.Open();
System.Threading.Thread.Sleep(100);
int a = 0;
while (a < 20) // 20 * 50 = 1 sec
{
//Console.WriteLine("write " + DateTime.Now.Millisecond);
serialPort.DiscardInBuffer();
serialPort.Write(new byte[] { (byte)'0', (byte)' ' }, 0, 2);
a++;
System.Threading.Thread.Sleep(50);
//Console.WriteLine("btr {0}", serialPort.BytesToRead);
if (serialPort.BytesToRead >= 2)
{
byte b1 = (byte)serialPort.ReadByte();
byte b2 = (byte)serialPort.ReadByte();
if (b1 == 0x14 && b2 == 0x10)
{
serialPort.Close();
return "1280";
}
}
}
serialPort.Close();
Console.WriteLine("Not a 1280");
System.Threading.Thread.Sleep(500);
serialPort.DtrEnable = true;
serialPort.BaudRate = 115200;
serialPort.Open();
System.Threading.Thread.Sleep(100);
a = 0;
while (a < 4)
{
@ -101,7 +180,7 @@ namespace ArdupilotMega
}
else
{
if (DialogResult.Yes == MessageBox.Show("APM 2.0", "Is this a APM 2?", MessageBoxButtons.YesNo))
if (DialogResult.Yes == MessageBox.Show("Is this a APM 2?", "APM 2", MessageBoxButtons.YesNo))
{
return "2560-2";
}
@ -110,7 +189,7 @@ namespace ArdupilotMega
return "2560";
}
}
}
}
catch { }
@ -119,7 +198,8 @@ namespace ArdupilotMega
serialPort.Close();
Console.WriteLine("Not a 2560");
return "";
}
}
public static int decodeApVar(string comport, string version)
{
@ -170,10 +250,10 @@ namespace ArdupilotMega
if (key == 0)
{
//Array.Reverse(buffer, pos, 2);
return BitConverter.ToUInt16(buffer,pos);
return BitConverter.ToUInt16(buffer, pos);
}
for (int i = 0; i <= size; i++)
{
Console.Write(" {0:X2}", buffer[pos]);
@ -283,4 +363,4 @@ namespace ArdupilotMega
return mes;
}
}
}
}

View File

@ -440,9 +440,11 @@
</EmbeddedResource>
<EmbeddedResource Include="RAW_Sensor.resx">
<DependentUpon>RAW_Sensor.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MavlinkLog.resx">
<DependentUpon>MavlinkLog.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GCSViews\Configuration.resx">
<DependentUpon>Configuration.cs</DependentUpon>
@ -490,6 +492,7 @@
</EmbeddedResource>
<EmbeddedResource Include="JoystickSetup.resx">
<DependentUpon>JoystickSetup.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="JoystickSetup.zh-Hans.resx">
<DependentUpon>JoystickSetup.cs</DependentUpon>
@ -514,9 +517,11 @@
</EmbeddedResource>
<EmbeddedResource Include="Log.resx">
<DependentUpon>Log.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="LogBrowse.resx">
<DependentUpon>LogBrowse.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
@ -533,6 +538,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Setup\Setup.resx">
<DependentUpon>Setup.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Setup\Setup.zh-Hans.resx">
<DependentUpon>Setup.cs</DependentUpon>

View File

@ -266,7 +266,7 @@ namespace ArdupilotMega.GCSViews
fd.ShowDialog();
if (File.Exists(fd.FileName))
{
UploadFlash(fd.FileName, ArduinoDetect.DetectVersion(MainV2.comportname));
UploadFlash(fd.FileName, ArduinoDetect.DetectBoard(MainV2.comportname));
}
return true;
}
@ -498,7 +498,7 @@ namespace ArdupilotMega.GCSViews
this.Refresh();
board = ArduinoDetect.DetectVersion(MainV2.comportname);
board = ArduinoDetect.DetectBoard(MainV2.comportname);
if (board == "")
{

View File

@ -178,7 +178,7 @@
<value>NoControl</value>
</data>
<data name="pictureBoxQuad.Location" type="System.Drawing.Point, System.Drawing">
<value>563, -10</value>
<value>399, -9</value>
</data>
<data name="pictureBoxQuad.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 190</value>
@ -205,7 +205,7 @@
<value>NoControl</value>
</data>
<data name="pictureBoxHexa.Location" type="System.Drawing.Point, System.Drawing">
<value>770, -10</value>
<value>595, -8</value>
</data>
<data name="pictureBoxHexa.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 190</value>
@ -232,7 +232,7 @@
<value>NoControl</value>
</data>
<data name="pictureBoxTri.Location" type="System.Drawing.Point, System.Drawing">
<value>563, 184</value>
<value>399, 185</value>
</data>
<data name="pictureBoxTri.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 190</value>
@ -259,7 +259,7 @@
<value>NoControl</value>
</data>
<data name="pictureBoxY6.Location" type="System.Drawing.Point, System.Drawing">
<value>770, 184</value>
<value>595, 186</value>
</data>
<data name="pictureBoxY6.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 190</value>
@ -430,7 +430,7 @@
<value>NoControl</value>
</data>
<data name="lbl_ACQuad.Location" type="System.Drawing.Point, System.Drawing">
<value>560, 168</value>
<value>396, 169</value>
</data>
<data name="lbl_ACQuad.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 13</value>
@ -460,7 +460,7 @@
<value>NoControl</value>
</data>
<data name="lbl_ACHexa.Location" type="System.Drawing.Point, System.Drawing">
<value>767, 168</value>
<value>592, 170</value>
</data>
<data name="lbl_ACHexa.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 13</value>
@ -490,7 +490,7 @@
<value>NoControl</value>
</data>
<data name="lbl_ACTri.Location" type="System.Drawing.Point, System.Drawing">
<value>560, 361</value>
<value>396, 362</value>
</data>
<data name="lbl_ACTri.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 13</value>
@ -520,7 +520,7 @@
<value>NoControl</value>
</data>
<data name="lbl_ACY6.Location" type="System.Drawing.Point, System.Drawing">
<value>767, 361</value>
<value>592, 363</value>
</data>
<data name="lbl_ACY6.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 13</value>
@ -550,7 +550,7 @@
<value>NoControl</value>
</data>
<data name="lbl_Heli.Location" type="System.Drawing.Point, System.Drawing">
<value>310, 167</value>
<value>200, 167</value>
</data>
<data name="lbl_Heli.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 13</value>
@ -580,7 +580,7 @@
<value>NoControl</value>
</data>
<data name="pictureBoxHeli.Location" type="System.Drawing.Point, System.Drawing">
<value>313, -9</value>
<value>203, -9</value>
</data>
<data name="pictureBoxHeli.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 190</value>
@ -607,7 +607,7 @@
<value>NoControl</value>
</data>
<data name="lbl_ACHil.Location" type="System.Drawing.Point, System.Drawing">
<value>310, 361</value>
<value>200, 361</value>
</data>
<data name="lbl_ACHil.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 13</value>
@ -637,7 +637,7 @@
<value>NoControl</value>
</data>
<data name="pictureBoxQuadHil.Location" type="System.Drawing.Point, System.Drawing">
<value>313, 184</value>
<value>203, 184</value>
</data>
<data name="pictureBoxQuadHil.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 190</value>

View File

@ -1359,19 +1359,8 @@ namespace ArdupilotMega.GCSViews
throttle_out = ((float)MainV2.cs.hilch3 + 5000) / throttlegain;
rudder_out = (float)MainV2.cs.hilch4 / ruddergain;
}
/*
if ((roll_out == -1 || roll_out == 1) && (pitch_out == -1 || pitch_out == 1))
{
this.Invoke((MethodInvoker)delegate
{
try
{
OutputLog.AppendText("Please check your radio setup - CLI -> setup -> radio!!!\n");
}
catch { }
});
}
*/
// Limit min and max
roll_out = Constrain(roll_out, -1, 1);
pitch_out = Constrain(pitch_out, -1, 1);

View File

@ -155,8 +155,6 @@ namespace ArdupilotMega.GCSViews
private void Terminal_Load(object sender, EventArgs e)
{
MessageBox.Show("Set your APM into LOG/SETUP mode!! (switch towards the servo header)");
try
{
MainV2.givecomport = true;
@ -175,6 +173,11 @@ namespace ArdupilotMega.GCSViews
System.Threading.Thread t11 = new System.Threading.Thread(delegate()
{
threadrun = true;
System.Threading.Thread.Sleep(2000);
comPort.Write("\n\n\n\n\n");
while (threadrun)
{
try

View File

@ -136,8 +136,7 @@
<value>0</value>
</data>
<data name="TXT_terminal.Text" xml:space="preserve">
<value>NOTE: You must disconnect and move the slider switch when done to use other tabs
</value>
<value />
</data>
<data name="&gt;&gt;TXT_terminal.Name" xml:space="preserve">
<value>TXT_terminal</value>
@ -167,7 +166,7 @@
<value>BUTsetupshow</value>
</data>
<data name="&gt;&gt;BUTsetupshow.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.4199.27022, Culture=neutral, PublicKeyToken=ff91852278f5092c</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
<data name="&gt;&gt;BUTsetupshow.Parent" xml:space="preserve">
<value>$this</value>
@ -191,7 +190,7 @@
<value>BUTradiosetup</value>
</data>
<data name="&gt;&gt;BUTradiosetup.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.4199.27022, Culture=neutral, PublicKeyToken=ff91852278f5092c</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
<data name="&gt;&gt;BUTradiosetup.Parent" xml:space="preserve">
<value>$this</value>
@ -215,7 +214,7 @@
<value>BUTtests</value>
</data>
<data name="&gt;&gt;BUTtests.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.4199.27022, Culture=neutral, PublicKeyToken=ff91852278f5092c</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
<data name="&gt;&gt;BUTtests.Parent" xml:space="preserve">
<value>$this</value>
@ -239,7 +238,7 @@
<value>Logs</value>
</data>
<data name="&gt;&gt;Logs.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.4199.27022, Culture=neutral, PublicKeyToken=ff91852278f5092c</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
<data name="&gt;&gt;Logs.Parent" xml:space="preserve">
<value>$this</value>
@ -263,7 +262,7 @@
<value>BUT_logbrowse</value>
</data>
<data name="&gt;&gt;BUT_logbrowse.Type" xml:space="preserve">
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.4199.27022, Culture=neutral, PublicKeyToken=ff91852278f5092c</value>
<value>ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
<data name="&gt;&gt;BUT_logbrowse.Parent" xml:space="preserve">
<value>$this</value>
@ -284,6 +283,6 @@
<value>Terminal</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Windows.Forms.MyUserControl, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc</value>
</data>
</root>

View File

@ -87,6 +87,10 @@ namespace ArdupilotMega
threadrun = true;
System.Threading.Thread.Sleep(2000);
comPort.Write("\n\n\n\n");
while (threadrun)
{
try
@ -175,7 +179,7 @@ namespace ArdupilotMega
{
case serialstatus.Connecting:
if (line.Contains("reset to FLY") || line.Contains("interactive setup") || line.Contains("CLI:"))
if (line.Contains("reset to FLY") || line.Contains("interactive setup") || line.Contains("CLI:") || line.Contains("Ardu"))
{
comPort.Write("logs\r");
}

View File

@ -686,11 +686,6 @@ namespace ArdupilotMega
if (config["CHK_resetapmonconnect"] == null || bool.Parse(config["CHK_resetapmonconnect"].ToString()) == true)
comPort.BaseStream.DtrEnable = true;
if (DialogResult.OK != Common.MessageShowAgain("Mavlink Connect", "Make sure your APM slider switch is in Flight Mode (away from RC pins)"))
{
return;
}
try
{
if (comPort.logfile != null)
@ -771,7 +766,7 @@ namespace ArdupilotMega
}
}
catch { }
MessageBox.Show("Is your CLI switch in Flight position?\n(this is required for MAVlink comms)\n\n" + ex.ToString());
MessageBox.Show("Can not establish a connection\n\n" + ex.ToString());
return;
}
}

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

View File

@ -291,7 +291,7 @@ namespace ArdupilotMega
}
catch
{
MessageBox.Show("Comport open failed - Please try again and make sure your not in CLI mode");
MessageBox.Show("Comport open failed");
return;
}
timer1.Start();

View File

@ -116,7 +116,7 @@ It includes both fixed wing (APM) and rotary wing (!ArduCopter) parameters. Some
||LIM_PITCH_MIN||-6000||0||-2500||100||1||PITCH_MIN_DEGREE - The maximum commanded pitch down angle. Note that this value must be negative. The default is -25 degrees. Care should be taken not to set this value too large as it may result in overspeeding the aircraft.||
||GND_ALT_CM||0||500000||0||100||1||GND_ALT_CM||
||GND_ABS_PRESS|| || ||0|| || ||GND_ABS_PRESS||
||COMPASS_DEC||-1.57075||1.57075||0||1|| ||COMPASS_DEC - Compass Declination||
||COMPASS_DEC||-1.57075||1.57075||0||1|| ||COMPASS_DEC - Compass Declination in RADIANS||
||SR0_EXT_STAT||0||50||3||1||1||TELEMETRY_ENABLE Port 0 - Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS||
||SR0_EXTRA1||0||50||10||1||1||TELEMETRY_ENABLE Port 0 - Enable MSG_ATTITUDE||
||SR0_EXTRA2||0||50||3||1||1||TELEMETRY_ENABLE Port 0 - Enable MSG_VFR_HUD||

View File

@ -377,6 +377,7 @@ namespace ArdupilotMega.Setup
if (tabControl1.SelectedTab == tabHardware)
{
startup = true;
if (MainV2.comPort.param["ARSPD_ENABLE"] != null)
CHK_enableairspeed.Checked = MainV2.comPort.param["ARSPD_ENABLE"].ToString() == "1" ? true : false;
@ -391,6 +392,9 @@ namespace ArdupilotMega.Setup
if (MainV2.comPort.param["SONAR_TYPE"] != null)
CMB_sonartype.SelectedIndex = int.Parse(MainV2.comPort.param["SONAR_TYPE"].ToString());
if (MainV2.comPort.param["FLOW_ENABLE"] != null)
CHK_enableoptflow.Checked = MainV2.comPort.param["FLOW_ENABLE"].ToString() == "1" ? true : false;
startup = false;