Closed Tsjippy closed 3 months ago
make sure to have use Async Webserver enabled in ElegantOTA.h
This is a dependency - read the doc.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
I have an issue on a Wemos D1 mini Pro which is ESP8266 based and think I found something..... The Demo compiles fine but the AsyncDemo does not.
Note the part >>>error: cannot convert 'AsyncWebServer' to 'ESP8266WebServer' <<< in the compiler message below:
/tmp/.arduinoIDE-unsaved202461-6036-k43zpy.6s6xr/AsyncDemo/AsyncDemo.ino:89:20: _error: cannot convert 'AsyncWebServer*'_* to 'ESP8266WebServer'* {aka 'esp8266webserver::ESP8266WebServerTemplate |
ElegantOTA.begin(&server); // Start ElegantOTA | ^ |
---|---|---|
AsyncWebServer* |
This means that the parameter type is wrong. It does not expect to receive a server created by "AsyncWebServer server(80);" It simply wants "ESP8266WebServer server(80);" like in the example Demo.
In the code I found ELEGANTOTA_USE_ASYNC_WEBSERVER so...
I added '#define ELEGANTOTA_USE_ASYNC_WEBSERVER 1' before the include '#include
Many thanks for the good work by the way!
Hello, Please make sure to upgrade your dependencies, especially ESPAsyncWebServer: there has been breaking changes in v3. https://github.com/mathieucarbou/ESPAsyncWebServer/releases
I used 2.10.8 until yesterday and now I have 3.0.6 of today. I changed the 'const things' and the '_P things' as the compiler messages noted. Now I thought let me try to update the AsyncElegantOTA to ElegantOTA and the basic Demo compiles but the AsyncDemo does not. When I add the "#define ELEGANTOTA_USE_ASYNC_WEBSERVER 1" line to the top of AsyncDemo it does not complain about the type anymore but I get :
/home/jack/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /tmp/arduino/sketches/B385A77D77EF8B89A60E1E900769B9FD/sketch/AsyncDemo.ino.cpp.o:(.text.setup+0x58): undefined reference to _ZN15ElegantOTAClass5beginEP14AsyncWebServerPKcS3_' /home/jack/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /tmp/arduino/sketches/B385A77D77EF8B89A60E1E900769B9FD/sketch/AsyncDemo.ino.cpp.o: in function
setup':
/tmp/.arduinoIDE-unsaved202461-7672-11io1pu.7x5uf/AsyncDemo/AsyncDemo.ino:74: undefined reference to `ZN15ElegantOTAClass5beginEP14AsyncWebServerPKcS3'
collect2: error: ld returned 1 exit status
Multiple libraries were found for "Hash.h"
Used: /home/jack/.arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/Hash
Not used: /Data/Nextcloud/Jack/Wemos/02. projects/Arduino/libraries/AsyncElegantOTA
exit status 1
Compilation error: exit status 1
It looks like an environment issue. The CI pass and pio build pass with the mentinned combination.
I have it working but have a new question at the end of this.
I should have read the header of the example and go to the internet to find I have to change a line in the library itself. Internet says:
For Arduino IDE
Go to your Arduino libraries directory
Open ElegantOTA folder and then open src folder
Locate the ELEGANTOTA_USE_ASYNC_WEBSERVER macro in the ElegantOTA.h file, and set it to 1:
Changed it in the file and AsyncDemo compiles:
So now my question why can I not leave it at 0 and put "#define ELEGANTOTA_USE_ASYNC_WEBSERVER 1" in my app like:
I expected that to work since I wonder now what happens when I receive an update of the library. Do I need to change the code in the library after every update of the library?
You wouldn't have all these questions if you were using a real dev environment like Vscode with the PIO extension ;-) Sadly I think you are using Arduino IDE, which makes everything complicated regarding dependency maintenance. I myself don't use Arduino IDE since a while. Too many issues like that and this is not sustainable when devellopping a lot of Arduino projects.
Note: I am not the creator and maintainer of ElegantOTA, but just one of the contributors.
@JackV2020 It's just how Arduino IDE works and fails to implement build flags since ages. You should be fine upon switching to PIO and using the build flags to set this macro.
@mathieucarbou @ayushsharma82 Indeed, I have Arduino IDE and use the AppImage version of it and have no experience with visual studio or platform io or the combination of them but I did put that on my to do list today. Last days I have been busy with this ESP8266 project in which I put some handy functionality together. The idea is to have a 'central server' in the IoT network. It has things like Web access to the LittleFS so I can create files and directory trees, upload and download files, create files and also edit files in a web editor. There is a web socket application in it with examples for a sort of MQTT like server and a web socket application to control and react on interrupt of a number of GPIO's IIt comes with 2 html and 1 .ino client examples for the web socket applications. One other thing in it is a NAPT and reverse NAT router to have a little dedicated WiFi for some IoT things. (Dhcp and Reverse NAT settings can be editted with the LittleFS Web editor ) You may have a look at the readme on https://github.com/JackV2020/ESP8266-Server which also contains screenshots of what it looks like. At this moment that version still has the old OTA solution but I will put the new one in. Many thanks again. Jack
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
I did not put the new one in. I created a customizable one: https://github.com/JackV2020/ESP8266-Firmware-Over-The-Air
Just tried to compile the AsyncDemo.ino
Arduino IDE 2.3.2 arduino-esp32 3.0.4 Board ESP32-C3 Super Mini
The example is definitely broken and does not use Async by default (which I would have expected).
Instead of using the define, I think it would be wiser to add an additional (abstraction) layer of include files. One for the normal "ElegantOTA" and one for the "ElegantAsyncOTA". This also avoids the problems caused by the Arduino IDE shuffling the order of things while creating the actual code that is compiled. In these 2 include files all required defines / typedefs or even different class definitions can be made.
@HenkHoldijk The async demo example tells you to enable the Async mode beforehand: https://github.com/ayushsharma82/ElegantOTA/blob/ecdf53f0ace6c8e2acd3902cdc14ab87b538d0fe/examples/AsyncDemo/AsyncDemo.ino#L6
The macro route was decided after a lot of factors, it's the only way to make a project easily maintainable which shares common code.
Yes, slight inconvenience of setting the flag when it comes to Arduino IDE but that's really a disability of Arduino IDE itself. Setting build flags is the most basic and fundamental thing found in C/C++ IDEs but they opted for not adding it. Hopefully, it will be added soon, until then this is the way forward.
Just wanted to let you know that even with the "#define ELEGANTOTA_USE_ASYNC_WEBSERVER 1" in top of the sketch, it does not compile. That is why I said that it was "definitely broken". IDE 2.3.2. & ESP32 core 3.0.4 & Board ESP32C3 Super Mini.
@HenkHoldijk I understand and already know of this limitation. The docs explicitly say to enable the flag within the library header file. Just adding the flag before include will not cut it.
The demoe supplied with this lib will not compile with error: AsyncDemo.ino:33:10: fatal error: ESPAsyncWebServer.h: No such file or directory.
And indeed that file does not exist in this repo