I have a NewHaven LCD panel connected to the G120 and have configured it to run ok. I can put images on the display ok, but when outputting bitmaps there appears to be tearing. It’s almost like it takes time to render a Bitmap
Any ideas on the best way to quickly switch between two images without tearing?
Currently doing this:
// flash test
Bitmap bon = new Bitmap(Resources.GetBytes(Resources.BinaryResources._6a), Bitmap.BitmapImageType.Jpeg);
Bitmap boff = new Bitmap(Resources.GetBytes(Resources.BinaryResources._6), Bitmap.BitmapImageType.Jpeg);
while (true)
{
Thread.Sleep(200);
lcd.DrawImage(0, 0, bon, 0, 0, 800, 480);
lcd.Flush();
Thread.Sleep(200);
lcd.DrawImage(0, 0, boff, 0, 0, 800, 480);
lcd.Flush();
}
I have a pixel clock rate set to 20,000 which I assume maps to 20MHz.
Resolution is 800x480 which is similar to the GHI CP7 which is what I select as the base display in the settings and then modify the various Porch/Polarity etc. to work.
This is an easy fix. The CP7 timings are all wrong for the 5".
Use this code in your programme. Call it during startup and it will make the changes and reboot. If the settings are not changed it will remain the same and run normally. This is ideal as the settings get wiped when you update the firmware.
private static void InitDisplay()
{
//
// Because we might reflash, we have to reprogramme the Display Driver
// as this will be wiped out when we reflash the firmware.
//
Display.Width = 800;
Display.Height = 480;
Display.HorizontalSyncPulseWidth = 48;
Display.HorizontalBackPorch = 88;
Display.HorizontalFrontPorch = 40;
Display.VerticalSyncPulseWidth = 3;
Display.VerticalBackPorch = 32;
Display.VerticalFrontPorch = 13;
Display.PixelClockRateKHz = 25000;
Display.OutputEnableIsFixed = true;
Display.OutputEnablePolarity = true;
Display.HorizontalSyncPolarity = true;
Display.VerticalSyncPolarity = true;
Display.PixelPolarity = false;
Display.Type = Display.DisplayType.Lcd;
if (Display.Save()) // Reboot required?
{
PowerState.RebootDevice(false);
}
}
The panel comes with cables built in. They are around 2-3 inches. These go to a SMT header and traces are about an inch to the module.
It appears to reboot on every startup now, which is odd as I’d expect the settings to remain saved. But if I use Fez Config to save bad settings it does reboot to a “working” screen, so they are being applied. I can read them from FezConfig too, although very oddly that sometimes reads old values and sometimes new. It is almost as if the firmware has two places the settings are maintained and depending on the read time, you get the ‘previously saved from fez’ settings and other times the ‘code assigned’ settings.
My code should only reboot on change. The first time it runs it will make the changes and then any subsequent run should just bypass the reboot option.
I’ve seen Fezconfig have issues reading and sometime needs 2 or 3 times to pick up the LCD settings.
What if you use Fezconfig to use the settings I gave you?