From 5ae132a7e94d7db33b7e2d2da4bb3dd614ff691f Mon Sep 17 00:00:00 2001 From: Shawn A Date: Thu, 1 Mar 2018 13:19:40 -0600 Subject: [PATCH] #542 handler --- WiFiManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 7b99748..933f6dc 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -182,7 +182,12 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) { DEBUG_WM(F("AutoConnect")); // attempt to connect using saved settings, on fail fallback to AP config portal - WiFi.enableSTA(true); + if(!WiFi.enableSTA(true)){ + // handle failure mode Brownout detector etc. + DEBUG_WM("[FATAL] Unable to enable wifi!"); + return false; + } + _usermode = WIFI_STA; // no getter for autoreconnectpolicy before this