feat(boards): add LilyGO TTGO T4 v1.3 support - #2704
Open
hadifarnoud wants to merge 2 commits into
Open
Conversation
Adds a board target for the LilyGO TTGO T4 v1.3 (ESP32-WROVER, 2.4" ILI9341 320x240 SPI display, microSD, three front buttons). - boards/lilygo-t4/: pins_arduino.h, interface.cpp (3-button nav: Left=Prev, Center=Sel/Esc, Right=Next), PlatformIO env and pinout doc - boards/_boards_json/lilygo-t4.json: ESP32 board definition (-DLILYGO_T4) - boards/pinouts/pins_arduino.h: dispatcher branch for LILYGO_T4 - register lilygo-t4 in platformio.ini and the build workflows/scripts Pins verified against the official LilyGO T4 demo and the TFT_eSPI Setup22_TTGO_T4_v1.3 profile. Display on VSPI (MOSI23/MISO12/SCLK18/ CS27/DC32/RST5/BL4), SD on HSPI (CS13/SCK14/MISO2/MOSI15), buttons on input-only GPIOs 38/37/39 (active LOW via the board's external pull-ups). Builds clean: `pio run -e lilygo-t4` (Flash 85.3%, RAM 30.5%). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Hardware bring-up on a real T4 v1.3 revealed two issues: - The panel was rendering inverted (white background, green accents) because Bruce defaults `colorInverted = 1` and applies it at runtime in begin_tft(), overriding any compile-time TFT setup. Add an overridable `DEFAULT_COLOR_INVERTED` hook in config.h (default 1, unchanged for all existing boards) and set it to 0 for this board — its ILI9341 renders correctly non-inverted. - ROTATION 0 (portrait) drew the UI into the left ~60% of the panel with labels beside icons. The T4 is used in landscape with its three buttons on the right edge; ROTATION 1 fills the screen correctly. Verified on device: menu fills the screen, colors match the Bruce theme, and the three buttons navigate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
Confirmed working on a physical LilyGO TTGO T4 v1.3: flashed over USB, boots into the Bruce menu full-screen in landscape with correct theme colors, and all three front buttons navigate. The color-inversion default and the rotation fix were both verified on the device. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a board target for the LilyGO TTGO T4 v1.3 — ESP32-WROVER with a 2.4″ ILI9341 320×240 SPI display, microSD slot and three front buttons. There was no existing T4 target (the closest,
lilygo-t-display-ttgo, is a different ST7789 135×240 device).✅ Tested on real hardware
This board target was flashed to and verified on a physical LilyGO TTGO T4 v1.3:
esptool --chip esp32 write_flash -z 0x0 Bruce-lilygo-t4.binafter a fullerase_flash.The two follow-up commits (color inversion + rotation) are the corrections found during this on-device bring-up.
What's included
boards/lilygo-t4/pins_arduino.h— full pin map, ILI9341, landscapeROTATION 1boards/lilygo-t4/interface.cpp— 3-button navigation (top = previous, middle = select / escape on double-click or hold, bottom = next), backlight PWM, deep-sleep power-off with wake on the middle buttonboards/lilygo-t4/lilygo-t4.ini— PlatformIO env (4 MB,custom_4Mb_full.csv)boards/lilygo-t4/connections.md— pinout documentationboards/_boards_json/lilygo-t4.json— ESP32 board definition (-DLILYGO_T4)boards/pinouts/pins_arduino.h— dispatcher branch forLILYGO_T4lilygo-t4inplatformio.ini,PR_All_envs.yml,buil_parallel.yml,manual_build_sel_env.ymlanddocker/run_all_envs.shOne small core change
src/core/config.hgains an overridable default:begin_tft()appliestft.invertDisplay(bruceConfig.colorInverted)at runtime, so a compile-time TFT setup alone can't fix a panel that shouldn't be inverted. The default stays1for every existing board; this T4 panel sets-DDEFAULT_COLOR_INVERTED=0in its.ini. Without it the T4 renders with a white background and green accents.Pin map
ROTATION 1The three buttons sit on ESP32 input-only GPIOs (37/38/39), which cannot use internal pull-ups — they rely on the board's external pull-ups and are read as active LOW.
Pins were cross-checked against the official LilyGO TTGO-T4-DEMO and the TFT_eSPI
Setup22_TTGO_T4_v1.3profile.Build
pio run -e lilygo-t4builds clean — Flash 85.3%, RAM 30.5%, producesBruce-lilygo-t4.bin.