From 41c9a4087a33bcee1d57dc865de63a918d1dde08 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Thu, 14 Nov 2019 23:17:29 +0100 Subject: [PATCH] Moved first loop into init to be in sync with doku --- lib/IotWebConf/src/IotWebConf.cpp | 6 +++++- src/main.cpp | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/IotWebConf/src/IotWebConf.cpp b/lib/IotWebConf/src/IotWebConf.cpp index 528614d..5c486f9 100644 --- a/lib/IotWebConf/src/IotWebConf.cpp +++ b/lib/IotWebConf/src/IotWebConf.cpp @@ -160,7 +160,11 @@ boolean IotWebConf::init() MDNS.begin(this->_thingName); MDNS.addService("http", "tcp", 80); #endif - +#ifdef USE_ESPASYNCWEBSERVER + // This is required to init wifi already within setup + // (Otherwise AsyncWebserver will crash on begin) + doLoop(); +#endif return validConfig; } diff --git a/src/main.cpp b/src/main.cpp index 0ccdd99..1c4f2ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -173,7 +173,6 @@ void setup() mqttUserNameValue[0] = '\0'; mqttUserPasswordValue[0] = '\0'; } - iotWebConf.doLoop(); // Init WebServer rootHandler = new AsyncCallbackWebHandler();