From 298eeb6c9d8e66792f8d502ca1a1ee61f2313a44 Mon Sep 17 00:00:00 2001 From: Anson Mansfield Date: Mon, 2 Jun 2025 10:11:18 -0400 Subject: [PATCH] ssd1681: Fix OverflowError for displays larger than 255x255. Need to explicitly truncate to just the low-order byte; otherwise, creating these bytearrays results in `OverflowError: value must fit in 1 byte(s)`. --- adafruit_epd/ssd1681.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adafruit_epd/ssd1681.py b/adafruit_epd/ssd1681.py index e888983..4b2031f 100644 --- a/adafruit_epd/ssd1681.py +++ b/adafruit_epd/ssd1681.py @@ -143,7 +143,7 @@ def power_up(self) -> None: # driver output control self.command( _SSD1681_DRIVER_CONTROL, - bytearray([self._width - 1, (self._width - 1) >> 8, 0x00]), + bytearray([(self._width - 1) & 0xFF, (self._width - 1) >> 8, 0x00]), ) # data entry mode self.command(_SSD1681_DATA_MODE, bytearray([0x03])) @@ -152,7 +152,7 @@ def power_up(self) -> None: # Set ram Y start/end postion self.command( _SSD1681_SET_RAMYPOS, - bytearray([0, 0, self._height - 1, (self._height - 1) >> 8]), + bytearray([0, 0, (self._height - 1) & 0xFF, (self._height - 1) >> 8]), ) # Set border waveform self.command(_SSD1681_WRITE_BORDER, bytearray([0x05])) @@ -190,4 +190,4 @@ def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841 # Set RAM X address counter self.command(_SSD1681_SET_RAMXCOUNT, bytearray([x])) # Set RAM Y address counter - self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y, y >> 8])) + self.command(_SSD1681_SET_RAMYCOUNT, bytearray([y & 0xFF, y >> 8])) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy