witnessmenow / ESP32-Cheap-Yellow-Display

Building a community around a cheap ESP32 Display with a touch screen
MIT License
1.25k stars 127 forks source link

Visual Studio Platform IO Error with Touch library (solved) #57

Closed scudrunner closed 7 months ago

scudrunner commented 7 months ago

I am using Visual Studio for the CYD, and I have the screen working with the following build flags: build_flags = -D USER_SETUP_LOADED -D ILI9341_2_DRIVER -D TFT_MISO=12 -D TFT_MOSI=13 -D TFT_SCLK=14 -D TFT_CS=15 -D TFT_DC=2 -D TFT_RST=-1 -D LOAD_GLCD=1 -D LOAD_FONT2 -D LOAD_FONT4 -D LOAD_FONT6 -D LOAD_FONT7 -D LOAD_FONT8 -D LOAD_GFXFF -D SMOOTH_FONT -D SPI_FREQUENCY=55000000 -D SPI_READ_FREQUENCY=20000000 -D SPI_TOUCH_FREQUENCY=2500000 -D TFT_WIDTH=240 -D TFT_HEIGHT=320 -D TFT_BL=21
-D TFT_BACKLIGHT_ON=HIGH

I did not see the touch_cs defined in the setup, and I am getting build errors trying to run the touch example in here. I am not sure if the code is wrong, or if I am doing something wrong. Build log portion is included below

Dependency Graph |-- TFT_eSPI @ 2.5.33 |-- XPT2046_Touchscreen @ 0.0.0-alpha+sha.26b691b2c8 |-- SPI @ 2.0.0 Building in release mode Compiling .pio\build\esp32dev\src\main.cpp.o In file included from src/main.cpp:34: .pio/libdeps/esp32dev/TFT_eSPI/TFT_eSPI.h:973:8: warning: #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! [-Wcpp]

warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!

    ^~~~~~~

src/main.cpp: In function 'void setup()': src/main.cpp:66:17: error: no matching function for call to 'XPT2046_Touchscreen::begin(SPIClass&)' ts.begin(mySpi); ^ In file included from src/main.cpp:28: .pio/libdeps/esp32dev/XPT2046_Touchscreen/XPT2046_Touchscreen.h:46:7: note: candidate: 'bool XPT2046_Touchscreen::begin()' bool begin(); ^~~~~ .pio/libdeps/esp32dev/XPT2046_Touchscreen/XPT2046_Touchscreen.h:46:7: note: candidate expects 0 arguments, 1 provided *** [.pio\build\esp32dev\src\main.cpp.o] Error 1

scudrunner commented 7 months ago

I think my error is most likely related to the touchscreen library no matching function for call to 'XPT2046_Touchscreen::begin(SPIClass&)'

witnessmenow commented 7 months ago

Someone on the discord had the same error, point to the GitHub of the touch library

scudrunner commented 7 months ago

I found the error that witnessmenow mentioned - the platfrom IO library handler does not grab the current version, even when I pointed directly to the git. I had to fork the library, release it, and then point to my release...

I now have a version that registers the touch.... still trying to put it all together.

https://github.com/scudrunner/XPT2046_Touchscreen.git for my forked version....

scudrunner commented 7 months ago

This fixed it all! Issue is with platform IO - what a pain -

mart-e commented 7 months ago

@scudrunner how did you fixed your issue? I have the same error and using platform IO CLI. Thanks

scudrunner commented 7 months ago

I gave up on platform IO. It was not loading libraries correctly and was giving me to many issues. I was forking libraries and publishing then just to load the right files….

On Sat, Nov 18, 2023 at 12:12 PM Martin Trigaux @.***> wrote:

@scudrunner https://github.com/scudrunner how did you fixed your issue? I have the same error and using platform IO CLI. Thanks

— Reply to this email directly, view it on GitHub https://github.com/witnessmenow/ESP32-Cheap-Yellow-Display/issues/57#issuecomment-1817573766, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQCYWUZUDXCW5QYAVA3RBLYFDUATAVCNFSM6AAAAAA7NORNQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGU3TGNZWGY . You are receiving this because you were mentioned.Message ID: @.***>

mart-e commented 7 months ago

Ok I see, pio pkg install -l XPT2046_Touchscreen installs version 0.0.0-alpha+sha.26b691b2c8 from registry.plateformio.org (2019) and not the one from github (1.4).

Installing using pio pkg install -l "https://github.com/PaulStoffregen/XPT2046_Touchscreen.git" does seems to take the latest version (XPT2046_Touchscreen@0.0.0+sha.5d5120e which is the latest commit as of today) and I can run pio run correctly now.

scudrunner commented 7 months ago

I was trying to run some other packages as well, and had the same issue, so I gave up. If it was only this package, I would have been OK, but it was to much to deal with.

On Sun, Nov 19, 2023 at 4:16 AM Martin Trigaux @.***> wrote:

Ok I see, pio pkg install -l XPT2046_Touchscreen installs version 0.0.0-alpha+sha.26b691b2c8 from registry.plateformio.org https://registry.platformio.org/libraries/paulstoffregen/XPT2046_Touchscreen (2019) and not the one from github https://github.com/PaulStoffregen/XPT2046_Touchscreen (1.4).

Installing using pio pkg install -l " https://github.com/PaulStoffregen/XPT2046_Touchscreen.git" does seems to take the latest version @.***+sha.5d5120e which is the latest commit https://github.com/scudrunner/XPT2046_Touchscreen/commit/5d5120e as of today) and I can run pio run correctly now.

— Reply to this email directly, view it on GitHub https://github.com/witnessmenow/ESP32-Cheap-Yellow-Display/issues/57#issuecomment-1817796322, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQCYWULUZQNN2VXE2YMA6LYFHE5FAVCNFSM6AAAAAA7NORNQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXG44TMMZSGI . You are receiving this because you were mentioned.Message ID: @.***>