Skip to content

Add GT911 capacitive touch support for ESP32-3248S035C - #1383

Draft
Ejuc wants to merge 1 commit into
justcallmekoko:masterfrom
Ejuc:local-v1.13.0-cyd35c-gt911
Draft

Add GT911 capacitive touch support for ESP32-3248S035C#1383
Ejuc wants to merge 1 commit into
justcallmekoko:masterfrom
Ejuc:local-v1.13.0-cyd35c-gt911

Conversation

@Ejuc

@Ejuc Ejuc commented Jul 15, 2026

Copy link
Copy Markdown

Summary

This draft PR adds GT911 capacitive-touch support for the ESP32-3248S035C 3.5-inch CYD board.

Tested hardware:

  • ESP32-D0WD-V3
  • 4 MB flash
  • ST7796 display, 320 × 480
  • GT911 capacitive-touch controller
  • GT911 SDA: GPIO33
  • GT911 SCL: GPIO32
  • GT911 INT: GPIO21
  • GT911 detected at either 0x5D or 0x14

Implemented changes

  • Adds a HAS_GT911_TOUCH configuration.
  • Defines the GT911 I2C pins for ESP32-3248S035C.
  • Initializes GT911 over I2C.
  • Tries both common controller addresses, 0x5D and 0x14.
  • Adds rotation-aware touch-coordinate conversion.
  • Skips TFT_eSPI resistive-touch calibration for the GT911 build.
  • Adds a 100 ms touch-release debounce.

Why the debounce is needed

TouchDrvGT911::getPoint() clears the controller's current data-ready frame after reading it.

A rapid following poll may therefore temporarily report no touch even while the finger is still physically touching the screen. Marauder can interpret that temporary empty frame as a release, causing one physical tap to activate two menu actions.

The patch keeps the previous valid touch position active for 100 ms after the last GT911 frame. This fixed the duplicate-menu-action problem on the tested board.

Test results

The following were tested successfully on physical hardware:

  • firmware compilation;
  • full bootloader, partition table, boot_app0 and application flash;
  • application-only update at 0x10000;
  • ST7796 display initialization;
  • GT911 initialization;
  • touch-coordinate alignment;
  • main-menu navigation;
  • submenu navigation;
  • one physical tap producing one menu action.

Tested build environment:

  • ESP32 Marauder base: v1.13.0
  • ESP32 Arduino core: 2.0.11
  • Board FQBN: esp32:esp32:d32:PartitionScheme=min_spiffs
  • TFT_eSPI: 2.5.34
  • SensorLib: 0.2.2

Compatibility considerations

The existing MARAUDER_CYD_3_5_INCH target does not currently have a GT911-specific flag and appears to represent the resistive-touch variant.

Its TFT_eSPI setup defines GPIO33 as resistive TOUCH_CS, while the capacitive ESP32-3248S035C uses GPIO33 as GT911 SDA.

This draft adds GT911 support directly to MARAUDER_CYD_3_5_INCH.

For upstream integration, the maintainers may prefer to:

  1. keep GT911 under the existing MARAUDER_CYD_3_5_INCH target;
  2. create a separate target such as MARAUDER_CYD_3_5_INCH_CAP;
  3. select the touch controller through a separate build flag.

A separate capacitive target would preserve the existing resistive 3.5-inch build unchanged.

Build-system dependency

This implementation uses:

#include <TouchDrvGT911.hpp>

from SensorLib.

The GitHub Actions workflow will therefore need to install a compatible SensorLib revision for the capacitive target. The current upstream build workflow does not appear to install SensorLib.

Scope of this contribution

This branch is provided as a working, hardware-tested implementation for the ESP32-3248S035C capacitive-touch variant.

It was developed and tested against ESP32 Marauder v1.13.0. I am sharing the code so the maintainers can review, adapt, split into a separate target, or cherry-pick the relevant changes as they prefer.

The branch is based on v1.13.0 rather than the latest master, and the upstream build workflow does not currently install SensorLib.

This PR is opened as a draft because it is primarily a tested code contribution and reference implementation, rather than a merge-ready upstream integration.

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.

1 participant