Fix display orientation and update MADCTL settings for correct portrait mode

This commit is contained in:
Joshua King
2026-03-06 21:17:53 -05:00
parent 6434885ee9
commit ef0841de3f

View File

@@ -6,9 +6,25 @@ esphome:
name: ${name}
friendly_name: ${friendly_name}
on_boot:
priority: 100
then:
- light.turn_on: backlight
- priority: 100
then:
- light.turn_on: backlight
- priority: -100
then:
- lambda: |-
// Send MADCTL 0x88: MY=1, BGR=1 — correct portrait for this board
// Uses raw HSPI to bypass ESPHome's buffered display layer
SPIClass spi2(HSPI);
spi2.begin(14, 12, 13, -1); // SCK, MISO, MOSI, SS
spi2.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
digitalWrite(15, LOW); // CS assert
digitalWrite(2, LOW); // DC = command
spi2.transfer(0x36); // MADCTL register
digitalWrite(2, HIGH); // DC = data
spi2.transfer(0x88); // MY=1, BGR=1: correct vertical, no horizontal mirror
digitalWrite(15, HIGH); // CS deassert
spi2.endTransaction();
- component.update: my_display
esp32:
board: esp32dev
@@ -62,7 +78,7 @@ display:
cs_pin: GPIO15
dc_pin: GPIO2
reset_pin: GPIO4
rotation: 180
rotation: 0
invert_colors: false
color_order: bgr
data_rate: 10MHz