adafruit / Adafruit_CircuitPython_DisplayIO_SH1106

CircuitPython library for SH1106 OLED displays
MIT License
4 stars 5 forks source link

SH1106 requires a "row offset" due to RAM buffer size differences #20

Open EAGrahamJr opened 1 month ago

EAGrahamJr commented 1 month ago

This chip has a slightly larger memory buffer per row than the SH1107 (132 vs 128), so currently the display is shifted and also draws a white line on the right-hand side.

NOTE This is running the modified driver from #19

20240712_101053

Code running in picture:

import time, board,  displayio, i2cdisplaybus, terminalio
import adafruit_displayio_sh1106

# Select one to run
from adafruit_display_text import bitmap_label as label
# from adafruit_display_text import label as label

displayio.release_displays()
dw,dh = 128, 64

i2c = board.STEMMA_I2C()
display_bus = i2cdisplaybus.I2CDisplayBus(i2c, device_address=0x3C)
display = adafruit_displayio_sh1106.SH1106(display_bus, width=dw, height=dh)
display.wake()

maingroup = displayio.Group()
display.root_group = maingroup
text1 = label.Label(terminalio.FONT, text="helloworld...")
text1.anchor_point = (0.0, 0.0)
text1.anchored_position = (0, 0)
text2 = label.Label(terminalio.FONT, text="@edgjr       ")
text2.anchor_point = (0.0, 0.0)
text2.anchored_position = (0, dh / 2)

for t in (text1, text2):
    maingroup.append(t)

while True:
    try:
        text2.text = "%.1f" % time.monotonic()
        time.sleep(0.1)
    except KeyboardInterrupt:
        break

display.sleep()
EAGrahamJr commented 1 month ago

20240712_102220

EAGrahamJr commented 3 weeks ago

Note the same issue occurs on Raspberry Pi using Blinka (the red frame in the picture does not obscure any part of the OLED screen).

image

EAGrahamJr commented 2 weeks ago

Might be related to https://github.com/adafruit/Adafruit_Blinka_Displayio/issues/135