Unverified Commit 758b4ebf authored by David McCurley's avatar David McCurley Committed by GitHub

eraseAP (#8148)

parent 5c92a023
...@@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap) ...@@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
return false; return false;
} }
/**
* @brief Reset WiFi settings in NVS to default values.
* @return true if erase succeeded
* @note: Resets SSID, password, protocol, mode, etc.
* These settings are maintained by WiFi driver in IDF.
* WiFi driver must be initialized.
*/
bool WiFiSTAClass::eraseAP(void) {
if(WiFi.getMode()==WIFI_MODE_NULL) {
if(!WiFi.enableSTA(true))
return false;
}
return esp_wifi_restore()==ESP_OK;
}
/** /**
* Change IP configuration settings disabling the dhcp client * Change IP configuration settings disabling the dhcp client
* @param local_ip Static ip configuration * @param local_ip Static ip configuration
......
...@@ -53,6 +53,7 @@ public: ...@@ -53,6 +53,7 @@ public:
bool reconnect(); bool reconnect();
bool disconnect(bool wifioff = false, bool eraseap = false); bool disconnect(bool wifioff = false, bool eraseap = false);
bool eraseAP(void);
bool isConnected(); bool isConnected();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment