@@ -108,7 +108,7 @@ void tcpipInit(){
108
108
}
109
109
}
110
110
111
- static bool wifiLowLevelInit (){
111
+ static bool wifiLowLevelInit (bool persistent ){
112
112
static bool lowLevelInitDone = false ;
113
113
if (!lowLevelInitDone){
114
114
tcpipInit ();
@@ -118,7 +118,9 @@ static bool wifiLowLevelInit(){
118
118
log_e (" esp_wifi_init %d" , err);
119
119
return false ;
120
120
}
121
- esp_wifi_set_storage (WIFI_STORAGE_FLASH);
121
+ if (!persistent){
122
+ esp_wifi_set_storage (WIFI_STORAGE_RAM);
123
+ }
122
124
esp_wifi_set_mode (WIFI_MODE_NULL);
123
125
lowLevelInitDone = true ;
124
126
}
@@ -133,11 +135,11 @@ static bool wifiLowLevelDeinit(){
133
135
134
136
static bool _esp_wifi_started = false ;
135
137
136
- static bool espWiFiStart (){
138
+ static bool espWiFiStart (bool persistent ){
137
139
if (_esp_wifi_started){
138
140
return true ;
139
141
}
140
- if (!wifiLowLevelInit ()){
142
+ if (!wifiLowLevelInit (persistent )){
141
143
return false ;
142
144
}
143
145
esp_err_t err = esp_wifi_start ();
@@ -383,7 +385,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
383
385
return false ;
384
386
}
385
387
if (m){
386
- return espWiFiStart ();
388
+ return espWiFiStart (_persistent );
387
389
}
388
390
return espWiFiStop ();
389
391
}
@@ -394,7 +396,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
394
396
*/
395
397
wifi_mode_t WiFiGenericClass::getMode ()
396
398
{
397
- if (!wifiLowLevelInit ()){
399
+ if (!wifiLowLevelInit (_persistent )){
398
400
return WIFI_MODE_MAX;
399
401
}
400
402
uint8_t mode;
0 commit comments