Skip to content

Commit

Permalink
Fix compatibility with Python < 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
hchargois committed Jan 6, 2025
1 parent 7228a69 commit fdb9b58
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions library/lcd/lcd_comm_rev_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def SetBrightness(self, level: int = 25):
# Convert our brightness % to an absolute value.
converted_level = level * 5

level_bytes = bytearray(converted_level.to_bytes(2))
level_bytes = bytearray(converted_level.to_bytes(2, "big"))

# Send the command twice because sometimes it is not applied...
self.SendCommand(cmd=Command.SETBL, payload=level_bytes)
Expand Down Expand Up @@ -166,10 +166,11 @@ def DisplayPILImage(
image_width, image_height = image_height, image_width

# Send bitmap size
image_data = bytearray(x0.to_bytes(2))
image_data += bytearray(x1.to_bytes(2))
image_data += bytearray(y0.to_bytes(2))
image_data += bytearray(y1.to_bytes(2))
image_data = bytearray()
image_data += x0.to_bytes(2, "big")
image_data += x1.to_bytes(2, "big")
image_data += y0.to_bytes(2, "big")
image_data += y1.to_bytes(2, "big")
self.SendCommand(cmd=Command.BLOCKWRITE, payload=image_data)

# Prepare bitmap data transmission
Expand Down

0 comments on commit fdb9b58

Please sign in to comment.