i2c controlled power supply : Flicker free ILI9341 - The problem


I bought a few ILI9341 LCD screens on ebay. I intend to use them for the i2c controlled power supply.
Why those ?

  • They are cheap, big enough
  • Using the block update, they are fast. Basically define a rectangle on the screen and send all the data in one transaction. This is much faster than drawing  pixel per pixel or even line by line


We have a nice driver for STM32 -arduino using that blockmode.
That driver is indeed very fast.

With one issue : font management


Going back in time, that driver is derived from the Adafruit one
With the Adafruit one, you can use pseudo ttf font, with variable width/height. 
Pick any font you like, use fontconvert to generate the fontxxxxx .h and done.
Since they are variable width, the result looks natural.

The problem is when overwriting.
Since it is variable width/height you cannot just overwrite the old text with the new one, some leftovers may stick.
For example, replacing "ZZZZ" by "llll" will create "llllZ" because the "l" are much narrower.

NB: It is actually more complicated, because that driver only draws what's needed, so you'll also got leftovers above/below/right/left when printing small things on top of larger ones.

So the usual way is to first blank the maximum area, then print over it


Problem solved ?
Not really, that creates major flickering. In the example above you'll erase the "ZZZZ" first, THEN draw the "llll". Even if the driver is fast, it will definitively flicker.



The STM32 driver takes a different approach : It uses fixed width font.
So no problem, just overwrite the old text with the new one, they'll take the same space, no leftover anywhere.
BUT
  • It does not look very natural. An "i" is taking the same space as a "Z", same for "." or ",".
  • You cannot pick any font you want, in any size

So let's make something in between combining the best of both.

Comments

Popular posts from this blog

Component tester with STM32 : Part 1 ADC, Resistor

Fixing the INA3221

INA3221, weird wiring