From 90561b3b35cbcbae7eb785e68d1c2b22b3052dbd Mon Sep 17 00:00:00 2001
From: Roman Mashta <roman.mashta@gmail.com>
Date: Sat, 9 Sep 2023 14:44:26 +0300
Subject: [PATCH] Lilygo S3 T-Dongle fix after TFT driver upgrade. Board
 definition for Lilygo S3 AMOLED added.

---
 boards/lilygo-t-amoled.json      | 46 ++++++++++++++++++++++++++++++++
 lib/TFT_eSPI/User_Setup_Select.h |  2 +-
 platformio.ini                   |  2 +-
 3 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 boards/lilygo-t-amoled.json

diff --git a/boards/lilygo-t-amoled.json b/boards/lilygo-t-amoled.json
new file mode 100644
index 0000000..17031d0
--- /dev/null
+++ b/boards/lilygo-t-amoled.json
@@ -0,0 +1,46 @@
+{
+    "build": {
+      "arduino":{
+        "ldscript": "esp32s3_out.ld",
+        "memory_type": "qio_opi",
+        "partitions": "default_16MB.csv"
+      },
+      "core": "esp32",
+      "extra_flags": [
+        "-DBOARD_HAS_PSRAM",
+        "-DARDUINO_USB_MODE=1"
+      ],
+      "f_cpu": "240000000L",
+      "f_flash": "80000000L",
+      "flash_mode": "qio",
+      "hwids": [
+        [
+          "0X303A",
+          "0x1001"
+        ]
+      ],
+      "mcu": "esp32s3",
+      "variant": "esp32s3"
+    },
+    "connectivity": [
+      "wifi",
+      "bluetooth"
+    ],
+    "debug": {
+      "openocd_target": "esp32s3.cfg"
+    },
+    "frameworks": [
+      "arduino",
+      "espidf"
+    ],
+    "name": "LILYGO T-DISPLAY-AMOLED",
+    "upload": {
+      "flash_size": "16MB",
+      "maximum_ram_size": 327680,
+      "maximum_size": 16777216,
+      "require_upload_port": true,
+      "speed": 921600
+    },
+    "url": "https://www.lilygo.cc/products/t-display-s3-amoled",
+    "vendor": "LILYGO"
+  }
\ No newline at end of file
diff --git a/lib/TFT_eSPI/User_Setup_Select.h b/lib/TFT_eSPI/User_Setup_Select.h
index bcea618..f975519 100644
--- a/lib/TFT_eSPI/User_Setup_Select.h
+++ b/lib/TFT_eSPI/User_Setup_Select.h
@@ -145,7 +145,7 @@
 #include <User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h>         // For the LilyGo T-QT Pro S3 based ESP32S3 with GC9A01 128 x 128 TFT
 #endif
 #ifdef NERMINER_S3_DONGLE
-#include <User_Setups/Setup300_TTGO_T_Dongle.h>
+#include <User_Setups/Setup209_LilyGo_T_Dongle_S3.h>      // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
 #endif
 //#include <User_Setups/Setup301_BW16_ST7735.h>            // Setup file for Bw16-based boards with ST7735 160 x 80 TFT
 
diff --git a/platformio.ini b/platformio.ini
index 6ab9e0e..b28bbb5 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -101,7 +101,7 @@ lib_deps =
 
 [env:NerminerV2-S3-AMOLED]
 platform = espressif32
-board = lilygo-t-display-s3
+board = lilygo-t-amoled
 framework = arduino
 
 board_build.partitions = huge_app.csv