Multiple use of the TFT_eSPI library with different board configs... how? #2477
-
Posted this on the Arduino group but thought I should contact the good chap who actually wrote the code... my apologies, I should have done that first. I'll try to be as detailed as I can so as to explain what I am trying to accomplish. I have recently purchased several LilyGo ESP32S3 boards, namely the T-Display S3, the T-Display S3 Touch, and the T-Embed S3. I have been writing scripts to do various tasks and they all make use of the excellent TFT_eSPI library. However, the T-Embed board uses different settings in the /User_Setup.h and /User_Setup_Select.h files for it to be used correctly with the TFT_eSPI library. After several hours yesterday I figured this out and managed to get the T-Embed board working fine with my code. But today... when I came to use the other two boards, I found that they no longer display anything when yesterday (before I updated the TFT_eSPI libraries etc) they were all working fine. I have since discovered that of course the boards use different settings in the files mentioned above i.e. to define the pinout, specifics etcof the board, and reading some of the //comments in the files I see this is of course by design, thus allowing multiple boards to be used with essentially the same library. When I once again updated the relevant lib folders etc. the two other boards worked fine once again. But... you know what's coming now... the T-Embed board stopped working and I found myself back in the same position I was in yesterday! Hence doing some research today finding out about all this stuff, and needing to figure out how to use multiple TFT_eSPI libraries. Therein lies my question. How do you use multiple versions of the TFT_eSPI library or its associated setup files - with different sketches? I appreciate one can hard-code the location of the library in the #include statement to provide an absolute reference the file, but then if I move the file or folder etc it all goes awry again - relative references re better! Right now I have the TFT_eSPI version required to correctly run the first two boards installed in my Arduino/libraries/TFT_eSPI folder, and in each of the files that uses it, I use the statement...
... but of course when I now try to use the T-Embed board these versions of the library /User_Setup.h and /User_Setup_Select.h files won't cut the mustard because they are referencing the wrong boards! How do I set up the environment such that I can use different installations of the TFT_eSPI library with different settings for each board I use? Where do I install the TFT_eSPI folder and it's files...? is it in the /lib folder that the MySketch.ino is stored in, or elsewhere...? And how do I reference that file instead of the one in the /Arduino/libraries folder? Or, do I simply copy the User_Setup.h and User_Setup_Select.h files to the same folder as the MySketch.ino file? Hope all that makes sense and you can point me in the right direction please. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Edit the User_Setup_Select.h file when changing hardware configurations. This is quick and easy, just add or delete // on the relevant line. The time required to do this is tiny compared to other development activities. The are other discussions here on the topic. Alternatively use PlatformIO IDE and define settings per project. |
Beta Was this translation helpful? Give feedback.
Edit the User_Setup_Select.h file when changing hardware configurations.
This is quick and easy, just add or delete // on the relevant line.
The time required to do this is tiny compared to other development activities.
The are other discussions here on the topic.
Alternatively use PlatformIO IDE and define settings per project.