1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

improve mode handling for ESP8266WiFiClass::scanNetworks and ESP8266WiFiClass::beginSmartConfig

This commit is contained in:
Markus Sattler
2015-06-03 15:10:35 +02:00
parent 2af8acd9b2
commit 9dcc5a19b2

View File

@ -333,10 +333,14 @@ void ESP8266WiFiClass::_scanDone(void* result, int status)
int8_t ESP8266WiFiClass::scanNetworks() int8_t ESP8266WiFiClass::scanNetworks()
{ {
if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled if(_useApMode) {
{ // turn on AP+STA mode
mode(WIFI_AP_STA); mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_STA);
} }
int status = wifi_station_get_connect_status(); int status = wifi_station_get_connect_status();
if (status != STATION_GOT_IP && status != STATION_IDLE) if (status != STATION_GOT_IP && status != STATION_IDLE)
{ {
@ -508,9 +512,12 @@ void ESP8266WiFiClass::beginSmartConfig()
if (_smartConfigStarted) if (_smartConfigStarted)
return; return;
if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled if(_useApMode) {
{ // turn on AP+STA mode
mode(WIFI_AP_STA); mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_STA);
} }
_smartConfigStarted = true; _smartConfigStarted = true;