firecrest/firmware/components/display.yaml

173 lines
5.8 KiB
YAML

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:
- lcd_display
touchscreens:
- touch_gt911
pages:
- id: page_home
widgets:
- obj:
width: 100%
height: 510px
pad_all: 16
border_width: 0
outline_width: 0
scrollable: false
layout:
type: flex
flex_flow: column
flex_align_cross: center
flex_align_track: center
flex_align_main: space_evenly
widgets:
- label:
id: home_temp_label
text: "-- °C"
text_font: montserrat_48
- label:
id: home_mode_label
text: "Mode: --"
text_font: montserrat_28
- obj:
width: 100%
height: size_content
border_width: 0
outline_width: 0
scrollable: false
layout:
type: flex
flex_flow: row
flex_align_cross: center
flex_align_track: center
flex_align_main: space_evenly
widgets:
- button:
width: 140px
height: 100px
on_click:
climate.control:
id: main_thermostat
target_temperature_low: !lambda "return id(main_thermostat).target_temperature_low - 0.5f;"
target_temperature_high: !lambda "return id(main_thermostat).target_temperature_high - 0.5f;"
widgets:
- label:
text: "-"
text_font: montserrat_40
- button:
width: 140px
height: 100px
on_click:
climate.control:
id: main_thermostat
target_temperature_low: !lambda "return id(main_thermostat).target_temperature_low + 0.5f;"
target_temperature_high: !lambda "return id(main_thermostat).target_temperature_high + 0.5f;"
widgets:
- label:
text: "+"
text_font: montserrat_40
- id: page_sensors
widgets: []
- id: page_settings
widgets: []
- id: page_schedule
widgets: []
top_layer:
widgets:
- obj:
id: nav_bar
align: bottom_mid
width: 100%
height: 90px
pad_all: 4
radius: 0
border_width: 0
outline_width: 0
scrollable: false
layout:
type: flex
flex_flow: row
flex_align_cross: center
flex_align_track: center
flex_align_main: space_evenly
widgets:
- button:
id: nav_btn_home
width: 220px
height: 78px
on_click:
lvgl.page.show: page_home
widgets:
- label:
text: "Home"
text_font: montserrat_20
- button:
id: nav_btn_sensors
width: 220px
height: 78px
on_click:
lvgl.page.show: page_sensors
widgets:
- label:
text: "Sensors"
text_font: montserrat_20
- button:
id: nav_btn_settings
width: 220px
height: 78px
on_click:
lvgl.page.show: page_settings
widgets:
- label:
text: "Settings"
text_font: montserrat_20
- button:
id: nav_btn_schedule
width: 220px
height: 78px
on_click:
lvgl.page.show: page_schedule
widgets:
- label:
text: "Schedule"
text_font: montserrat_20