From 3b8f044a5660545bb0f26aa6504c8fdf8bdcf993 Mon Sep 17 00:00:00 2001 From: Bitcoin3us <115934595+bitcoin3us@users.noreply.github.com> Date: Mon, 31 Aug 2026 12:00:55 +0100 Subject: [PATCH] st7796: enable display inversion (INVON) like the st7789 init 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 --- .../common_api_drivers/display/st7796/_st7796_init.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api_drivers/common_api_drivers/display/st7796/_st7796_init.py b/api_drivers/common_api_drivers/display/st7796/_st7796_init.py index ffb7b5e0..253d0b17 100644 --- a/api_drivers/common_api_drivers/display/st7796/_st7796_init.py +++ b/api_drivers/common_api_drivers/display/st7796/_st7796_init.py @@ -18,6 +18,7 @@ _VCMPCTL = const(0xC5) _PGC = const(0xE0) _NGC = const(0xE1) +_INVON = const(0x21) _DISPON = const(0x29) _EM = const(0xB7) @@ -118,6 +119,10 @@ def init(self): time.sleep_ms(120) # NOQA + # IPS panels are normally-inverted: without INVON the whole display + # renders in negative. The st7789 init does the same. + self.set_params(_INVON) + self.set_params(_DISPON) time.sleep_ms(120) # NOQA