Display Timing

I frequently update a display:


            while (true)
            {
                if (stop) myThread.Suspend();
                MyFont.ComputeExtent(s, out width, out height);
                LCD.DrawRectangle(Color.Black, 0, 0, 0, width, height, 0, 0, Color.Black, 0, 0, Color.Black, 0, 0, Bitmap.OpacityOpaque);
                count++;
                s = count.ToString() + " Loops.";
                LCD.DrawText(s, MyFont, Colors.White, 0, 0);
                LCD.Flush();
                MySPI.WriteRead(tx_data, rx_data);
            }

I get some 94 updates/second.
Is this reasonable?
A better way?

Tom Dean

94? Is that reasonable? Yes, if you’re displaying a clock and the seconds only changes in one of those 94 passes. But perhaps not if you’re trying to run a high speed video content.

What is reasonable is only able to be measured by what your outcome is meant to be. Without any more information being shared, you are the only one who can make that decision.

Look through many of the threads here about optimisation, there’s lots of talk about reviewing what you do to achieve better outcomes. Skewworks and his video FPS for gameplay is a good starting benchmark.

@ Tom, use x,y,width,height in your Flush to get some more speed out of it.

Try not to use .suspend either. I keep a bool for pauses and have the Thread cycle a sleep loop while it’s true. That’ll help avoid any issues trying to interact w a suspended thread.