micropython-nano-gui icon indicating copy to clipboard operation
micropython-nano-gui copied to clipboard

Warning: refresh(ssd, True) called before color initialization in gui\core\colors.py

Open IhorNehrutsa opened this issue 4 years ago • 2 comments
trafficstars

Several examples have an incompletely correct initialization sequence. They call refresh(ssd, True) but 'lut' colors is not initialized. The more correct sequence is:

from color_setup import ssd  # Create a display instance
from gui.core.colors import * # Init colors
from gui.core.nanogui import refresh
refresh(ssd, True)  # clear display.

This is not full list of files: micropython-nano-gui\gui\demos\aclock.py micropython-nano-gui\gui\demos\aclock_large.py micropython-nano-gui\gui\demos\aclock_ttgo.py micropython-nano-gui\gui\demos\alevel.py micropython-nano-gui\gui\demos\asnano_sync.py

It's not critical, but not clean.

IhorNehrutsa avatar May 13 '21 13:05 IhorNehrutsa

I take your point and I will fix this, but I'm currently fully occupied with micro-gui so anything that isn't causing an actual breakage is on the back burner.

You might be interested in this ESP32/T-Display issue. It had me foxed but perhaps you are already aware of it.

peterhinch avatar Jun 09 '21 17:06 peterhinch

I've now pushed an update. In my view the fault was that my code required a specific import order. The patch ensures that the LUT is populated once, when refresh is imported. This prevents refresh from being called with an empty LUT.

from color_setup import ssd  # Create a display instance
from gui.core.nanogui import refresh  # Color LUT is updated now.

Thank you for pointing out this error.

peterhinch avatar Jun 12 '21 16:06 peterhinch

@IhorNehrutsa Can this issue be closed?

freemansoft avatar Feb 14 '23 03:02 freemansoft