You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wled00/wled.cpp
+27-1Lines changed: 27 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -507,7 +507,7 @@ void WLED::setup()
507
507
#ifndef ESP8266
508
508
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
509
509
#endif
510
-
WiFi.persistent(false);
510
+
WiFi.persistent(false);// note: on ESP32 this is only applied if WiFi.mode() is called and only if mode changes, use low level esp_wifi_set_storage() to change storage method immediately
511
511
WiFi.onEvent(WiFiEvent);
512
512
WiFi.mode(WIFI_STA); // enable scanning
513
513
findWiFi(true); // start scanning for available WiFi-s
esp_wifi_set_storage(WIFI_STORAGE_RAM); // do not update NVM credentials while running to prevent wear on flash
692
+
#endif
693
+
673
694
DEBUG_PRINTF_P(PSTR("initConnection() called @ %lus.\n"), millis()/1000);
674
695
#ifdef WLED_ENABLE_WEBSOCKETS
675
696
ws.onEvent(wsEvent);
@@ -720,6 +741,11 @@ void WLED::initConnection()
720
741
char hostname[25];
721
742
prepareHostname(hostname);
722
743
744
+
#ifdef ARDUINO_ARCH_ESP32
745
+
if(updateWiFiNVM && selectedWiFi == 0) // NVM only can store one wifi: store credentials of first WiFi even if multiple are configured
746
+
esp_wifi_set_storage(WIFI_STORAGE_FLASH); // temporary override WiFi.persistent(false) to store credentials in flash (is reset to RAM on next initConnection() call)
747
+
#endif
748
+
723
749
#ifdef WLED_ENABLE_WPA_ENTERPRISE
724
750
if (multiWiFi[selectedWiFi].encryptionType == WIFI_ENCRYPTION_TYPE_PSK) {
0 commit comments