Skip to content

Commit 254f128

Browse files
committed
Improve a little the issue with lastest ESP32 core
and wifi scan in WIFI_AP_STA Now works in platformIO and arduino but still little bit funky - as sometime no scan list - when no issue with ESP8266 neither ESP32 and 3.X SDK
1 parent bdb40f0 commit 254f128

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

esp3d/src/core/espcmd/ESP410.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,19 @@ bool Commands::ESP410(const char* cmd_params, level_authenticate_type auth_type,
4141
#endif //AUTHENTICATION_FEATURE
4242
//Backup current mode
4343
uint8_t currentmode = WiFi.getMode();
44-
if(currentmode==WIFI_AP) {
45-
WiFi.mode(WIFI_AP_STA);
46-
}
4744
bool plain = hastag(cmd_params,"plain");
4845
int n = 0;
4946
uint8_t total = 0;
50-
n = WiFi.scanNetworks ();
5147
if (plain) {
5248
output->printLN ("Start Scan");
5349
}
50+
if(currentmode==WIFI_AP) {
51+
WiFi.mode(WIFI_AP_STA);
52+
}
53+
n = WiFi.scanNetworks ();
54+
if(currentmode==WIFI_AP) {
55+
WiFi.mode((WiFiMode_t)currentmode);
56+
}
5457
if (!plain) {
5558
output->print ("{\"AP_LIST\":[");
5659
}
@@ -109,7 +112,6 @@ bool Commands::ESP410(const char* cmd_params, level_authenticate_type auth_type,
109112
}
110113
output->printLN ("End Scan");
111114
}
112-
WiFi.mode((WiFiMode_t)currentmode);
113115
return response;
114116
}
115117

platformio.ini

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ default_envs = esp32dev
1818

1919

2020
[env:esp32dev]
21-
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
21+
platform = espressif32
2222
board = esp32dev
2323
framework = arduino
24-
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
24+
platform_packages =
25+
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
2526
monitor_speed = 115200
2627
monitor_flags = --echo
2728
monitor_filters = send_on_enter, colorize, esp32_exception_decoder
@@ -60,10 +61,11 @@ lib_ignore =
6061
;https://github.com/Bodmer/TFT_eSPI/issues/1246
6162

6263
[env:esp32devWiFiOnly]
63-
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
64+
platform = espressif32
6465
board = esp32dev
6566
framework = arduino
66-
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
67+
platform_packages =
68+
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
6769
monitor_speed = 115200
6870
monitor_flags = --echo
6971
monitor_filters = send_on_enter, colorize, esp32_exception_decoder

0 commit comments

Comments
 (0)