Skip to content

feat: warn about firmware upload limitations for BWR/BWY and non-aligned widths (C1/C2)#107

Merged
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:fix/firmware-limitation-warnings
Jul 5, 2026
Merged

feat: warn about firmware upload limitations for BWR/BWY and non-aligned widths (C1/C2)#107
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:fix/firmware-limitation-warnings

Conversation

@balloob

@balloob balloob commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

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_image path, so both upload_image and standalone prepare_image callers get them).

C1 — BWR/BWY direct write is broken end-to-end (🔴 [FW])

Firmware sets directWriteTotalBytes for a single plane and never switches to PLANE_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, mypy clean

🤖 Generated with Claude Code

@balloob balloob requested a review from g4bri3lDev as a code owner July 4, 2026 07:20
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

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
@balloob balloob force-pushed the fix/firmware-limitation-warnings branch from 7b70564 to 8c130fe Compare July 4, 2026 11:42
@g4bri3lDev g4bri3lDev merged commit 84bf22c into OpenDisplay:main Jul 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants