Skip to content

st7796: enable display inversion (INVON) like the st7789 init - #11

Closed
bitcoin3us wants to merge 1 commit into
MicroPythonOS:integrationfrom
bitcoin3us:fix/st7796-invon
Closed

st7796: enable display inversion (INVON) like the st7789 init#11
bitcoin3us wants to merge 1 commit into
MicroPythonOS:integrationfrom
bitcoin3us:fix/st7796-invon

Conversation

@bitcoin3us

Copy link
Copy Markdown

The st7796 init never sends INVON (0x21), so ST7796 IPS panels render everything in negative. The st7789 init already sends INVON for exactly this reason.

Found while bringing up the Waveshare ESP32-S3-Touch-LCD-3.5 (MicroPythonOS/MicroPythonOS#280): the inverted UI passed for a plausible dark theme during initial testing, and the inversion only became obvious once a camera was attached and the preview looked like a photographic negative. Hardware-verified both ways: sending INVON to the live panel flips it to correct colors instantly, and firmware built with this init renders correctly from boot.

Caveat for review: ST7796 also ships on non-IPS TN modules that would NOT want inversion. st7789 has the same theoretical issue and sends INVON unconditionally, so this PR mirrors that choice for consistency; if you'd rather make it configurable (e.g. an invert=True constructor flag), happy to rework it that way instead.

🤖 Generated with Claude Code

Without INVON the ST7796 IPS panels render everything in negative.
Found on the Waveshare ESP32-S3-Touch-LCD-3.5: the inverted UI passed
for a dark theme during bring-up, and only camera preview photos made
the inversion obvious. Hardware-verified: sending INVON live flips the
panel to correct colors, and a firmware built with this init renders
correctly from boot.

The st7789 init already sends INVON for the same reason.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ThomasFarstrike

ThomasFarstrike commented Sep 1, 2026

Copy link
Copy Markdown

Good catch, but since we will carry our own copy of this driver, there's no need to change it here, I think.

It also doesn't hurt, but since we're trying to keep the diff against upstream lvgl_micropython small, I think I would rather pass on merging it here.

What would be cool is to create this same a pull request at the upstream https://github.com/lvgl-micropython/lvgl_micropython for them to merge. They might come back and ask for this to be settable behavior, not hard coded, as you indicate: "ST7796 also ships on non-IPS TN modules that would NOT want inversion".

@ThomasFarstrike

Copy link
Copy Markdown

See this similar inversion setting that was merged recently: lvgl-micropython#585

@bitcoin3us

Copy link
Copy Markdown
Author

Makes sense — filed upstream instead: lvgl-micropython#604 (with the settable-behavior offer stated up front, as you predicted they may want it). Closing this one; MPOS is covered by the vendored copy in MicroPythonOS/MicroPythonOS#280.

@bitcoin3us bitcoin3us closed this Sep 1, 2026
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