Keep the Elecrow's touch bus free of the USB PHY after Wi-Fi starts (0.2.94, firmware 0.2.80)
CI / checks (push) Waiting to run
CI / firmware (add-on) (push) Blocked by required conditions
CI / firmware (min_version) (push) Blocked by required conditions

The GT911 of the CrowPanel 7.0" sits on GPIO 19 and 20, the ESP32-S3's USB pins. Firmware 0.2.79 freed them once, in a
static constructor; the Wi-Fi PHY library then kept the USB PHY on (CONFIG_ESP_PHY_ENABLE_USB, on by default on an
ESP32-S3) and the touch went quiet once Wi-Fi came up. The board file turns that option off, frees the pins again in
BOOT_TOUCH after Wi-Fi started, and a one-second watchdog frees them whenever anything takes them, with a log line.
This commit is contained in:
Xandrossian
2026-09-21 12:05:28 -07:00
parent 9857cc3bda
commit a3ef7f09a1
7 changed files with 52 additions and 11 deletions
+17
View File
@@ -197,6 +197,9 @@ substitutions:
# must name every hook, or ESPHome stops at the undefined one.
# the first boot step: the touch guard, and what this board's panel needs
BOOT_TOUCH: |-
// The USB pins carry the touch I2C (elecrow_usb_phy.h): the Wi-Fi PHY started before this and may have taken them.
if (elecrow::usb_pads_taken()) ESP_LOGW("touch", "USB PHY held GPIO19/20 at boot; released");
elecrow::release_usb_pads();
cyd::touch_guard.configure(${TOUCH_MOVE_LIMIT_PX}, ${TOUCH_MIN_PRESS_MS});
cyd::edge_swipe.configure(${DISPLAY_W}, ${DISPLAY_H}, ${EDGE_SWIPE_BAND_PX}, ${EDGE_SWIPE_TRAVEL_PX});
cyd::edge_snap_band = ${SLIDER_EDGE_SNAP_PX};
@@ -360,6 +363,9 @@ esp32:
sdkconfig_options:
# The camera images' HTTP client links mbedTLS; nothing on the screen serves TLS (7 KB of flash).
CONFIG_MBEDTLS_TLS_CLIENT_ONLY: y
# The Wi-Fi PHY library keeps the USB PHY on by default on an ESP32-S3, which takes GPIO19/20, the touch I2C,
# back the moment Wi-Fi starts (elecrow_usb_phy.h). Off: it leaves the USB PHY disabled, as this board needs.
CONFIG_ESP_PHY_ENABLE_USB: n
psram:
mode: octal
@@ -460,6 +466,17 @@ online_image:
- lambda: 'runtime_tiles::live_failed();'
# The touch bus's watchdog (elecrow_usb_phy.h): whatever hands GPIO19/20 back to the USB PHY, the pads are released
# again within a second, with one log line per event.
interval:
- interval: 1s
then:
- lambda: |-
if (elecrow::usb_pads_taken()) {
elecrow::release_usb_pads();
ESP_LOGW("touch", "USB PHY took GPIO19/20 back; released again");
}
text_sensor:
# The sensor every large board has; ESP Screens 0.2.93+ reads the board from its value ("elecrow": a big panel that
# draws images and does not turn), so it publishes like the core's diagnostics. An older app only looks for the sensor