.piolibdeps folder

My installation updated itself and everything broke and couldn’t rebuild the project.

I was never completely clear about the way libraries would be included either in the project or linked to by the project. Tutorials online, I think, are out dated on this.

I think I did things wrong by including a library I wanted to use then modifying that library in the libdeps folder. Now it will only build with the library in the config which doesn’t use the libdeps folder version which is why it breaks my project. I rather liked the fact that the entire folder structure included everything required. It says see Redirecting... but that didn’t clear it up for me.

I’m using amongst other things the TFT_espi library which requires user.h to be configured, which now doesn’t work as documented. I’ve ported the settings to the ini which the library supports and now we’re back in business. But what do I do if I want to fiddle with the library code?

Am I missing something really fundamental?

New version of PlatformIO has changed the folder for storing project libraries. Building the project caused pulling new versions of the libraries if they weren’t fixed in your platformio.ini. Of course, they didn’t include your local modifications.

But you should still have .piolibdeps folder around, and you can copy old library versions from there to new libraries folder - .pio/libdeps/[env_name].

It still does, only the path to libraries is different, separate for every build environment from platformio.ini.

Move the whole library to lib folder and remove it from lib_deps setting in platformio.ini. The project dependency on that library won’t be managed by PlatformIO any more. After that, you can do whatever you want with the library code :slight_smile:

My understanding is as following: the libraries are included from multiple places - global PlatformIO library storage, library storage in chosen framework, local (per build environment) library storage, and private project storage in lib folder. There may be more, but the last one is not managed by PlatformIO in any way.

2 Likes

Thanks for that. I think that clears it up quite well. Library management has always been a pain unless you can use the library 100% as is.

1 Like

I recently had the same issue with TFT_eSPI - both a bug that hadn’t been fixed yet, and how to make User_Setup.h configurations more portable - and thankfully found a way around in one of the github issue comments. Instead of modifying User_Setup.h… meaning it will not transfer to a new machine if you use git and could be clobbered if you update the libraries… use build_flags… (which I just realised on re-reading your initial question that you’ve done :man_facepalming: )

i.e. For my setup, the following is working perfectly great! :slightly_smiling_face:

build_flags =
  -DUSER_SETUP_LOADED
  -DILI9341_DRIVER
  -DTFT_CS=15
  -DTFT_DC=0
  -DTFT_RST=-1
  -DLOAD_GLCD
  -DLOAD_FONT2
  -DLOAD_FONT4
  -DLOAD_FONT6
  -DLOAD_FONT7
  -DLOAD_FONT8
  -DLOAD_GFXFF
  -DSMOOTH_FONT
  -DSPI_FREQUENCY=27000000
  -DSPI_READ_FREQUENCY=20000000
  -DSPI_TOUCH_FREQUENCY=2500000

btw, the Library Dependency Finder order of importance is

  1. lib_extra_dirs - extra storages per build environment
  2. lib_dir - own/private library storage per project
  3. libdeps_dir - project dependency storage used by Library Manager
  4. core_dir/lib” - global storage per all projects.
  5. Library storages built into frameworks, SDKs.

Because lib_dir is before libdeps_dir, as azarubkin pointed out, if you need to change a library, putting it in the \lib folder should do the trick.

2 Likes

Thanks for that. I was using the ini settings, but sprint.drawstring() was trying to use font 4 which I hadn’t included. I just noticed that on yours and added it recompiled and it’ll probably work. I uploaded it but can’t see the screen as its 20 miles away. I’ll check it later.

I got 80MHz clock (which works perfect on a PCB but may not work with breadboard capacitance) and I have not included Smooth_font as I haven’t loaded any into the flash. I assume that rst = -1 is akin to commenting it out i.e. no reset line attached.

I deleted the old libdeps, cleaned and rebuilt and everything still seems to compile so I guess we’re good.

I expect so… although the comment in the User_Setup.h is

//#define TFT_RST  -1    // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V

I just copied that as is, and it worked, so so I really should go through that setup again, and get rid of the fonts I’m not actually using… as I’m pretty much only using the FreeFonts … hm… so now I have

  -DUSER_SETUP_LOADED
  -DILI9341_DRIVER
  -DTFT_CS=15
  -DTFT_DC=0
  -DTFT_RST=-1
  -DLOAD_GLCD
  -DLOAD_GFXFF
  -DSMOOTH_FONT
  -DSPI_FREQUENCY=40000000
  -DSPI_READ_FREQUENCY=20000000
  -DSPI_TOUCH_FREQUENCY=2500000

Thanks for pointing out the SPI frequency… bumped it up a bit and it does seem smoother! I’m currently breadboarding and am using SPIFFs, so that’s the highest I’m supposed to be able push it. :smiley: