Adafruit_CircuitPython_DisplayIO_SSD1306 icon indicating copy to clipboard operation
Adafruit_CircuitPython_DisplayIO_SSD1306 copied to clipboard

High CPU consumption even with auto_refresh=False

Open monojk opened this issue 1 year ago • 1 comments

I noticed 100% CPU with my application on a Raspberry Pi, even I have several seconds sleep in my loop. I use auto_refresh = False

I can reproduce that behaviour with these modifications of examples/displayio_ssd1306_simpletest.py

from time import sleep
...
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=WIDTH, height=HEIGHT, auto_refresh=False)
...
display.auto_refresh = False        # just to be sure

while True:
    display.refresh()
    sleep(5)

How can I bring down the CPU usage?

monojk avatar Sep 19 '24 11:09 monojk

I believe this is not specific to the SSD1306, but more generally with the way BlinkaDisplayIO works.

You can see this effect if you open a REPL and just import displayio while watching htop.

I'm not certain of all of the specifics but I think there is a background thread getting used during some part of the process for rendering that is running as soon as displayio gets imported.

FoamyGuy avatar Jan 15 '25 17:01 FoamyGuy