Skip to content

Set USE_RGB444 for the samd51 hardware variant - #7660

Open
Mikey Sklar (mikeysklar) wants to merge 2 commits into
microsoft:masterfrom
mikeysklar:fix/samd51-use-rgb444
Open

Set USE_RGB444 for the samd51 hardware variant#7660
Mikey Sklar (mikeysklar) wants to merge 2 commits into
microsoft:masterfrom
mikeysklar:fix/samd51-use-rgb444

Conversation

@mikeysklar

Copy link
Copy Markdown

Follow-up to the pxt side of pxt-common-packages#1627.

That PR fixes greyscale rendering on newer PyBadge / PyBadge LC panels, and it is already live in common-packages 14.1.3 which this repo pinned in 181ee59. But the new path is gated on #ifdef USE_RGB444 and nothing defines that symbol, so it compiles out and arcade.makecode.com builds still take the RGBSET path. A user confirmed that today: comment.

This defines the flag for hw---samd51. screen.cpp already guards the path at runtime on CFG_BOOTLOADER_BOARD_ID, so the Kitronik boards that share this variant fall back to RGBSET.

Richard Knoll (@riknoll) this is the flag you offered to wire up, let me know if it belongs somewhere else in the build.

Fixes #6861

🤖 Generated with Claude Code

The ST7735 RGB444 path added in microsoft/pxt-common-packages#1627 is
gated on #ifdef USE_RGB444, which nothing currently defines, so web
builds still take the RGBSET path and render greyscale on newer PyBadge
panels. Define the flag for the samd51 variant; screen.cpp already
guards the path at runtime on Adafruit board ids, so non-Adafruit samd51
boards keep the stock path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mikeysklar

Mikey Sklar (mikeysklar) commented Aug 21, 2026

Copy link
Copy Markdown
Author

Hardware confirmed on a PyBadge (Board-ID SAMD51J19A-PyBadge-M4, bootloader v4.0.0).

pybadge-pr7660

Built the colorbar demo from microsoft/pxt-common-packages#1627 locally with the flag coming only from hw---samd51, nothing set in the project's own pxt.json. Color bars render correctly. Same program built with the flag off is greyscale.

The define does reach screen.cpp: it lands in codal.json definitions, gets written to build/codal_extra_definitions.h, and that header is force-included into every pxtapp source via -include in CXX_FLAGS.

screen.cpp.obj UF2
flag off 7652 624640
flag on 9204 626688

626688 matches the test UF2 attached to #1627 byte for byte in size, with 66 bytes differing in the build-hash region.

One trap if anyone rebuilds this locally: the codal build does not recompile when only codal_extra_definitions.h changes, so flipping the flag and rebuilding gives you the old binary and looks like the flag does nothing. Delete build/CMakeFiles/<TARGET>.dir/pxtapp/screen---st7735/screen.cpp.obj first.

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.

pybadge export no longer has the ability to change color palettes

2 participants