1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-17 12:02:15 +03:00

Merge pull request #370 from Links2004/esp8266

add better docu and schematics for easy setup the ESP
This commit is contained in:
Ivan Grokhotkov
2015-06-05 13:55:34 +03:00
6 changed files with 82 additions and 26 deletions

View File

@ -46,6 +46,9 @@ ESP8266WiFiClass::ESP8266WiFiClass()
void ESP8266WiFiClass::mode(WiFiMode m)
{
if(wifi_get_opmode() == (uint8)m) {
return;
}
ETS_UART_INTR_DISABLE();
wifi_set_opmode(m);
ETS_UART_INTR_ENABLE();
@ -357,10 +360,14 @@ void ESP8266WiFiClass::_scanDone(void* result, int status)
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);
} else {
// turn on STA mode
mode(WIFI_STA);
}
int status = wifi_station_get_connect_status();
if (status != STATION_GOT_IP && status != STATION_IDLE)
{
@ -532,9 +539,12 @@ void ESP8266WiFiClass::beginSmartConfig()
if (_smartConfigStarted)
return;
if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled
{
if(_useApMode) {
// turn on AP+STA mode
mode(WIFI_AP_STA);
} else {
// turn on STA mode
mode(WIFI_STA);
}
_smartConfigStarted = true;