feat: warn about firmware upload limitations for BWR/BWY and non-aligned widths (C1/C2)#107
Merged
g4bri3lDev merged 1 commit intoJul 5, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ned widths (C1/C2) These are device-firmware bugs the library can't fix on-device, so surface them loudly at image-prep time: - C1: BWR/BWY direct write is broken end-to-end — firmware stores only one plane, so the red/yellow layer is discarded and the black/white layer renders over stale color RAM, with no error surfaced. - C2: panels whose width isn't a multiple of the scheme's byte boundary (8 for 1bpp, 4 for 2bpp, 2 for 4bpp) have their last rows silently truncated because firmware sizes the upload from the raw pixel count. GRAYSCALE_4 is exempt (it is row-padded on-device). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JRrm95f1qNZzDM9r2SB6KW
7b70564 to
8c130fe
Compare
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.
Summary
C1 and C2 are device-firmware bugs the library cannot fix on-device — but it can surface them loudly instead of walking into them silently. This PR adds warnings at image-prep time (the shared
prepare_imagepath, so bothupload_imageand standaloneprepare_imagecallers get them).C1 — BWR/BWY direct write is broken end-to-end (🔴 [FW])
Firmware sets
directWriteTotalBytesfor a single plane and never switches toPLANE_1, so the red/yellow plane is discarded and the black/white layer renders over stale color RAM — with no error surfaced. We now warn whenever the scheme is BWR/BWY.C2 — non-byte-aligned widths silently truncate the last rows (🔴 [FW])
Firmware sizes the upload from the raw pixel count (
(w*h+7)/8) while the library row-pads to the panel pitch. On widths not divisible by 8 (1bpp), 4 (2bpp) or 2 (4bpp), the device auto-ENDs early and never writes the last rows. We warn when the panel width isn't aligned for the scheme. GRAYSCALE_4 is exempt — firmware row-pads that path.These are non-breaking (log-only) mitigations; the real fix is in device firmware.
Test plan
uv run pytest -q→ 448 passed (5 new: BWR/BWY warn, non-aligned MONO warns, aligned MONO silent, GRAYSCALE_4 exempt)ruff,mypyclean🤖 Generated with Claude Code