From 5827c2f8cb170c82ee5321d0e70bc8b8c77c19fe Mon Sep 17 00:00:00 2001 From: Rodrigo Jose Carbajales Date: Thu, 6 Sep 2018 12:11:38 +0200 Subject: [PATCH] Swapping enableAP and softAPConfig Swapping enableAP and softAPConfig for static IP STA --- WiFiManager.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index ebd5c14d7..a5c3f5236 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -317,14 +317,6 @@ bool WiFiManager::startAP(){ _apcallback(this); } - // setup optional soft AP static ip config - if (_ap_static_ip) { - DEBUG_WM(F("Custom AP IP/GW/Subnet:")); - if(!WiFi.softAPConfig(_ap_static_ip, _ap_static_gw, _ap_static_sn)){ - DEBUG_WM(DEBUG_ERROR,"[ERROR] softAPConfig failed!"); - } - } - #ifdef ESP8266 // @bug workaround for bug #4372 https://github.com/esp8266/Arduino/issues/4372 if(!WiFi.enableAP(true)) { @@ -334,6 +326,15 @@ bool WiFiManager::startAP(){ delay(500); // workaround delay #endif + // setup optional soft AP static ip config + if (_ap_static_ip) { + DEBUG_WM(F("Custom AP IP/GW/Subnet:")); + if(!WiFi.softAPConfig(_ap_static_ip, _ap_static_gw, _ap_static_sn)){ + DEBUG_WM(DEBUG_ERROR,"[ERROR] softAPConfig failed!"); + } + } + + if(_channelSync){ DEBUG_WM(DEBUG_VERBOSE,"Starting AP on channel:",WiFi.channel()); }