Skip to content

Add Waveshare ESP32-P4-WIFI6-Touch-LCD-5 board support - #477

Open
fermintm wants to merge 2 commits into
bmorcelli:mainfrom
fermintm:main
Open

fermintm wants to merge 2 commits into
bmorcelli:mainfrom
fermintm:main

Conversation

@fermintm

@fermintm fermintm commented Nov 11, 2026 •

Copy link
Copy Markdown

Adds a board port for the Waveshare ESP32-P4-WIFI6-Touch-LCD-5: ESP32-P4 main SoC + ESP32-C6 co-processor bridged over SDIO, 720x1280 HX8394 MIPI-DSI panel (2 lanes), GT911 I2C capacitive touch, microSD on SDMMC0 (4-bit), 32 MB NOR flash.

Bench-tested on a P4 rev v1.3 unit:

  • display (HX8394 DSI) and GT911 touch
  • microSD (SDMMC 4-bit, slot 0)
  • ESP32-C6 WiFi bridge over SDIO (scan and connect both OK)
  • installing an app from SD into the OTA slot, with the Launcher staying in factory
  • settings and WiFi credentials persist across reboot

Not implemented: ES8311/ES7210 audio, no user buttons, no battery reading.

Files

  • boards/waveshare-esp32-p4-wifi6-touch-lcd-5/ — platformio.ini, interface.cpp, connections.md (pinout, SDIO/ESP-Hosted notes, flashing notes).
  • support_files/custom_32Mb_p4.csv — 32 MB P4 layout: app0 subtype factory at 0x10000 (size 0x210000), coredump at 0x220000. It is custom_32Mb.csv with app0 as factory, the same pair the repo already has for 16 MB (custom_16Mb.csv / custom_16Mb_p4.csv, which the other P4 boards use). The Launcher stays in factory and apps are created in the free space from OTA_0 (app_registry.cpp), so a bad app can never overwrite the Launcher.
  • CI matrix entry plus a commented default_envs line, following the other Waveshare envs.

Second commit: board touch fix

Board touch: edge-trigger with a release debounce

The GT911 occasionally drops a sample mid-press, and the previous code read that dropout as a fresh tap, so menus and the keyboard fired far too fast. Touch is now edge-triggered with a 60 ms release debounce; a held finger repeats after 800 ms, then every 400 ms. The long-press detector still sees the contact re-asserted while LongPress is set.

The WiFi credential changes that were in this PR have been moved out to #481.

LauncherHub catalog

OTA_TAG="waveshare-esp32-p4-wifi6-touch-lcd-5". The catalog has no entry for it yet:

GET https://api.launcherhub.net/firmwares?category=waveshare-esp32-p4-wifi6-touch-lcd-5
404 {"error":"Category not found.","category":"waveshare-esp32-p4-wifi6-touch-lcd-5"}

while elecrow-esp32p4-7in and t-display-p4 return entries, so OTA currently shows an empty list on this board. The UI has no "install from URL" path (only catalog favorites), so SD install is the only route until the category exists. Could you add the category (and the Launcher build for it) once this is merged? Downloads send the WiFi MAC in the HWID header, same as the other boards.

@bmorcelli

Copy link
Copy Markdown
Owner

do not touch the cypher and passwords in this PR..

if you want to change it, make a separate PR explaining why you are changing it

@fermintm

Copy link
Copy Markdown
Author

Done — split as requested.

This PR is now board-only: the port plus the touch fix, no changes to src/.

The WiFi credential changes are in #481: "Fix WiFi password corruption when a stored value cannot be decrypted". It does not change the cipher, the key, the IV or the stored format; it fixes a bug where wifiPwdDecrypt() returned the ciphertext when it could not decrypt it, and the caller then re-encrypted that ciphertext, so a stored password became unreadable after a few boots. That happens when config.conf/NVS was written by a build with a different WIFI_ENC_KEY (an SD card moved between devices, or the key changed between releases). Full reasoning is in the #481 description.

Current state of this branch:

  • e858e9d Add Waveshare ESP32-P4-WIFI6-Touch-LCD-5 board support
  • f526b44 Board touch: edge-trigger with a release debounce

git diff against main is boards/waveshare-esp32-p4-wifi6-touch-lcd-5/, support_files/custom_32Mb_p4.csv, the CI matrix entry and the commented default_envs line — nothing in src/.

I can close #481 if you prefer to handle the WiFi topic differently.

720x1280 HX8394 MIPI-DSI panel (2 lanes) with Waveshare's own init sequence, GT911 capacitive touch, 4-bit SD_MMC microSD, ESP32-C6 WiFi over SDIO2 (ESP-Hosted) and the CH343 UART console.

Adds a 32 MB factory-partition layout for the P4 (custom_32Mb_p4.csv), since the shared P4 JSON defaults to 16 MB. GT911 RST is driven through reset_cb so the driver's per-read reset() no longer re-latches a held finger (on-screen keyboard used to type every key twice); InputHandler applies touches on the press edge with a 500 ms hold-repeat.

Verified on hardware: display, touch, microSD and WiFi scan. Env registered in default_envs and the CI matrix.
The GT911 occasionally drops a sample mid-press and the input task clears
touchPoint every pass, so the old code re-applied the contact as if it were a
fresh tap; menus and the keyboard fired far faster than intended.

Accept a new press only after the panel has reported "up" for 60 ms, then
repeat a held contact after 800 ms and every 400 ms after that. The
long-press detector still sees the contact re-asserted while LongPress is
set.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants