Can't compile after changing esp32 board

Hello.I have a project that I have been developing on a lollin s2 board. It works as intended and compiles, but if I add an esp32 devkit v1 board, it will not compile, givingme several errors in the AsyncTCP-esphome library. It’s the exact same code, I even tried starting a new project, selecting the board, and copying and pasting the code. The librarys download, but can’t compile. Here is a screenshot when trying to compile for this board, if I swap to Lollin board, everything compiles.


Here is my ini file that I modified to add the second board.

[env:lolin_s2_mini]
platform = espressif32
board = lolin_s2_mini
framework = arduino
monitor_speed = 115200
build_flags = 
	-DARDUINO_USB_CDC_ON_BOOT=1
lib_deps = 
	ottowinter/ESPAsyncWebServer-esphome@^3.1.0
	esphome/AsyncTCP-esphome@^2.0.1
	ottowinter/ESPAsyncTCP-esphome@^1.2.3
	me-no-dev/AsyncTCP@^1.1.1
	ayushsharma82/AsyncElegantOTA@^2.2.8

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
monitor_speed = 115200
lib_deps = 
	ottowinter/ESPAsyncWebServer-esphome@^3.1.0
	esphome/AsyncTCP-esphome@^2.0.1
	ottowinter/ESPAsyncTCP-esphome@^1.2.3
	me-no-dev/AsyncTCP@^1.1.1
	ayushsharma82/AsyncElegantOTA@^2.2.8

Am I doing something wrong?

Here are a few things I noticed:

1. ayushsharma82/AsyncElegantOTA is deprecated the current version is ayushsharma82/ElegantOTA
2. ottowinter/ESPAsyncWebServer is a fork of me-no-dev/ESP Async WebServer. Is there a special reason that you are using this fork?
3.

	esphome/AsyncTCP-esphome@^2.0.1
	ottowinter/ESPAsyncTCP-esphome@^1.2.3
	me-no-dev/AsyncTCP@^1.1.1

You are mixing things up here.
ESPAsyncTCP is for ESP8266 whereby AsyncTCP ist for ESP32.
The correct library is installed automaticly by ESPAsyncWebServer as depenency.
Remove these entries and have the correct library installed automatically.

Question: Are you creating a project for ESPHome or do you just want to use the ESPAsyncWebServer and ElegantOTA in your project?

1 Like

Thank you for your reply. last night I was up for an hour trying everything and saw these errors. The elegantOTA is deprecated, but I don’t really care about it right now, I’ll update it later. This is a semi old project I’m trying to add to a board I found alying around. And about the “fork” from ottowinter/ESPAsyncWebServer, I really don’t know, I used a sketch in my pogram that needed that library, so I added it.

As for point 3, I did delete the redundencies. Leaving only three needed, but that still gave me errors on compiling, all from esphome/AsyncTCP.

literally right before leaving, I found that setting the esphome/AsyncTCP to version 2.0.0 instead of ^2.0.1 (which I am guessing means above 2.0.1), downloaded the 2.0.0 version and it compiled. So something in the latest version (If I remember it was 2.1.0), is not letting the code compile. THe funny thing is, it compiles for the Lollin s2 board, but not for the devkit v1 board, both being esp32. That’s the odd part.

But thanks to the troubles, I have learned a lot about libaries, and how to download a specific version.

Sorry. This is the part I didn’t know, I thought I needed to declare AsyncTCP.h aslo. So, I deleted these three:
esphome/AsyncTCP-esphome@^2.0.1
ottowinter/ESPAsyncTCP-esphome@^1.2.3
me-no-dev/AsyncTCP@^1.1.1
and when compiling, it gave me errros for missing AsyncTCP.h. And if I remove AsyncTCP.h from library declaration, the same thing happens. Errors all over esphome/AsyncTCP.

Now know why, it’s because it downloads the latest version automatically. So I need to add to dependencies, but tell what version I want. Can anybody else confirm if this dependency is not working for them?

All this is because I’m a newbie, libaries in platformio is stil not my strong point, but I have learned a lot last night.

This assumption is wrong, an ESP32-S2 is not an ESP32!
Even if ESP32 appears in both names, they are completely different microcontrollers.

Without knowing your project and your exact intentions, it is difficult to determine the correct configuration.

There are several dependencies here that we first have to solve individually, by which I don’t mean the dependencies of the libraries but of your project and its configuration.

So let’s start with the unanswered question:
Are you creating a project for ESPHome or do you just want to use the ESPAsyncWebServer and ElegantOTA in your project?

This is not a project for ESPHome. The ESPAsyncWebServer is for a html page I am serving, to control the intensity of a pwm signal, to control LED intensity. And ElegantOTA was the last thing added (a few months ago), this is just to be able to update the firmware without connecting it up through usb.

Ok, then
first delete the .pio/libdeps folder.

Change your lib_deps in platformio.ini to:

lib_deps = 
  me-no-dev/ESP Async WebServer
  ayushsharma82/AsyncElegantOTA

After saving the platformio.ini all dependent libraries (AsyncTCP etc.) should be installed automatically and show up in the .pio/libdeps folder.

Now I get different errors:

This bug has already been fixed in the ESPAsyncWebServer, but has not been picked up by the library registry.
To fix this, use the source from Github.
Change the lib_deps to:

lib_deps = 
  https://github.com/me-no-dev/ESPAsyncWebServer
  ayushsharma82/AsyncElegantOTA

Sorry for the inconvenience (I always use the sources from Github, so the error never occurred for me)

Thank you very much! It now compiles without any errors, and with only those two dependencies.