diff --git a/esphome/esp-bedside-panel.yaml b/esphome/esp-bedside-panel.yaml index 55c8c1e..28d93c1 100644 --- a/esphome/esp-bedside-panel.yaml +++ b/esphome/esp-bedside-panel.yaml @@ -6,6 +6,7 @@ # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml #:########################################################################################:# # VERSIONS: +# V0.6 2026-07-14 Added GT911 touchscreen and touch-coordinate logging # V0.5 2026-07-14 Added corrected JC1060P470 MIPI display configuration and text test # V0.4 2026-07-14 Removed MIPI display test after setup watchdog boot loop; retained backlight-only test # V0.3 2026-07-14 Added backlight control and first MIPI display text test @@ -33,28 +34,33 @@ # - Touch I2C SCL: GPIO8 # - Touch interrupt: GPIO21 # - Touch reset: GPIO22 +# - Touch I2C address: 0x5D #:########################################################################################:# # OPERATION NOTES: # - Flash this to the ESP32-P4 side of the board. # - This version is intended to confirm: -# - ESPHome remains stable during display initialisation -# - MIPI-DSI display initialises correctly -# - Backlight control remains available in Home Assistant -# - Basic text is rendered on the screen -# - Display is left in its native landscape orientation for the first test. -# - Portrait rotation will be configured after the display and touch are proven stable. +# - MIPI-DSI display remains stable +# - Display test text is rendered +# - Backlight brightness remains adjustable from Home Assistant +# - GT911 touchscreen initialises +# - Touch coordinates appear in ESPHome logs +# - Display remains in native landscape orientation for this test. +# - Touch the screen at several locations and inspect the logs. +# - Expected coordinate range is approximately: +# - X: 0 to 1023 +# - Y: 0 to 599 +# - Portrait rotation and LVGL will be added after touch is confirmed. # - This version intentionally does not yet configure: # - Ethernet -# - Touchscreen # - LVGL # - Ambient light sensor # - RTC # - Camera #:########################################################################################:# # OFFLINE NOTES: -# - The display test is generated locally and does not require Home Assistant. -# - Backlight control remains locally hosted by ESPHome. -# - WiFi and Home Assistant are not required for the test text to remain visible. +# - Display rendering and touch detection operate locally. +# - Home Assistant is not required for the display or touchscreen to work. +# - Backlight state is restored locally after restart. #:########################################################################################:# #:########################################################################################:# @@ -66,12 +72,12 @@ substitutions: # Device Naming device_name: "esp-bedside-panel" friendly_name: "ESP Bedside Panel" - description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 7 inch bedside control panel. Corrected MIPI display test. (Layout V1.1)" + description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 7 inch bedside control panel. Display and GT911 touchscreen test. (Layout V1.1)" device_area: "Bedroom" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant. # Project Naming project_name: "Guition.JC1060P470C_I_W_Y" # Project Details - project_version: "v0.5" # Project V denotes release of yaml file, allowing checking of deployed vs latest version + project_version: "v0.6" # Project V denotes release of yaml file, allowing checking of deployed vs latest version # Passwords & Secrets api_key: !secret esp-api_key # unfortunately you can't use substitutions inside secrets names @@ -84,6 +90,13 @@ substitutions: # Display Settings backlight_pin: "GPIO23" backlight_frequency: "1220Hz" + display_update_interval: "5s" + + # Touchscreen Settings + touch_sda_pin: "GPIO7" + touch_scl_pin: "GPIO8" + touch_interrupt_pin: "GPIO21" + touch_reset_pin: "GPIO22" #:########################################################################################:# # PACKAGES: @@ -233,6 +246,17 @@ time: - platform: homeassistant id: ha_time +#:########################################################################################:# +# I2C: +# https://esphome.io/components/i2c.html +#:########################################################################################:# +i2c: + - id: touch_i2c + sda: "${touch_sda_pin}" + scl: "${touch_scl_pin}" + frequency: 400kHz + scan: true + #:########################################################################################:# # OUTPUT: # https://esphome.io/components/output/ledc.html @@ -270,14 +294,14 @@ display: number: GPIO5 rotation: 0 hsync_pulse_width: 20 - update_interval: 5s + update_interval: "${display_update_interval}" auto_clear_enabled: true lambda: |- it.fill(Color(8, 12, 18)); it.printf( 512, - 225, + 185, id(font_heading), Color::WHITE, TextAlign::CENTER, @@ -286,22 +310,67 @@ display: it.printf( 512, - 305, + 270, id(font_normal), Color(0, 190, 255), TextAlign::CENTER, - "Guition JC1060P470C_I_W_Y" + "Touchscreen Test" ); it.printf( 512, - 365, + 335, id(font_small), Color(180, 180, 180), TextAlign::CENTER, - "1024 x 600 MIPI-DSI Test" + "Touch the screen and check the ESPHome logs" ); + it.printf( + 512, + 390, + id(font_small), + Color(180, 180, 180), + TextAlign::CENTER, + "Expected range: X 0-1023 / Y 0-599" + ); + +#:########################################################################################:# +# TOUCHSCREEN: +# https://esphome.io/components/touchscreen/gt911.html +#:########################################################################################:# +touchscreen: + - platform: gt911 + id: main_touchscreen + display: main_display + i2c_id: touch_i2c + address: 0x5D + interrupt_pin: + number: "${touch_interrupt_pin}" + mode: + input: true + reset_pin: + number: "${touch_reset_pin}" + mode: + output: true + on_touch: + then: + - lambda: |- + ESP_LOGI( + "touch", + "Touch detected: x=%d, y=%d, x_raw=%d, y_raw=%d", + touch.x, + touch.y, + touch.x_raw, + touch.y_raw + ); + + on_release: + then: + - logger.log: + level: INFO + format: "Touch released" + #:########################################################################################:# # FONTS: # https://esphome.io/components/font.html