Lolin TFT 2.4 - Fail operate

Hi,
When compiling Lolin’s example for [TFT 2.4], I witness a problem. When same code is compiled and uploaded via Arduino IDE, screen works as expected. But when trying to use SAME code, and same libraries, I get a blank screen. Even the Touch basic example does not yeild XY coordinates of touch location.

Examples

my Code:

/***************************************************

1. !!!Make sure you using lastest ESP8266 core for Arduino, otherwise it may not work properly.
  https://github.com/esp8266/Arduino
  
  (The pin D0(GPIO16) will be not work when you use older version ESP8266 core for Arduino, 
  because the older version ESP8266 core for Arduino's digitalPinToBitMask(), portOutputRegister(), 
  portInputRegister() and portModeRegister() fuction have some bugs which Adafruit_ILI9341 Library will use.
  This bug was fixed after commit:  https://github.com/esp8266/Arduino/commit/799193888a553de8876052019842538396f92194 )
    

2. Setup latest Adafruit_GFX, Adafruit_ILI9341 and XPT2046_Touchscreen Library first:

    https://github.com/adafruit/Adafruit-GFX-Library

    https://github.com/adafruit/Adafruit_ILI9341

    https://github.com/PaulStoffregen/XPT2046_Touchscreen

****************************************************/
#include <Arduino.h>
#include <SPI.h>
#include <XPT2046_Touchscreen.h>

#define TS_CS D3 //for D1 mini or TFT I2C Connector Shield (V1.1.0 or later)
// #define TS_CS  12 //for D32 Pro

XPT2046_Touchscreen ts(TS_CS);

void setup()
{
  Serial.begin(115200);
  ts.begin();
  ts.setRotation(1);
  while (!Serial && (millis() <= 1000))
    ;
}

void loop()
{
  if (ts.touched())
  {
    TS_Point p = ts.getPoint();
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
    delay(30);
    Serial.println();
  }
}

.ini file:

; PlatformIO Project Configuration File

;

; Build options: build flags, source filter

; Upload options: custom upload port, speed and extra flags

; Library options: dependencies, extra library storages

; Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:d1]

platform = espressif8266

board = d1

framework = arduino

lib_deps = paulstoffregen/XPT2046_Touchscreen@0.0.0-alpha+sha.26b691b2c8

monitor_speed = 115200

(https://www.wemos.cc/en/latest/d1_mini_shield/tft_2_4.html)

That version was uploaded 4 years ago (PlatformIO Registry) but the repo (https://github.com/PaulStoffregen/XPT2046_Touchscreen) is a bit further ahead. Can you use

lib_deps =
   https://github.com/PaulStoffregen/XPT2046_Touchscreen/archive/refs/heads/master.zip

instead?

replace as suggested. See Compilation output:

Processing d1 (platform: espressif8266; board: d1; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1.html
PLATFORM: Espressif 8266 (4.2.1) > WEMOS D1 R1
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 @ 3.30102.0 (3.1.2)
 - tool-esptool @ 1.413.0 (4.13)
 - tool-esptoolpy @ 1.30000.201119 (3.0.0)
 - toolchain-xtensa @ 2.100300.220621 (10.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- XPT2046_Touchscreen @ 0.0.0+20231021163743
|-- SPI @ 1.0
Building in release mode
Retrieving maximum program size .pio\build\d1\firmware.elf
Checking size .pio\build\d1\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  34.8% (used 28516 bytes from 81920 bytes)
Flash: [===       ]  25.8% (used 269235 bytes from 1044464 bytes)

Serial monitor (showing only one instance. output never changes, even after pressing on screen):
Pressure = 4095, x = 8191, y = 8191

Can you post the following:

  • What’s the used version auf the ESP8266 core in the Arduino IDE? (Tools → Boards → Board Manager → ESP8266)
  • What are the exact Arduino IDE → Tools settings used?

Arduino IDE : ESP8266 3.1.2

Settings:

You have selected “WEMOS D1 R1” in PlatformIO, but in the Arduino IDE you select “WEMOS D1 R2 & mini”?

Well let’s straighten up your platformio.ini file first, use

board = d1_mini

there.

WOW!! What is the diff between D1 and D1 mini in that sense ?
Thank you very much

board = d1 uses the d1 variant in Arduino-ESP8266 while board = d1_mini uses d1_mini (see above linked board definitions.

Each of these have their own pin definitions

So what specifically makes your sketch fail is because you’re using Dx references in your sketch instead of direct GPIO numbers:

And for board = d1 we have D3 = 5 (GPIO5) but for d1_mini we have D3 = 0 (GPIO0).

If the code said #define TS_CS 0 instead it would have still worked when a different board was used - - but of course would have been harder to translate to the “D” name on the actual physical board.

The least I expected that ESP8266 family MCUs will maintain a uniformity.
I’ve sepnt so many hours trying to solve it.
THNX!
:+1: