Skip to content
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

sleep() (and probably wake()) throws error #42

Closed
EAGrahamJr opened this issue Jun 13, 2024 · 1 comment · Fixed by #43
Closed

sleep() (and probably wake()) throws error #42

EAGrahamJr opened this issue Jun 13, 2024 · 1 comment · Fixed by #43

Comments

@EAGrahamJr
Copy link
Contributor

This is effectively the same as adafruit/Adafruit_CircuitPython_DisplayIO_SH1106#17, with the same repro code.

import board
import displayio
import i2cdisplaybus
import adafruit_displayio_ssd1306
from time import sleep
import traceback

displayio.release_displays()
i2cBus = board.I2C()
display_bus = i2cdisplaybus.I2CDisplayBus(i2cBus, device_address=0x3C)

WIDTH = 128
HEIGHT = 32

# create the display and put it to sleep
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=WIDTH, height=HEIGHT)

print(f"Wake> {display.is_awake}")
try:
    print("Sleep")
    display.sleep()
    print("No error")
except Exception:
    print(traceback.format_exc())

sleep(.5)
print(f"Wake> {display.is_awake}")
try:
    print("Wakey")
    display.wake()
    print("No error")
except Exception:
    print(traceback.format_exc())

Results:

WORKDIR ‹venv›
╰─$ py brokesleep.py
Wake> True
Sleep
Traceback (most recent call last):
  File "WORKDIR/brokesleep.py", line 21, in <module>
    display.sleep()
  File "WORKDIR/venv/lib/python3.9/site-packages/adafruit_displayio_ssd1306.py", line 130, in sleep
    self.bus.send(0xAE, b"")  # 0xAE = display off, sleep mode
  File "WORKDIR/venv/lib/python3.9/site-packages/i2cdisplaybus/__init__.py", line 90, in send
    self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + data))
TypeError: can only concatenate list (not "bytes") to list

Wake> True
Wakey
No error

Surefire bet that the same "fix" will work, so PR will be incoming.

@EAGrahamJr
Copy link
Contributor Author

Re-opening due to reverting #43 (per #44).

This would more likely be fixed with adafruit/Adafruit_Blinka_Displayio#137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant