ssd1681: Fix OverflowError for displays larger than 255x255.#90
Merged
BlitzCityDIY merged 1 commit intoadafruit:mainfrom Aug 13, 2025
Merged
ssd1681: Fix OverflowError for displays larger than 255x255.#90BlitzCityDIY merged 1 commit intoadafruit:mainfrom
BlitzCityDIY merged 1 commit intoadafruit:mainfrom
Conversation
Need to explicitly truncate to just the low-order byte; otherwise, creating these bytearrays results in `OverflowError: value must fit in 1 byte(s)`.
Contributor
Author
|
Also: if I have the time I'll see if this pattern occurs in other drivers too and add fixes for them as well. |
Contributor
|
i tested with a feather thinkink and a 1681 monochrome and 1683 tri-color. the driver is not working for the 1683, so i'll be adding a new driver for it. but the monochrome works as expected with this change |
BlitzCityDIY
approved these changes
Aug 13, 2025
adafruit-adabot
added a commit
to adafruit/Adafruit_CircuitPython_Bundle
that referenced
this pull request
Aug 29, 2025
Updating https://github.com/adafruit/Adafruit_CircuitPython_DotStar to 2.2.18 from 2.2.17: > Merge pull request adafruit/Adafruit_CircuitPython_DotStar#71 from dhalbert/spi-lock-managment Updating https://github.com/adafruit/Adafruit_CircuitPython_EPD to 2.15.0 from 2.14.0: > Merge pull request adafruit/Adafruit_CircuitPython_EPD#94 from adafruit/UC8197 > Merge pull request adafruit/Adafruit_CircuitPython_EPD#95 from adafruit/ssd1883 > Merge pull request adafruit/Adafruit_CircuitPython_EPD#93 from adafruit/ssd1680_fix > Merge pull request adafruit/Adafruit_CircuitPython_EPD#90 from AJMansfield/patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_JD79661 to 1.0.1 from 1.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_JD79661#1 from adafruit/cleanup Updating https://github.com/adafruit/Adafruit_CircuitPython_TLV320 to 1.2.1 from 1.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_TLV320#11 from samblenny/fix-example-link > Merge pull request adafruit/Adafruit_CircuitPython_TLV320#10 from samblenny/volume-fixes Updating https://github.com/adafruit/Adafruit_CircuitPython_FruitJam to 1.2.0 from 0.5.0: > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#13 from FoamyGuy/volume_api > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#14 from mikeysklar/ntp-helper > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#12 from mikeysklar/headphone-speaker > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#11 from adafruit/TheKitty-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#9 from relic-se/request_display_config-default > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#8 from relic-se/any_button_pressed-fix Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_UC8253
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When trying to use this driver with a display with dimensions larger than 255x255, the arithmetic operations that attempt to format the width and height into a pair of bytes in the ssd1681 driver's
power_upfunction leaves extra overflowing high-order bits in the low-order byte, resulting in an error:OverflowError: value must fit in 1 byte(s), originating from line 146 (for widths larger than 255) or 153 (for heights larger than 255).This PR fixes this by explicitly masking out just the low byte; it also fixes another instance of this pattern in
set_ram_address(though I've not gone into detail trying to figure out inputs to actually trigger an error from this instance).I've tested this change using an 400x300 HINK-E042A88 SSD1683 display, connected via an Adafruit eInk Feather Friend to my Adafruit Feather RP2040.
Based on my tests I can confirm that this PR addresses the above issue; display operations appear to run correctly with it.