Modified local library overridden/ignored

This is a problem in a project for multiple esp32 boards, using the TFT_eSPI library.

The library source requires editing before use, items like specific driver chip and SPI pin assignments. SPI pin assignments are board-specific.

I made a copy of the TFT_eSPI directory from .pio/libdeps in the workspace lib directory. I made suitable modifications to the local lib copy.

This arrangement worked. I had successful tests with 2 different boards/envs. My local changes were compiled and included in the binaries.

I added a third project env for a third board type.

After saving platformio.ini, the update process showed the library manager updating and installing versions for all the project libraries, INCLUDING TFT_eSPI!

Three projects now fail.

Subsequent examination of the contents of the .pio\libdeps…copies of TFT_eSPI reveals that now for all three board types, the unmodified&unusable github version has been installed.

So, the modified local library is being ignored contrary to the docs.

How does one avoid this issue?

Never ever edit files localted in .pio.
These files are temporary and can change or removed at any time.

If you want to have a local library, move it to the lib folder within your project.

Fortunately, TFT_eSPI PlatformIO offers users a much better way to configure the library. You’ll find a not about this in the README :

PlatformIO users can define these settings on a per project basis within a platformio.ini file, see Docs folder in library.

Unfortunately this is not linked but take a look at TFT_eSPI/docs/PlatformIO/Configuring options.txt at master · Bodmer/TFT_eSPI · GitHub

This example shows how you can easily configure the library without having to change the library files.