@@ -108,7 +108,7 @@ void tcpipInit(){
108108 }
109109}
110110
111- static  bool  wifiLowLevelInit (){
111+ static  bool  wifiLowLevelInit (bool  persistent ){
112112 static  bool  lowLevelInitDone = false ;
113113 if (!lowLevelInitDone){
114114 tcpipInit ();
@@ -118,7 +118,9 @@ static bool wifiLowLevelInit(){
118118 log_e (" esp_wifi_init %d"  , err);
119119 return  false ;
120120 }
121-  esp_wifi_set_storage (WIFI_STORAGE_FLASH);
121+  if (!persistent){
122+  esp_wifi_set_storage (WIFI_STORAGE_RAM);
123+  }
122124 esp_wifi_set_mode (WIFI_MODE_NULL);
123125 lowLevelInitDone = true ;
124126 }
@@ -133,11 +135,11 @@ static bool wifiLowLevelDeinit(){
133135
134136static  bool  _esp_wifi_started = false ;
135137
136- static  bool  espWiFiStart (){
138+ static  bool  espWiFiStart (bool  persistent ){
137139 if (_esp_wifi_started){
138140 return  true ;
139141 }
140-  if (!wifiLowLevelInit ()){
142+  if (!wifiLowLevelInit (persistent )){
141143 return  false ;
142144 }
143145 esp_err_t  err = esp_wifi_start ();
@@ -383,7 +385,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
383385 return  false ;
384386 }
385387 if (m){
386-  return  espWiFiStart ();
388+  return  espWiFiStart (_persistent );
387389 }
388390 return  espWiFiStop ();
389391}
@@ -394,7 +396,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
394396 */  
395397wifi_mode_t  WiFiGenericClass::getMode ()
396398{
397-  if (!wifiLowLevelInit ()){
399+  if (!wifiLowLevelInit (_persistent )){
398400 return  WIFI_MODE_MAX;
399401 }
400402 uint8_t  mode;
0 commit comments