I implemented several code optimizations from
a presentation by Damien George I found on youtube.
The optimizations are on a slide here:
https://youtu.be/hHec4qL00x0?t=813
1) Change __init__ to use bit 5 in madctl register
to swap row/column for landscape mode.
2) Eliminate functions _lscopy and _lscopy_gs.
They are not needed because the ili9488 chip
is handling orientation.
Results in simplification in show() and
do_refresh().
3) Minor optimizations to _lcopy and _lcopy_gs.
Reverse order processing bytes.
Specific changes:
- change while condition from 'x < length' to
simply 'length'. This test is faster in viper.
- use length as index into source instead of x.
Variable x is removed.
This requires the source and dest to be
processed from end to beginning.
- other optimizations from the Pycon talk
given by Damien George.
4) Optimizations to show() and do_refresh().
- Caching in local variables
- Changes to support writing more pixels
for each call to spi.write().
Saving from this are larger on ESP32
than on Pico and Pico 2.
The Damien George optimizations save 10 to 20 milliseconds
per screen refresh on my ESP32. I expect similar results
for Pico and Pico2.
The saving from fewer calls to spi.write() is significant
on my ESP32. 60 to 80 milliseconds.
The saving on Pico and Pico2 are smaller, 10 to 20 milliseconds.
Three relatively small changes:
1) Undo changes to gui/core/writer.py
2) Modify setup_examples/ili9488_pico.py to specify pins
by number rather than string.
3) As recommended, use a 2 byte per entry color lookup table
rather than 3 bytes (needed to undo changes in writer.py).
I ran the same tests for these changes as last time.
ILI9488 does not support 16 bits per pixel over SPI.
It does support it over 8 or 16 bit parallel bus.
As a result, the existing ili9486 driver will work
with some ili9488 boards.
Some vendors sell boards with ILI9488 and serial to parallel
converters.
I beleive those boards will work with either the ili9486 or
this new driver.
I tested this code with the following demos:
- gui/demos/scale.py
- gui/demos/aclock.py
- gui/demos/aclock_large.py
- gui/demos/scale.py
I tested landscape and portrait in color and greyscale.