File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -209,16 +209,25 @@ void wifiStart(char* ssid, char* pw)
209209#ifdef COMPILE_WIFI
210210 if ((wifiState == WIFI_OFF) || (wifiState == WIFI_ON))
211211 {
212- WiFi.useStaticBuffers (true ); // Fix for one to many ESP-Now bug, prior to ESP32 core v2.0.4: https://github.com/espressif/esp-idf/issues/8992
213- WiFi.mode (WIFI_STA);
214212
215213#ifdef COMPILE_ESPNOW
216214 if (espnowState > ESPNOW_OFF)
215+ {
216+ WiFi.mode (WIFI_MODE_NULL); // We must go Null before setting static buffers
217+ WiFi.useStaticBuffers (true ); // Fix for one to many ESP-Now bug, prior to ESP32 core v2.0.4: https://github.com/espressif/esp-idf/issues/8992
218+ WiFi.mode (WIFI_STA);
219+
217220 esp_wifi_set_protocol (WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR); // Enable WiFi + ESP-Now
221+ }
218222 else
223+ {
224+ WiFi.mode (WIFI_STA);
225+
219226 esp_wifi_set_protocol (WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N); // Set basic WiFi protocols
227+ }
220228#else
221229 // Be sure the standard protocols are turned on. ESP Now have have previously turned them off.
230+ WiFi.mode (WIFI_STA);
222231 esp_wifi_set_protocol (WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);
223232#endif
224233
@@ -257,6 +266,7 @@ void wifiStop()
257266 // If ESP-Now is active, change protocol to only Long Range
258267 else if (espnowState > ESPNOW_OFF)
259268 {
269+ WiFi.mode (WIFI_MODE_NULL); // We must go Null before setting static buffers
260270 WiFi.useStaticBuffers (true ); // Fix for one to many ESP-Now bug, prior to ESP32 core v2.0.4: https://github.com/espressif/esp-idf/issues/8992
261271 WiFi.mode (WIFI_STA);
262272
You can’t perform that action at this time.
0 commit comments