How to delete all ssid's and passwords saved? #317
-
Hello, Frist congratulations from an escellent work. I've been needing to remove all the ssid's saved from ESP32 or just a way to get all ssid saved. i dont want to erase all the flash memory just to be able to reset the wifi credential. Thank all to help. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
Hi @DanielSamp4 , on Arduino Ide, select erase flase, and select Only sketch |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply @Bighoneypot, |
Beta Was this translation helpful? Give feedback.
-
@DanielSamp4 #include <WiFi.h>
#include <WiFiServer.h>
#include <AutoConnect.h>
void deleteAllCredentials(void) {
AutoConnectCredential credential;
station_config_t config;
uint8_t ent = credential.entries();
Serial.println("AutoConnectCredential deleting");
if (ent)
Serial.printf("Available %d entries.\n", ent);
else {
Serial.println("No credentials saved.");
return;
}
while (ent--) {
credential.load((int8_t)0, &config);
if (credential.del((const char*)&config.ssid[0]))
Serial.printf("%s deleted.\n", (const char*)config.ssid);
else
Serial.printf("%s failed to delete.\n", (const char*)config.ssid);
}
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
deleteAllCredentials();
}
void loop() {
} If you receive an error as |
Beta Was this translation helpful? Give feedback.
-
Thank you so much, this function worked very well :DD |
Beta Was this translation helpful? Give feedback.
-
@Hieromon, thanks also for your great work! I was also able to delete my stored credentials this way. Do you know how I can put it back into captive-portal-mode to connect it to another AP (via code)? My code:
Best regards! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply, that worked :D |
Beta Was this translation helpful? Give feedback.
@DanielSamp4
What you need may be here.
The sketch that drives the service function described there is: