Skip to content

Add LCDwiki E32R40T (4.0" ST7796S 320x480) board support (#175) - #178

Draft
Keralots wants to merge 2 commits into
mainfrom
feat/e32r40t
Draft

Add LCDwiki E32R40T (4.0" ST7796S 320x480) board support (#175)#178
Keralots wants to merge 2 commits into
mainfrom
feat/e32r40t

Conversation

@Keralots

Copy link
Copy Markdown
Owner

Draft / do not merge yet — the board is not hardware-verified. Waiting on the #175 reporter to confirm on real hardware (display colors, orientation, shared-bus touch, RGB LED, idle speaker noise). Will mark ready once the tester signs off.

Closes #175 once verified.

What

Adds a community env e32r40t for the LCDwiki "4.0inch ESP32-32E Display" (SKU E32R40T): classic ESP32-WROOM-32E, ST7796S 320x480 over 4-wire SPI, XPT2046 resistive touch that shares the LCD SPI bus, onboard common-anode RGB LED. 4 MB flash / no PSRAM → 1 printer (BOARD_LOW_RAM), DISPLAY_320x480 layout.

Same lcdwiki ESP32-32E family as the 2.8" CYD clone, but a bigger panel.

Notable bits

  • Shared-bus touch. The XPT2046 sits on the same Bus_SPI as the LCD (bus_shared=true); the bus muxes the real MISO(12) so the touch can read, the panel stays write-only. This is the first env to drive touch through LovyanGFX's getTouch() fallback.
  • displayDevice() accessor. getTouch() / setTouchCalibrate() live on lgfx::LGFX_Device, but tft_ptr is intentionally typed as the drawing base LovyanGFX (so JC3248 can retarget it to a sprite). Added displayDevice() to reach the concrete device for touch — this is why the getTouch path had never compiled before.
  • TOUCH_WAKE_LONGPRESS capability. The resistive wake-suppression in handleWakeButton() now keys off a capability that covers both the HSPI USE_XPT2046 backend and this shared-bus path, instead of the driver macro.
  • Flash fit. First 4 MB board on DISPLAY_320x480 (links the ~107 KB inter_22 font). The image overran the min_spiffs slot by 672 B, so HAS_ERROR_TEXT_TABLE is dropped here (~36 KB) — error sentences come from the portal mirror, same trade as the C3s. firmware.bin now 1,931,024 / 1,966,080 B.
  • Board defaults + pin deny-lists in config.h / led.cpp / button.cpp / buzzer.cpp; merge_bins.py --board e32r40t builds the images. Not added to the web flasher / release set yet.

Validation

  • pio run -e e32r40t clean; firmware.bin fits the slot (35 KB free).
  • Full env sweep 20/21 green (the one failure is the pre-existing SenseCAP custom-toolchain setup, unrelated).
  • Shared-file edits regression-checked on hardware by OTA-flashing each daily driver with its own build: CYD (resistive, TOUCH_WAKE_LONGPRESS=1) and ws_lcd_200 (capacitive, =0) both boot healthy.
  • Pending: the E32R40T panel + touch on real hardware (no owner board).

New community env `e32r40t` for the LCDwiki 4.0" ESP32-32E display (issue #175):
classic ESP32-WROOM-32E, ST7796S 320x480 over 4-wire SPI, XPT2046 resistive
touch that shares the LCD SPI bus, onboard common-anode RGB LED (22/16/17).
4 MB flash / no PSRAM -> 1 printer (BOARD_LOW_RAM), DISPLAY_320x480 layout.

- LGFX_E32R40T: Panel_ST7796 on VSPI + shared-bus Touch_XPT2046 (bus_shared,
  real MISO(12) on the bus so the touch can read; panel stays write-only).
- Touch runs through the LovyanGFX getTouch() fallback (first env to use it),
  with a boot release-gate ported from the HSPI backend as a phantom guard.
- New TOUCH_WAKE_LONGPRESS capability so the resistive wake-suppression covers
  both the HSPI and the shared-bus touch paths; main.cpp tests the capability.
- displayDevice() exposes the concrete LGFX_Device for touch, since tft_ptr
  stays typed as the drawing base (LovyanGFX) for the JC3248 sprite retarget.
- Board defaults + pin deny-lists in config.h / led.cpp / button.cpp / buzzer.cpp.
- Drop HAS_ERROR_TEXT_TABLE (~36 KB) so the image fits the min_spiffs slot;
  sentences still come from the portal mirror, same trade as the C3s.

Hardware unverified (no owner board); the #175 reporter will test builds.
Lets `python merge_bins.py --board e32r40t` (alias `e32`) produce the Full +
OTA images for the LCDwiki E32R40T. Classic ESP32, so bootloader at 0x1000.
Not added to release.py WEB_FLASHER_BOARDS - the board is still hardware-
unverified and out of the published flasher set.
@Keralots Keralots linked an issue Aug 31, 2026 that may be closed by this pull request
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.

Board support 4.0" ESP32-32E Display, ST7796S 320x480

1 participant