From 345fc0b6caaa4c84d3cd79f2343608a858d3d783 Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Mon, 29 Sep 2025 09:12:06 +1000 Subject: [PATCH] [mipi_spi] Fix t-display-amoled (#10922) --- esphome/components/mipi/__init__.py | 10 +++++++++- esphome/components/mipi_spi/models/amoled.py | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/esphome/components/mipi/__init__.py b/esphome/components/mipi/__init__.py index 8b1ca899df..f670a5913d 100644 --- a/esphome/components/mipi/__init__.py +++ b/esphome/components/mipi/__init__.py @@ -401,6 +401,12 @@ class DriverChip: sequence.append((MADCTL, madctl)) return madctl + def skip_command(self, command: str): + """ + Allow suppressing a standard command in the init sequence. + """ + return self.get_default(f"no_{command.lower()}", False) + def get_sequence(self, config) -> tuple[tuple[int, ...], int]: """ Create the init sequence for the display. @@ -432,7 +438,9 @@ class DriverChip: sequence.append((INVOFF,)) if brightness := config.get(CONF_BRIGHTNESS, self.get_default(CONF_BRIGHTNESS)): sequence.append((BRIGHTNESS, brightness)) - sequence.append((SLPOUT,)) + # Add a SLPOUT command if required. + if not self.skip_command("SLPOUT"): + sequence.append((SLPOUT,)) sequence.append((DISPON,)) # Flatten the sequence into a list of bytes, with the length of each command diff --git a/esphome/components/mipi_spi/models/amoled.py b/esphome/components/mipi_spi/models/amoled.py index bc95fc7f71..4d6c8da4b0 100644 --- a/esphome/components/mipi_spi/models/amoled.py +++ b/esphome/components/mipi_spi/models/amoled.py @@ -27,7 +27,8 @@ DriverChip( bus_mode=TYPE_QUAD, brightness=0xD0, color_order=MODE_RGB, - initsequence=(SLPOUT,), # Requires early SLPOUT + no_slpout=True, # SLPOUT is in the init sequence, early + initsequence=(SLPOUT,), ) DriverChip( @@ -95,6 +96,7 @@ CO5300 = DriverChip( brightness=0xD0, color_order=MODE_RGB, bus_mode=TYPE_QUAD, + no_slpout=True, initsequence=( (SLPOUT,), # Requires early SLPOUT (PAGESEL, 0x00),