Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 758b4eb

Browse filesBrowse files
eraseAP (espressif#8148)
1 parent 5c92a02 commit 758b4eb
Copy full SHA for 758b4eb

File tree

Expand file treeCollapse file tree

2 files changed

+17
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-0
lines changed

‎libraries/WiFi/src/WiFiSTA.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiSTA.cpp
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
366366
return false;
367367
}
368368

369+
/**
370+
* @brief Reset WiFi settings in NVS to default values.
371+
* @return true if erase succeeded
372+
* @note: Resets SSID, password, protocol, mode, etc.
373+
* These settings are maintained by WiFi driver in IDF.
374+
* WiFi driver must be initialized.
375+
*/
376+
bool WiFiSTAClass::eraseAP(void) {
377+
if(WiFi.getMode()==WIFI_MODE_NULL) {
378+
if(!WiFi.enableSTA(true))
379+
return false;
380+
}
381+
382+
return esp_wifi_restore()==ESP_OK;
383+
}
384+
369385
/**
370386
* Change IP configuration settings disabling the dhcp client
371387
* @param local_ip Static ip configuration

‎libraries/WiFi/src/WiFiSTA.h

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiSTA.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class WiFiSTAClass
5353

5454
bool reconnect();
5555
bool disconnect(bool wifioff = false, bool eraseap = false);
56+
bool eraseAP(void);
5657

5758
bool isConnected();
5859

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.