APM Planner - 1.0.72

fix hud issues
This commit is contained in:
Michael Oborne 2011-09-19 07:42:22 +08:00
parent 151cae6074
commit 28f86f8987
5 changed files with 41 additions and 26 deletions

View File

@ -145,7 +145,7 @@
<Reference Include="Microsoft.DirectX.DirectInput, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <Reference Include="Microsoft.DirectX.DirectInput, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.DirectInput.dll</HintPath> <HintPath>..\..\..\..\..\..\..\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.DirectInput.dll</HintPath>
<Private>True</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL"> <Reference Include="OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@ -247,6 +247,8 @@ namespace ArdupilotMega.GCSViews
if (MainV2.comPort.logreadmode && MainV2.comPort.logplaybackfile != null) if (MainV2.comPort.logreadmode && MainV2.comPort.logplaybackfile != null)
{ {
BUT_playlog.Text = "Pause";
if (comPort.BaseStream.IsOpen) if (comPort.BaseStream.IsOpen)
MainV2.comPort.logreadmode = false; MainV2.comPort.logreadmode = false;
@ -287,6 +289,10 @@ namespace ArdupilotMega.GCSViews
MainV2.comPort.logreadmode = false; MainV2.comPort.logreadmode = false;
} }
} }
else
{
BUT_playlog.Text = "Play";
}
try try
{ {

View File

@ -49,6 +49,7 @@ namespace hud
InitializeComponent(); InitializeComponent();
graphicsObject = this; graphicsObject = this;
graphicsObjectGDIP = Graphics.FromImage(objBitmap);
} }
private void InitializeComponent() private void InitializeComponent()
@ -136,8 +137,7 @@ namespace hud
public bool bgon = true; public bool bgon = true;
public bool hudon = true; public bool hudon = true;
[System.ComponentModel.Browsable(true), [System.ComponentModel.Browsable(true), System.ComponentModel.Category("Values")]
System.ComponentModel.Category("Values")]
public Color hudcolor { get { return whitePen.Color; } set { whitePen = new Pen(value, 2); } } public Color hudcolor { get { return whitePen.Color; } set { whitePen = new Pen(value, 2); } }
Pen whitePen = new Pen(Color.White, 2); Pen whitePen = new Pen(Color.White, 2);
@ -261,10 +261,15 @@ System.ComponentModel.Category("Values")]
huddrawtime += (int)(DateTime.Now - starttime).TotalMilliseconds; huddrawtime += (int)(DateTime.Now - starttime).TotalMilliseconds;
if (huddrawtime > 500)
{
opengl = false;
}
if (DateTime.Now.Second != countdate.Second) if (DateTime.Now.Second != countdate.Second)
{ {
countdate = DateTime.Now; countdate = DateTime.Now;
Console.WriteLine("HUD " + count + " hz drawtime " + (huddrawtime / count)); Console.WriteLine("HUD " + count + " hz drawtime " + (huddrawtime / count) + " gl " + opengl);
count = 0; count = 0;
huddrawtime = 0; huddrawtime = 0;
} }
@ -624,11 +629,22 @@ System.ComponentModel.Category("Values")]
void doPaint(PaintEventArgs e) void doPaint(PaintEventArgs e)
{ {
graphicsObjectGDIP = Graphics.FromImage(objBitmap);
graphicsObjectGDIP.SmoothingMode = SmoothingMode.AntiAlias;
try try
{ {
if (graphicsObjectGDIP == null || !opengl && (objBitmap.Width != this.Width || objBitmap.Height != this.Height))
{
objBitmap = new Bitmap(this.Width, this.Height);
graphicsObjectGDIP = Graphics.FromImage(objBitmap);
graphicsObjectGDIP.SmoothingMode = SmoothingMode.AntiAlias;
graphicsObjectGDIP.InterpolationMode = InterpolationMode.NearestNeighbor;
graphicsObjectGDIP.CompositingMode = CompositingMode.SourceOver;
graphicsObjectGDIP.CompositingQuality = CompositingQuality.HighSpeed;
graphicsObjectGDIP.PixelOffsetMode = PixelOffsetMode.HighSpeed;
graphicsObjectGDIP.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
}
graphicsObject.Clear(Color.Gray); graphicsObject.Clear(Color.Gray);
if (_bgimage != null) if (_bgimage != null)

View File

@ -161,20 +161,6 @@ namespace ArdupilotMega
} }
catch (Exception e) { MessageBox.Show("A Major error has occured : " + e.ToString()); this.Close(); } catch (Exception e) { MessageBox.Show("A Major error has occured : " + e.ToString()); this.Close(); }
Console.WriteLine("check hud");
GCSViews.FlightData.myhud.Refresh();
GCSViews.FlightData.myhud.Refresh();
GCSViews.FlightData.myhud.Refresh();
if (GCSViews.FlightData.myhud.huddrawtime > 1000)
{
MessageBox.Show("The HUD draw time is above 1 seconds. Please update your graphics card driver.");
GCSViews.FlightData.myhud.opengl = false;
}
Console.WriteLine("check hud done");
changeunits(); changeunits();
try try
@ -1370,27 +1356,34 @@ namespace ArdupilotMega
} }
if (loadinglabel != null) if (loadinglabel != null)
loadinglabel.Text = "Checking " + file; loadinglabel.Text = "Checking " + file;
string path = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + subdir + file;
// Create a request using a URL that can receive a post. // Create a request using a URL that can receive a post.
request = WebRequest.Create(baseurl + file); request = WebRequest.Create(baseurl + file);
Console.Write(baseurl + file + " "); Console.Write(baseurl + file + " ");
// Set the Method property of the request to POST. // Set the Method property of the request to POST.
request.Method = "HEAD"; request.Method = "HEAD";
((HttpWebRequest)request).IfModifiedSince = File.GetLastWriteTimeUtc(path);
// Get the response. // Get the response.
response = request.GetResponse(); response = request.GetResponse();
// Display the status. // Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription); Console.WriteLine(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server. // Get the stream containing content returned by the server.
dataStream = response.GetResponseStream(); //dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access. // Open the stream using a StreamReader for easy access.
string path = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + subdir + file;
bool getfile = false; bool getfile = false;
if (File.Exists(path)) if (File.Exists(path))
{ {
FileInfo fi = new FileInfo(path); FileInfo fi = new FileInfo(path);
Console.WriteLine(response.Headers[HttpResponseHeader.ETag]);
if (fi.Length != response.ContentLength) // && response.Headers[HttpResponseHeader.ETag] != "0") if (fi.Length != response.ContentLength) // && response.Headers[HttpResponseHeader.ETag] != "0")
{ {
StreamWriter sw = new StreamWriter(path+".etag"); StreamWriter sw = new StreamWriter(path+".etag");
@ -1408,7 +1401,7 @@ namespace ArdupilotMega
} }
reader.Close(); reader.Close();
dataStream.Close(); //dataStream.Close();
response.Close(); response.Close();
if (getfile) if (getfile)

View File

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