From 1d0970a882b84d8840eb597785aae52e5c688605 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 12 Oct 2018 14:10:16 -0500 Subject: [PATCH] moving apcallback after sosftap() apcallback used to only indicate that mode was softap, moved untikl after actually starting the ap, so it can be used to check status and get ip etc. --- WiFiManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 235b9b9..818e20e 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -326,11 +326,6 @@ bool WiFiManager::startAP(){ bool ret = true; DEBUG_WM(F("StartAP with SSID: "),_apName); - // do AP callback if set - if ( _apcallback != NULL) { - _apcallback(this); - } - #ifdef ESP8266 // @bug workaround for bug #4372 https://github.com/esp8266/Arduino/issues/4372 if(!WiFi.enableAP(true)) { @@ -375,6 +370,11 @@ bool WiFiManager::startAP(){ if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] There was a problem starting the AP"); // @todo add softAP retry here + + // do AP callback if set + if ( _apcallback != NULL) { + _apcallback(this); + } delay(500); // slight delay to make sure we get an AP IP DEBUG_WM(F("AP IP address:"),WiFi.softAPIP());