lbussy / AsyncWiFiManager

ESP8266 Async WiFi Connection Manager with Captive Web Portal
https://github.com/lbussy/AsyncWiFiManager
MIT License
7 stars 4 forks source link

Incompatibility with Async #7

Closed lbussy closed 3 years ago

lbussy commented 4 years ago

The upstream is not well suited to use in an Async environment. Reportedly, this will allow it.

firasRihan commented 3 years ago

Hello Dear @lbussy , I am using your wifi manager library that you forked but still I'm getting an error when I'm putting it in my project that has the async web server library.

I hope you have any solution for this, I'm so in need for this library to work. Thank you a lot.

This is the error:

In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:62:18: error: redeclaration of 'HTTP_GET' HTTP_GET = 0b00000001, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:29: note: previous declaration 'HTTPMethod HTTP_GET' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:63:18: error: redeclaration of 'HTTP_POST' HTTP_POST = 0b00000010, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:50: note: previous declaration 'HTTPMethod HTTP_POST' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:64:18: error: redeclaration of 'HTTP_DELETE' HTTP_DELETE = 0b00000100, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:83: note: previous declaration 'HTTPMethod HTTP_DELETE' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:65:18: error: redeclaration of 'HTTP_PUT' HTTP_PUT = 0b00001000, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:61: note: previous declaration 'HTTPMethod HTTP_PUT' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:66:18: error: redeclaration of 'HTTP_PATCH' HTTP_PATCH = 0b00010000, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:71: note: previous declaration 'HTTPMethod HTTP_PATCH' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:67:18: error: redeclaration of 'HTTP_HEAD' HTTP_HEAD = 0b00100000, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:39: note: previous declaration 'HTTPMethod HTTP_HEAD' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:68:18: error: redeclaration of 'HTTP_OPTIONS' HTTP_OPTIONS = 0b01000000, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:96: note: previous declaration 'HTTPMethod HTTP_OPTIONS' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS }; ^ In file included from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:14:0: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:69:18: error: redeclaration of 'HTTP_ANY' HTTP_ANY = 0b01111111, ^ In file included from C:\Users\firas\Documents\Arduino\libraries\AsyncWiFiManager-development\src/AsyncWiFiManager.h:59:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:1: C:\Users\firas\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer.h:34:19: note: previous declaration 'HTTPMethod HTTP_ANY' enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };

lbussy commented 3 years ago

The original WiFiManager is now updated to support Async. To address the error you are seeing however,:

#define WEBSERVER_H // <- Define this before you import ESPAsyncWebServer lib
#include "ESPAsyncWebServer.h"
firasRihan commented 3 years ago

@lbussy well all the above errors disappeared except this one : In file included from C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:467:0, from C:\Users\firas\Desktop\UNI\Spring 2021\Senior Project\Smart Irrigation\Smart_Irrigation_Test2\Smart_Irrigation_Test2\Smart_Irrigation_Test2.ino:2: C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h: In constructor 'AsyncCallbackWebHandler::AsyncCallbackWebHandler()': C:\Users\firas\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/WebHandlerImpl.h:76:49: error: 'HTTP_ANY' was not declared in this scope AsyncCallbackWebHandler() : _uri(), _method(HTTP_ANY), _onRequest(NULL), _onUpload(NULL), _onBody(NULL), _isRegex(false) {}

I am using the onDemandConfigPortal example with my code.

Thanks for your efforts

firasRihan commented 3 years ago

I tried to use the original WiFiManager but it had the same error as the first one

lbussy commented 3 years ago

Unfortunately, it's still an include ordering issue. I've never found a better way to get past that than to deconstruct the project (comment out includes) and put it back together again slowly. You will find a nested inclusion somewhere that is responsible.