Skip to content

sleep() throws error #17

Closed
Closed
@EAGrahamJr

Description

@EAGrahamJr

Adding a display.sleep() call at the end of the example causes an error to be thrown. This the hacked-up code that reproduces the error:

import busio
import displayio
import board
import adafruit_displayio_sh1106

# Create the I2C interface.
i2c = busio.I2C(board.SCL, board.SDA)
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)

WIDTH = 128
HEIGHT = 64
# create the display and put it to sleep
display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT)
display.sleep()

This is the error (personal directories removed):

$ python brokesleep.py 
Traceback (most recent call last):
  File "brokesleep.py", line 14, in <module>
    display.sleep()
  File "venv/lib/python3.11/site-packages/adafruit_displayio_sh1106.py", line 111, in sleep
    self.bus.send(0xAE, b"")  # 0xAE = display off, sleep mode
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv/lib/python3.11/site-packages/displayio/_i2cdisplay.py", line 90, in send
    self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + data))
                                                             ~~~~~~~~~~^~~~~~
TypeError: can only concatenate list (not "bytes") to list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions