From cc38f37f101e854f9c4b6883431dc893f1405f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sat, 25 Aug 2018 08:39:46 +0200 Subject: [PATCH] Disconnect before running WPS and SmartConfig discovery (#1146) --- code/espurna/wifi.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/espurna/wifi.ino b/code/espurna/wifi.ino index 37f55464..d72396e7 100644 --- a/code/espurna/wifi.ino +++ b/code/espurna/wifi.ino @@ -226,6 +226,7 @@ void _wifiCallback(justwifi_messages_t code, char * parameter) { if (MESSAGE_WPS_ERROR == code || MESSAGE_SMARTCONFIG_ERROR == code) { _wifi_wps_running = false; _wifi_smartconfig_running = false; + jw.enableAP(true); } if (MESSAGE_WPS_SUCCESS == code || MESSAGE_SMARTCONFIG_SUCCESS == code) { @@ -249,6 +250,7 @@ void _wifiCallback(justwifi_messages_t code, char * parameter) { _wifi_wps_running = false; _wifi_smartconfig_running = false; + jw.enableAP(true); } @@ -550,12 +552,16 @@ void wifiStartAP() { #if defined(JUSTWIFI_ENABLE_WPS) void wifiStartWPS() { + jw.enableAP(false); + jw.disconnect(); jw.startWPS(); } #endif // defined(JUSTWIFI_ENABLE_WPS) #if defined(JUSTWIFI_ENABLE_SMARTCONFIG) void wifiStartSmartConfig() { + jw.enableAP(false); + jw.disconnect(); jw.startSmartConfig(); } #endif // defined(JUSTWIFI_ENABLE_SMARTCONFIG)