JustPaste.it

 

### Selecting the Correct `.h` Header for Your LilyGO Display Using Bodmer's TFT_eSPI Repo

Follow these steps to configure the correct setup header for your LilyGO board:

---

#### **1. Identify Your LilyGO Board Model**
   - Check your board's documentation for:
     - **Display driver** (e.g., `ST7789`, `ILI9341`)
     - **Interface** (e.g., SPI, 8-bit parallel)
     - **Resolution** (e.g., `170x320`, `240x240`)
     - **Board revision** (e.g., v1.0, v1.1)

---

#### **2. Locate Setup Files in Bodmer Repo**
   In your vendored `lib/TFT_eSPI` library:
   - Setup files are in `User_Setups/`
   - Example: `Setup206_LilyGo_T_Display_S3.h` (for T-Display S3 with ST7789 170x320 parallel)

---

#### **3. Match Your Hardware to a Setup File**
   **Cross-reference your board specs with these common setups**:
   | Board Model             | Setup File                          | Key Config                         |
   |-------------------------|-------------------------------------|------------------------------------|
   | **T-Display S3**        | `Setup206_LilyGo_T_Display_S3.h`    | ST7789, 8-bit parallel, 170x320   |
   | **T-Display-S3 AMOLED** | `Setup213_LilyGo_T_Display_S3.h`    | SSD1307, SPI, 128x128             |
   | **T-QT Pro**            | `Setup25_TTGO_T_Display.h`          | ST7789, SPI, 240x240              |
   | **T-Watch S3**          | `Setup214_LilyGo_T_Watch_S3.h`      | GC9A01, SPI, 240x240              |

   > 💡 **Tip**: Open `User_Setups/` and search for `LilyGo` or `TTGO` to find all preconfigured files.

---

#### **4. Activate the Correct Setup**
   Edit `User_Setup_Select.h` (in `lib/TFT_eSPI` root):
   ```cpp
   // Comment out all other includes, uncomment YOUR setup:
   // #include <User_Setups/Setup1_ILI9341.h>   // ⛔ Disable others
   #include <User_Setups/Setup206_LilyGo_T_Display_S3.h>  // ✅ Enable yours
   ```

---

#### **5. Verify Critical Settings**
   Open your selected setup file (e.g., `Setup206_LilyGo_T_Display_S3.h`) and confirm:
   - **Pins** match your board:
     ```cpp
     #define TFT_CS   34
     #define TFT_DC   35
     #define TFT_RST  33
     ```
   - **Interface** (SPI vs. parallel):
     ```cpp
     #define TFT_PARALLEL_8_BIT  // ✅ Parallel interface
     ```
   - **Display Parameters**:
     ```cpp
     #define TFT_WIDTH  170
     #define TFT_HEIGHT 320
     #define TFT_INVERSION_ON  // Required for some revisions
     ```

---

#### **6. Troubleshooting Mismatches**
   If your board doesn't match preconfigured setups:
   - **SPI instead of parallel?**  
     Switch to an SPI setup (e.g., `Setup135_ST7789.h`) and define SPI pins:
     ```cpp
     #define TFT_MOSI 21
     #define TFT_SCLK 18
     #define TFT_CS   15
     ```
   - **Wrong colors?**  
     Toggle RGB/BGR order in your setup file:
     ```cpp
     #define TFT_RGB_ORDER TFT_RGB  // or TFT_BGR
     ```
   - **Blank screen?**  
     Enable inversion:
     ```cpp
     #define TFT_INVERSION_ON
     ```

---

#### **7. Commit Your Configuration (Optional)**
   Use the included `bodmer.sh` script to save changes without altering upstream:
   ```bash
   ./bodmer.sh  # Creates branch "test-lilygo-s3-setup" and commits changes
   ```

---

### **Key Notes**
1. **Board Revisions Matter**:  
   LilyGO often updates pinouts – always verify against your board's schematic.
2. **SPI vs. Parallel**:  
   T-Display S3 uses **8-bit parallel** by default, but newer revisions may use SPI.
3. **PlatformIO Overrides**:  
   Add custom defines in `platformio.ini` if avoiding library edits:
   ```ini
   build_flags = 
     -D USER_SETUP_LOADED=206
     -D TFT_WIDTH=170
     -D TFT_HEIGHT=320
   ```

Check the official [LilyGO Wiki](https://github.com/Xinyuan-LilyGO) for hardware specifics.



>>>>>>>>>>>>.

# LilyGO T-Display S3 (ST7789 170x320) setup notes

Overview
- Goal: local, reproducible hello world using PlatformIO with vendored Bodmer/TFT_eSPI for LilyGO T-Display S3 (ESP32-S3, ST7789 170x320).

What was added
- platformio.ini: created env t-display-s3 targeting board lilygo-t-display-s3; lib_extra_dirs points to lib to prefer vendored libs.
- Vendored library: lib/TFT_eSPI cloned from Bodmer repository (not submodule by default).
- Display setup: enabled library setup 206 (Setup206_LilyGo_T_Display_S3.h) by switching include in User_Setup_Select.h.
- App: src/main.cpp draws centered "Hello, T-Display S3!" using TFT_eSPI.
- Scripts: upload.sh to build/upload via PlatformIO; bodmer.sh to create/checkout a feature branch in vendored TFT_eSPI and commit local setup changes.
- Docs: README.md updated with build/upload instructions; CRUSH.md added with project commands and conventions.

Pinning/config details
- Using Bodmer’s provided Setup206 which targets T-Display S3, 8-bit parallel ST7789, 170x320, RGB order and inversion configured per library file.
- User_Setup_Select.h now includes <User_Setups/Setup206_LilyGo_T_Display_S3.h> to activate that config.
- If your hardware revision uses SPI instead of 8-bit parallel, switch to the appropriate setup or define SPI pins via build flags and use ST7789 SPI config.

Build & upload
- Ensure PlatformIO is available (pyenv shim used here):
  - pyenv shell 3.11.12 && pio run -e t-display-s3 -t upload
- Or run the helper script: ./upload.sh

Verifying library changes
- lib/TFT_eSPI is a full git repo. To preserve changes without touching upstream master:
  - ./bodmer.sh (creates/uses branch test-lilygo-s3-setup, commits changed User_Setup_Select.h)
  - Push manually when ready: cd lib/TFT_eSPI && git push origin test-lilygo-s3-setup

Notes and troubleshooting
- If the screen is blank or colors are wrong, try toggling TFT_RGB/TFT_BGR or inversion in Setup206.
- If pins differ by board revision, adjust pin defines in the selected setup header.
- For serial logs, use 115200 baud. Avoid opening monitor from this session; use pio device monitor -b 115200 externally.
- If you later prefer library via lib_deps, remove vendored lib or set lib_ignore accordingly to avoid conflicts.


### working platformio.ini
[env:t-display-s3]
platform = espressif32
board = lilygo-t-display-s3
framework = arduino
monitor_speed = 115200
lib_extra_dirs = lib
lib_ignore =
  ; use vendored TFT_eSPI only