From 2097779949e50627892e3477d7ee6e7166d120e6 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sun, 12 Jul 2026 00:26:29 -0700 Subject: [PATCH] refactor: extract shared panel.yaml (RGB panel, touch, IO expander) from display.yaml --- firmware/components/display.yaml | 40 ------------------------------ firmware/components/panel.yaml | 39 +++++++++++++++++++++++++++++ firmware/waveshare-thermostat.yaml | 1 + 3 files changed, 40 insertions(+), 40 deletions(-) create mode 100644 firmware/components/panel.yaml diff --git a/firmware/components/display.yaml b/firmware/components/display.yaml index 57d4e0f..fbeadcb 100644 --- a/firmware/components/display.yaml +++ b/firmware/components/display.yaml @@ -1,43 +1,3 @@ -i2c: - - id: i2c_bus - sda: GPIO8 - scl: GPIO9 - scan: true - -ch422g: - - id: io_expander - i2c_id: i2c_bus - -touchscreen: - - platform: gt911 - id: touch_gt911 - i2c_id: i2c_bus - address: 0x5D # confirmed via Waveshare's documented I2C address map - interrupt_pin: GPIO4 - reset_pin: - ch422g: io_expander - number: 1 # EXIO1 = TP_RST, per Waveshare pinout - display: lcd_display - -display: - - platform: mipi_rgb - id: lcd_display - model: WAVESHARE-5-1024X600 # ESPHome's closest built-in preset: same ST7701 chip, data pins, - # and CH422G reset/enable wiring as this board's 1024x600 panel - dimensions: - width: 1024 - height: 600 - pad_width: 0 # the preset's default width/height (1024x600) don't match its inherited - pad_height: 0 # native_width/native_height (800x480 from the base 4.3" model), which makes - # ESPHome's offset math go negative unless pad is forced explicitly here - enable_pin: - - ch422g: io_expander - number: 2 # EXIO2 = DISP (backlight enable) — inherited from the base preset - - ch422g: io_expander - number: 6 # EXIO6 = LCD_VDD_EN (VCOM enable) — the built-in preset doesn't set - # this, but the Waveshare wiki confirms VCOM must be driven high on - # this board or the panel won't display correctly. Added explicitly. - lvgl: id: lvgl_comp displays: diff --git a/firmware/components/panel.yaml b/firmware/components/panel.yaml new file mode 100644 index 0000000..bba6057 --- /dev/null +++ b/firmware/components/panel.yaml @@ -0,0 +1,39 @@ +i2c: + - id: i2c_bus + sda: GPIO8 + scl: GPIO9 + scan: true + +ch422g: + - id: io_expander + i2c_id: i2c_bus + +touchscreen: + - platform: gt911 + id: touch_gt911 + i2c_id: i2c_bus + address: 0x5D # confirmed via Waveshare's documented I2C address map + interrupt_pin: GPIO4 + reset_pin: + ch422g: io_expander + number: 1 # EXIO1 = TP_RST, per Waveshare pinout + display: lcd_display + +display: + - platform: mipi_rgb + id: lcd_display + model: WAVESHARE-5-1024X600 # ESPHome's closest built-in preset: same ST7701 chip, data pins, + # and CH422G reset/enable wiring as this board's 1024x600 panel + dimensions: + width: 1024 + height: 600 + pad_width: 0 # the preset's default width/height (1024x600) don't match its inherited + pad_height: 0 # native_width/native_height (800x480 from the base 4.3" model), which makes + # ESPHome's offset math go negative unless pad is forced explicitly here + enable_pin: + - ch422g: io_expander + number: 2 # EXIO2 = DISP (backlight enable) — inherited from the base preset + - ch422g: io_expander + number: 6 # EXIO6 = LCD_VDD_EN (VCOM enable) — the built-in preset doesn't set + # this, but the Waveshare wiki confirms VCOM must be driven high on + # this board or the panel won't display correctly. Added explicitly. diff --git a/firmware/waveshare-thermostat.yaml b/firmware/waveshare-thermostat.yaml index 37301d8..05ed5a1 100644 --- a/firmware/waveshare-thermostat.yaml +++ b/firmware/waveshare-thermostat.yaml @@ -44,6 +44,7 @@ logger: # a different physical port, which is why logs went silent packages: + panel: !include components/panel.yaml display: !include components/display.yaml sensors: !include components/sensors.yaml relays: !include components/relays.yaml