From aa7b490897d622051d08a842e039e4c8bd092a34 Mon Sep 17 00:00:00 2001 From: Brandon Price Date: Wed, 17 Jun 2026 23:32:46 -0400 Subject: [PATCH 1/3] Map Inkplate 6COLOR (0x0043, BWGBRYO) to INKPLATE_6COLOR palette DISPLAY_PALETTE_MAP entry so upload_image dithers correctly for the 6COLOR. Requires epaper-dithering with the Bwgbryo scheme + INKPLATE_6COLOR palette. Co-Authored-By: Claude Opus 4.8 --- src/opendisplay/display_palettes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/opendisplay/display_palettes.py b/src/opendisplay/display_palettes.py index e687803..a570813 100644 --- a/src/opendisplay/display_palettes.py +++ b/src/opendisplay/display_palettes.py @@ -2,6 +2,7 @@ from epaper_dithering import ( BWRY_3_97, + INKPLATE_6COLOR, MONO_4_26, SOLUM_BWR, SPECTRA_7_3_6COLOR, @@ -53,6 +54,8 @@ def get_gray4_codes(panel_ic_type: int | None) -> tuple[int, int, int, int]: (33, ColorScheme.BWR): SOLUM_BWR, # 3.97" BWRY (ep397yr_800x480) (55, ColorScheme.BWRY): BWRY_3_97, + # Inkplate 6COLOR 7-color ACeP (EP585C_600x448 / panel_ic_type 0x0043) + (0x0043, ColorScheme.BWGBRYO): INKPLATE_6COLOR, # Add more as color calibration becomes available: # (?, ColorScheme.BWRY): BWRY_4_2, # 4.2" BWRY # (?, ColorScheme.BWR): HANSHOW_BWR, From eab6620e9220b0e0ff8c80daa0d0d885697393f3 Mon Sep 17 00:00:00 2001 From: Brandon Price Date: Thu, 18 Jun 2026 03:09:35 -0400 Subject: [PATCH 2/3] encode_image: support BWGBRYO (7-color ACeP) as 4bpp identity The BWGBRYO palette is ordered to the panel's native nibbles, so dither indices 0..6 map directly (no remap, unlike BWGBRY). Packs 4bpp like the other 4bpp schemes. Co-Authored-By: Claude Opus 4.8 --- src/opendisplay/encoding/images.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opendisplay/encoding/images.py b/src/opendisplay/encoding/images.py index bbf6b4e..58d93c3 100644 --- a/src/opendisplay/encoding/images.py +++ b/src/opendisplay/encoding/images.py @@ -87,6 +87,10 @@ def encode_image( # 6-color Spectra 6 display uses 4bpp with special firmware values # Palette indices 0-5 map to firmware values 0,1,2,3,5,6 (4 is skipped!) return encode_4bpp(image, bwgbry_mapping=True) + if color_scheme == ColorScheme.BWGBRYO: + # 7-color ACeP (Inkplate 6COLOR) uses 4bpp. The BWGBRYO palette is already + # ordered to the panel's native nibble codes (0..6), so indices map directly. + return encode_4bpp(image) if color_scheme == ColorScheme.GRAYSCALE_4: return encode_2bpp(image) if color_scheme == ColorScheme.GRAYSCALE_16: From 7a52460a0a34a118caebb97415d0c8e4f95ea59c Mon Sep 17 00:00:00 2001 From: Brandon Price Date: Thu, 18 Jun 2026 17:17:39 -0400 Subject: [PATCH 3/3] Handle optional Inkplate dithering support --- src/opendisplay/display_palettes.py | 12 +++++++++--- src/opendisplay/encoding/images.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/opendisplay/display_palettes.py b/src/opendisplay/display_palettes.py index a570813..698b538 100644 --- a/src/opendisplay/display_palettes.py +++ b/src/opendisplay/display_palettes.py @@ -1,8 +1,10 @@ """Automatic measured palette selection and panel capability data for e-paper displays.""" +from typing import cast + +import epaper_dithering as _epaper_dithering from epaper_dithering import ( BWRY_3_97, - INKPLATE_6COLOR, MONO_4_26, SOLUM_BWR, SPECTRA_7_3_6COLOR, @@ -10,6 +12,7 @@ ColorScheme, ) +INKPLATE_6COLOR = cast(ColorPalette | None, getattr(_epaper_dithering, "INKPLATE_6COLOR", None)) # Panel IDs that support 4-gray mode (from firmware mapEpd) PANELS_4GRAY: frozenset[int] = frozenset( { @@ -54,14 +57,17 @@ def get_gray4_codes(panel_ic_type: int | None) -> tuple[int, int, int, int]: (33, ColorScheme.BWR): SOLUM_BWR, # 3.97" BWRY (ep397yr_800x480) (55, ColorScheme.BWRY): BWRY_3_97, - # Inkplate 6COLOR 7-color ACeP (EP585C_600x448 / panel_ic_type 0x0043) - (0x0043, ColorScheme.BWGBRYO): INKPLATE_6COLOR, # Add more as color calibration becomes available: # (?, ColorScheme.BWRY): BWRY_4_2, # 4.2" BWRY # (?, ColorScheme.BWR): HANSHOW_BWR, # (?, ColorScheme.BWY): HANSHOW_BWY, } +_BWGBRYO = cast(ColorScheme | None, getattr(ColorScheme, "BWGBRYO", None)) +if _BWGBRYO is not None and INKPLATE_6COLOR is not None: + # Inkplate 6COLOR 7-color ACeP (EP585C_600x448 / panel_ic_type 0x0043) + DISPLAY_PALETTE_MAP[(0x0043, _BWGBRYO)] = INKPLATE_6COLOR + def get_palette_for_display( panel_ic_type: int | None, diff --git a/src/opendisplay/encoding/images.py b/src/opendisplay/encoding/images.py index 58d93c3..adfae08 100644 --- a/src/opendisplay/encoding/images.py +++ b/src/opendisplay/encoding/images.py @@ -87,7 +87,7 @@ def encode_image( # 6-color Spectra 6 display uses 4bpp with special firmware values # Palette indices 0-5 map to firmware values 0,1,2,3,5,6 (4 is skipped!) return encode_4bpp(image, bwgbry_mapping=True) - if color_scheme == ColorScheme.BWGBRYO: + if color_scheme == getattr(ColorScheme, "BWGBRYO", None): # 7-color ACeP (Inkplate 6COLOR) uses 4bpp. The BWGBRYO palette is already # ordered to the panel's native nibble codes (0..6), so indices map directly. return encode_4bpp(image)