adafruit/Adafruit_CircuitPython_Display_Text

bitmap_label flicker

rdagger opened this issue · 3 comments

The bitmap_label has varying degrees of flicker when used to display frequently changing data. It is very noticeable and occurs regardless of the baud rate.

I switched from a regular label to save memory but immediately noticed the difference. The regular label has no perceivable flicker during updates.

from adafruit_display_text import bitmap_label, label
from adafruit_ssd1322 import SSD1322
from board import D9, D17, D18, SPI
import displayio
import gc
import terminalio
from time import sleep

displayio.release_displays()
display_bus = displayio.FourWire(SPI(), command=D9, chip_select=D18, reset=D17,
                                 baudrate=20000000)
display = SSD1322(display_bus, width=256, height=64, colstart=112)

label = label.Label(terminalio.FONT,
                    color=0xFFFFFF,
                    scale=2,
                    x=0,
                    y=20)

bmp_label = bitmap_label.Label(terminalio.FONT,
                               color=0xFFFFFF,
                               save_text=False,
                               scale=2,
                               anchor_point=(0, 0),
                               anchored_position=(0, 40))

group = displayio.Group()
group.append(label)
group.append(bmp_label)
display.show(group)

while True:
    label.text = f'L: {gc.mem_free()} bytes'
    bmp_label.text = f'B: {gc.mem_free()} bytes'
    sleep(2)

It might be worth trying out with display.auto_refresh = False and calling refresh() manually after you've changed the text.

I'm not certain, but my best guess on the flicker would be a refresh happening part way through it updating it's bitmap.