I’m working on an gauge type indicator using the 7" LCD and the EMX/Cobra. It will have two pointers swinging from the top center of the display and deflecting +/- 60 degrees. Ideally I would like a refresh rate of 5-10Hz.
I’ve been trying to get an idea of performance for the system using the code below.
With the Glide Window set to 800x480 and the image object set to 560x280 it takes approx 17 seconds to render and flush the image to the screen 30 times. This is much improved over the 35+seconds my previous code was taking, that was repainting the entire 800x480 area.
My question is: Is this the expected performance for the EMX and the 7" display or am I doing something totally wrong?
Thanks
Brian
using System.Threading;
using Microsoft.SPOT;
using GHIElectronics.NETMF.Glide;
using GHIElectronics.NETMF.Glide.Display;
using GHIElectronics.NETMF.Glide.UI;
namespace GlideTest1
{
public class Program
{
// This will hold the main window.
static Window window;
static long StartTick = 0;
static long StopTick = 0;
public static void Main()
{
// Add the following as a txt file Resource named "WindowX"
// <Glide Version="1.0.4">
// <Window Name="window" Width="800" Height="480" BackColor="FFFFFF">
// <Image Name="image" X="120" Y="0" Width="560" Height="280" Alpha="255"/>
// <Button Name="button" X="0" Y="0" Width="80" Height="32" Alpha="255" Text="Button" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
// </Window>
// </Glide>
// Load the window,
window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.WindowX));
// Initialize the image I will be drawing on
Image image = (Image)window.GetChildByName("image");
//Start timing
StartTick = System.DateTime.Now.Ticks;
Glide.MainWindow = window;
for (int i=0; i < 30; i++)
{
image.Bitmap.DrawEllipse(Colors.Blue, 20+i, 20+i, 50-i, 50-i);
//also tried as a Rectangle to see if performance was impacted
//image.Bitmap.DrawRectangle(Colors.Blue, 2, 20 + i, 20 + i, 50 - i, 50 - i, 0, 0, Colors.Red, 0, 0, Colors.Red,0,0,100);
image.Render();
Glide.Flush(image);
//Thread.Sleep(150); //desired refresh rate is 5-10Hz
}
//STOP TIMING
StopTick = System.DateTime.Now.Ticks;
//Print to debug how long the for loop operation took to complete.
Debug.Print(((StopTick - StartTick) / 10000).ToString() + " mSec");
Thread.Sleep(-1);
}
}
}