APM Planner 1.1.51

revert posible camera issue
fix apc220 units rts issue
fix bluetooth comport issue - re andrew
cleanup startup test
This commit is contained in:
Michael Oborne 2012-03-13 07:15:08 +08:00
parent 953b93293e
commit 5ad90ac0cc
6 changed files with 42 additions and 22 deletions

View File

@ -157,7 +157,7 @@ namespace WebCamService
Start();
// Start waiting
if ( ! m_PictureReady.WaitOne(2000, false) )
if ( ! m_PictureReady.WaitOne(5000, false) )
{
throw new Exception("Timeout waiting to get picture");
}

View File

@ -184,7 +184,8 @@ namespace ArdupilotMega
BaseStream.DiscardInBuffer();
BaseStream.toggleDTR();
// removed because of apc220 units
//BaseStream.toggleDTR();
Thread.Sleep(1000);
}

View File

@ -261,37 +261,55 @@ namespace ArdupilotMega
private string[] GetPortNames()
{
string[] devs = new string[0];
string[] monoDevs = new string[0];
log.Debug("Geting Comports");
log.Debug("Getting Comports");
if (MONO)
{
if (Directory.Exists("/dev/"))
{
if (Directory.Exists("/dev/serial/by-id/"))
devs = Directory.GetFiles("/dev/serial/by-id/", "*");
devs = Directory.GetFiles("/dev/", "*ACM*");
devs = Directory.GetFiles("/dev/", "ttyUSB*");
monoDevs = Directory.GetFiles("/dev/serial/by-id/", "*");
monoDevs = Directory.GetFiles("/dev/", "*ACM*");
monoDevs = Directory.GetFiles("/dev/", "ttyUSB*");
}
}
string[] ports = SerialPort.GetPortNames();
string[] ports = SerialPort.GetPortNames()
.Select(p=>p.TrimEnd())
.Select(FixBlueToothPortNameBug)
.ToArray();
for (int a = 0; a < ports.Length; a++)
{
ports[a] = ports[a].TrimEnd();
}
string[] allPorts = new string[monoDevs.Length + ports.Length];
string[] all = new string[devs.Length + ports.Length];
monoDevs.CopyTo(allPorts, 0);
ports.CopyTo(allPorts, monoDevs.Length);
devs.CopyTo(all, 0);
ports.CopyTo(all, devs.Length);
return all;
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;
}
internal void ScreenShot()
{
Rectangle bounds = Screen.GetBounds(Point.Empty);
@ -526,11 +544,12 @@ namespace ArdupilotMega
comPort.BaseStream.StopBits = (StopBits)Enum.Parse(typeof(StopBits), "1");
comPort.BaseStream.Parity = (Parity)Enum.Parse(typeof(Parity), "None");
comPort.BaseStream.DtrEnable = false;
if (config["CHK_resetapmonconnect"] == null || bool.Parse(config["CHK_resetapmonconnect"].ToString()) == true)
comPort.BaseStream.toggleDTR();
comPort.BaseStream.DtrEnable = false;
comPort.BaseStream.RtsEnable = false;
try
{
if (comPort.logfile != null)

View File

@ -31,7 +31,7 @@ namespace ArdupilotMega
Application.Idle += Application_Idle;
CodeGen.runCode("Sin(0.55)");
//CodeGen.runCode("Sin(0.55)");
int wt = 0, ct = 0;
ThreadPool.GetMaxThreads(out wt, out ct);

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