-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to erase previous credentials? #142
Comments
I think I figured out a solution. This is part of my code:
|
hi, as a general rule of thumb, don t do anything in interrupt callbacks except setting a flag, and process it in the loop. asking for trouble otherwise WiFi.disconnect() will erase ssid/password i use ESP.reset() sucessfully in a lot of projects, the key may be to add a delay(1000) after it. (also, not in a callback) i hope this helps, cheers |
This ticket can probably be closed, maybe document it somewhere in the readme or provide an example. |
Only WiFi.disconnect(); worked for me! Worked here too! |
With button reset. It's done. |
I have a Heltec esp wifi lora 32 I tried to delete the saved SSID settings but it does not work. I tried all the variants read above. I use the PIO with Atom but also on the Arduino IDE do the same. Can anyone help me how to make factorw reset? Thank you! |
@yo2lts, I think something like what follows may work in Arduino IDE:
|
For factory reset you need to use esptool to erase flash also the arduino ide now has erase capability |
Multumesc, cred ca am reusit. |
|
None of that stuff worked. I searched for so long across so many resources. I ended up digging around in the ESP code base and happened upon this little nugget ESP_ERROR_CHECK(nvs_flash_erase()); This seems to have cleared my "AUTH_EXPIRE" credentials and got my WiFi working again. One caution is that it clears everything in flash. So if you are using preferences library, etc, it all gets wiped. |
You should not have to nvs erase to clear credentials, your memory was probably corrupt or changed from an upgrade. |
Well after a month and delayed shipping of product, I'll take any solution. :-| The strange thing is that values I was saving with the preferences library would save into flash, and be re-loaded after next reboot. It was the WiFi which would simply not connect always giving AUTH_EXPIRE exception. So I think it was related to a WiFi problem and nor corrupt memory. But maybe the corruption was just with the WiFi details that were saved. |
Yes if your partition is corrupt your wifi gets corrupted as things write into its memory space, so it might seem to work but some part of it is broken and messed up connections, I wish there was some kind of parity check here, also there was no protection for wifi struct schema when it was changed, I think there is now so upgrades wont break it as much. I always do a full erase if moving to a new version of sdk or lib. |
Your info is interesting and something I'll remember when doing sdk or library upgrades.. But I changed nothing. One day it was working, the next day it wasn't... Thanks for your comments! |
WiFi.mode(WIFI_STA); |
my simple logic is , if we insert the false ssid and password into the program, and we also reset the esp within a program. problem may be resolved. i had try it and working fine. /-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ #include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino //needed for library void setup() {
} void loop() { } void SoftReset() WiFi.begin(ssid, password); Serial.println(); this is my first ever try with arduino programming. |
Lol it says it right there in the code //reset saved settings |
I'm having a similar problem. wifiManager.resetSettings() does not reset the credentials.. I'm literally running the base example: #if defined(ESP8266)
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#else
#include <WiFi.h> //https://github.com/esp8266/Arduino
#endif
//needed for library
#include <DNSServer.h>
#if defined(ESP8266)
#include <ESP8266WebServer.h>
#else
#include <WebServer.h>
#endif
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifiManager;
//reset saved settings
wifiManager.resetSettings();
//set custom ip for portal
//wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
//fetches ssid and pass from eeprom and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
wifiManager.autoConnect("AutoConnectAP");
//or use this for auto generated name ESP + ChipID
//wifiManager.autoConnect();
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
}
void loop() {
// put your main code here, to run repeatedly:
} And its still giving me this in console:
Either something is wrong with the function or its still storing the creds somewhere else? |
esp8266? Do you have serial logs? |
on ESP32 Dev Module. The serial logs are at the bottom there: *WM: Connection result: My workaround currently is to set up a manual config for the AP and attach to a button, but this means having to connect everytime which is frustrating |
Having same issue as lloydrichards here, running on a ESP32 Doit-devkit-v1. Should mention that I'm using https://github.com/zhouhan0126/WIFIMANAGER-ESP32 library, because to my understanding the original Tzapu library cannot run on ESP32? |
I run it on ESP32
…On Wed, Mar 11, 2020 at 1:39 PM shazman-visuals ***@***.***> wrote:
Having same issue as lloydrichards here, running on a ESP32 Doit-devkit-v1.
*wifiManager.resetSettings()* does not do what it is supposed to do (to
reset wifi credentials).
Should mention that I'm using
https://github.com/zhouhan0126/WIFIMANAGER-ESP32 library, because to my
understanding the original Tzapu library cannot run on ESP32?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#142 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC7Y5YJ3RP7Y4TMQIRNYIPLRG7ZINANCNFSM4B7HYKVQ>
.
|
Development branch does |
Cool, so is there a way to reset Wifi credentials or not? |
I have not had time to look into it, could be a bug, try erase flash also |
If it helps for debugging, I was finding that even when I flashed a new program and the went back to something including the wifimanager it would still have my credentials saved when using wifiManager.autoConnect(). This doesn't seem to affect wifiManager.startConfigPortal(), but i'm guessing that cause its just overwriting the credentials. Might give some experimenting to calling wifiManager.autoConnect() to start and then wifiManager.startConfigPortal() when i need to override |
the ESP saves your credentials not WM |
Works for me *WM: [1] SETTINGS ERASED
*WM: [3] WiFi station enable
*WM: [3] enableSTA PERSISTENT ON
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v8b899c12
~ld
Starting
*WM: [1] getCoreVersion(): 2_5_2
*WM: [1] system_get_sdk_version(): 2.2.1(cfd48f3)
*WM: [1] system_get_boot_version(): 31
*WM: [1] getFreeHeap(): 49088
Mode: STA
PHY mode: N
Channel: 1
AP id: 0
Status: 0
Auto connect: 1
SSID (0):
Passphrase (0):
BSSID set: 0
YES
SSID:
PASS: |
Let me try esp32 |
Also works *WM: [1] resetSettings
*WM: [3] WiFi station enable
*WM: [1] SETTINGS ERASED
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:8740
load:0x40080400,len:5800
entry 0x4008069c
Starting
*WM: [1] Free heap: 210252
*WM: [1] ESP-IDF version: v3.2.2-132-g7dd492319-dirty
Mode: STA
Channel: 1
SSID (0):
Passphrase (0):
BSSID set: 0
YES
SSID:
PASS: |
I cannot reproduce, I need you to erase flash, and try again and I will need more information |
How to get the saved SSID and password? |
To get the credentials you need the following: WiFi.begin(); // Mandatory Done! You get credentials without the need to store them neither in spiffs nor in EEPROM |
The libraries built in WifiManager::erase() method did the trick for me. |
wifiManager.resetSettings() was not working for me (ESP8266) as autoConnect would recover the credentials - however erasing the flash via the IDE has solved the issue. |
Interesting, it should erase them, but maybe there was an esp bug in some version you were using |
I have a button on my ESP, that is (via an interrupt service routine) ment to restore factory settings.
How can I clear the existing WIFI credentials, so that after reset WIFIManager "sees" no credentials and starts-up the AP for setting them?
failed
I found a reference to ESP.eraseConfig here esp8266/Arduino#1494 to but that just completely blocks the ESP and I needed to re-flash it! So I guess that is not the way to go...
The text was updated successfully, but these errors were encountered: