How can I refresh(erase) the LCD T35 quickly?

Hi,

I have the FEZ spider Kit. I find, that the refresh(erase) is very slow for LCD, if I use “display.SimpleGraphics.Clear();”

I have a routine for LCD T35 as follow, the timer is 10ms, I think the timer is enough quick, but it seems that the refresh(erase) is very slow for my 16 Temperatur values to show on the LCD.

Can anybody idea? How can I refresh(erase) the LCD quickly?



        void Timer2_Tick(GT.Timer timer)//LCD Timer is 10ms
        {

            display.SimpleGraphics.Clear();

            display.SimpleGraphics.DisplayText("T1: "  + Temperatur[0],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 0,    0);
            display.SimpleGraphics.DisplayText("T2: "  + Temperatur[1],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 50,   0);
            display.SimpleGraphics.DisplayText("T3: "  + Temperatur[2],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 100,  0);
            display.SimpleGraphics.DisplayText("T4: "  + Temperatur[3],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 150,  0);
            display.SimpleGraphics.DisplayText("T5: "  + Temperatur[4],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 0,   20);
            display.SimpleGraphics.DisplayText("T6: "  + Temperatur[5],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 50,  20);
            display.SimpleGraphics.DisplayText("T7: "  + Temperatur[6],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 100, 20);
            display.SimpleGraphics.DisplayText("T8: "  + Temperatur[7],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 150, 20);
            display.SimpleGraphics.DisplayText("T9: "  + Temperatur[8],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 0,   40);
            display.SimpleGraphics.DisplayText("T10: " + Temperatur[9],  Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 50,  40);
            display.SimpleGraphics.DisplayText("T11: " + Temperatur[10], Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 100, 40);
            display.SimpleGraphics.DisplayText("T12: " + Temperatur[11], Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 150, 40);
            display.SimpleGraphics.DisplayText("T13: " + Temperatur[12], Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 0,   60);
            display.SimpleGraphics.DisplayText("T14: " + Temperatur[13], Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 50,  60);
            display.SimpleGraphics.DisplayText("T15: " + Temperatur[14], Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 100, 60);
            display.SimpleGraphics.DisplayText("T16: " + Temperatur[15], Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, 150, 60);

        }


For starters, get the font resource once and store it in a variable during startup, and use that variable when drawing text. Next, set the display.SimpleGraphics AutoRedraw to false in startup - that’ll stop it trying to redraw the screen every time you write one line of text. Replace Clear with ClearNoRedraw, and when you’ve written all your text, add an explicit redraw - display.SimpleGraphics.Redraw.

  1. Have you tried the Glide display library?
  • Create your window with your TextBlocks
  • On data refreshes, set the .Text value of the textblocks for the readings, and the call .Invalidate()
  1. 10ms seems awfully quick as a refresh rate. Can a person even see a refresh that quick?
    30 frames a second is the number I have in my head for a person’s ability to see. If my math is correct, this is ~33ms.

**

If you want to stick to the SimpleGraphics, then I wonder if it would be quicker to put the text values on a Bitmap representing the screen, and then draw that image instead of the individual text fields.


Also - I second the recommendations by RorschachUK

1 Like

@ RorschachUK -

Can you give me a example? on the basis of my routine?

Using his suggestions:

add module variable in your app:

 static Font font;

in your startup do:

font = Resources.GetFont(Resources.FontResources.NinaB);
display.SimpleGraphics AutoRedraw = false;

And then:

void Timer2_Tick(GT.Timer timer)//LCD Timer is 10ms
        {
 
            display.SimpleGraphics.ClearNoRedraw();
 
            display.SimpleGraphics.DisplayText("T1: "  + Temperatur[0],  font, GT.Color.Blue, 0,    0);
             ...
            display.Redraw();
        }
1 Like

@ mhectorgato -

Thanks a lot !!! it works very well!!

Credit goes to RorschachUK :slight_smile:

Hello, I have tried with the Glide library. The refresh time is about 500ms with the two methods

I modify my Textblock and after if I choose one of this two possibilities :


                Glide.MainWindow.Invalidate();  // During 500ms

or


                Glide.MainWindow = window;    // During 500ms too :-(

Any idea to refresh my TEXTBOX quickly with GLIDE ?

I have found !

I use

 
               textvaleurmesurees[i].Text = valeursmesurees[i].ToString();
                textvaleurmesurees[i].Invalidate();         // Update the value on the display (quick)

In this case the refresh is just for the textbox and not the entire windows… I learn…nice