Skip to content

fix: per-panel BWRY code table + 4-gray table additions (M3)#102

Merged
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:fix/bwry-panel-palette
Jul 5, 2026
Merged

fix: per-panel BWRY code table + 4-gray table additions (M3)#102
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:fix/bwry-panel-palette

Conversation

@balloob

@balloob balloob commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

M3 — BWRY red/yellow swapped on EP29YR panels (🟠)

BWRY wire nibbles were hardcoded to the u8Colors_4clr_v2 order (black=0/white=1/yellow=2/red=3). Panel tags 0x001D/0x001E (EP29YR_128x296 / EP29YR_168x384) use u8Colors_4clr, where the native codes are 2=red, 3=yellow, and the firmware direct-write path streams the nibble raw — so yellow and red rendered swapped on those panels.

Fix: add a per-panel BWRY code table (get_bwry_codes) analogous to the existing _GRAY4_CODES_BY_PANEL, and apply it when encoding BWRY in prepare_image via encode_2bpp(codes=...). encode_2bpp gains an optional identity-default codes LUT.

4-gray table additions (🟡)

  • Add the EP368_792x528_4GRAY (0x0048) V2 code entry (its mid-grays were swapped, matching bb_ep.inl).
  • Add the missing 4-gray panel ids 0x0043/0x0044/0x0046/0x004C (and 0x0048) to PANELS_4GRAY.

Test plan

  • uv run pytest -q → 448 passed (5 new tests: swap table for 0x001D/0x001E, identity default, encode_2bpp applies codes, EP368 V2 codes, PANELS_4GRAY membership)
  • ruff, mypy clean

🤖 Generated with Claude Code

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

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/opendisplay/device.py 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

BWRY nibbles were hardcoded to the u8Colors_4clr_v2 order (black/white/
yellow=2/red=3). Panels 0x001D/0x001E (EP29YR) use u8Colors_4clr, where the
native codes are 2=red, 3=yellow, and the firmware direct-write path streams
the nibble raw — so yellow and red rendered swapped on those panels. Add a
per-panel BWRY code table (get_bwry_codes) analogous to the 4-gray table, and
apply it when encoding BWRY in prepare_image via encode_2bpp(codes=...).

Also add the EP368_792x528_4GRAY (0x0048) V2 code entry (its mid-grays were
swapped) and the missing 4-gray panel ids 0x0043/0x0044/0x0046/0x004C to
PANELS_4GRAY.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JRrm95f1qNZzDM9r2SB6KW
@balloob balloob force-pushed the fix/bwry-panel-palette branch from 736ba80 to c47608c Compare July 4, 2026 11:41
@g4bri3lDev g4bri3lDev merged commit 68ef815 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