-
Notifications
You must be signed in to change notification settings - Fork 10
Power on delay - potential enhancement #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
import time
import board
import displayio
from i2cdisplaybus import I2CDisplayBus
import adafruit_displayio_sh1107
displayio.release_displays()
i2c = board.STEMMA_I2C() # uses board.SCL and board.SDA
i2cdisplay_bus = I2CDisplayBus(i2c, device_address=0x3C)
# SH1107 is vertically oriented 64x128
WIDTH = 128
HEIGHT = 64
BORDER = 2
dispi2c = adafruit_displayio_sh1107.SH1107(i2cdisplay_bus, width=WIDTH, height=HEIGHT)
# Make the display context
splash = displayio.Group()
dispi2c.root_group = splash
color_bitmap = displayio.Bitmap(WIDTH, HEIGHT, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF # White
inner_palette = displayio.Palette(1)
inner_palette[0] = 0x000000 # Black
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)
# Draw some squares
lrg_bitmap = displayio.Bitmap(32, 32, 1)
lrg_square = displayio.TileGrid(lrg_bitmap, pixel_shader=inner_palette, x=91, y=28)
splash.append(lrg_square)
time.sleep(5)
print('code.py Done!') |
I added a delay (100 through 150 ms) to the init sequence |
The SH1107 datasheet recommends a 100ms delay after the power on command is issued. (See pages 43-44.) This driver doesn't appear to implement this or mention that it might be needed in the documentation.
I have experienced EIO errors with a different MicroPython driver for the Adafruit 1.12 inch SH1107 128x128 OLED and a raspberrypi Pico. Adding a delay after issuing the display on command (AF hex) seemed to solve the problem.
I'm not familiar with the details of the Circuit Python system, and perhaps this is handled elsewhere, but as a possibly helpful thought, might it make this driver more robust to include a 100ms delay/sleep in the constructor initialisation and wake methods?
The text was updated successfully, but these errors were encountered: