The best example I have is ArduinoOTA. I have a project that I want to be compatible with ESP8266 and ESP32 and both versions are slightly different.
So I added both version in my /lib
folder and ajusted each library.json specifying the target platform.
[platformio.ini]
[env:nodemcu]
platform = espressif8266
board = nodemcu
framework = arduino
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
[/lib/ArduinoOTA-32/library.json]
{
[...]
"platforms": "espressif32",
"version": "1.0"
}
[/lib/ArduinoOTA-8622/library.json]
{
[...]
"platforms": "espressif8622",
"version": "1.1"
}
But when I build for nodemcu (pio run -e nodemcu
), it does not seems to use the right version
Library Dependency Graph
|-- [...]
|-- <ArduinoOTA> v1.0
| |-- <WiFi> v1.0
Actually, only esp32dev build correctly.
Any idea how to deal with such situation where we need multiple version of the same library in the same project as this can also apply to WiFi, DNSServer, WiFiManager, FastLed and some other?