mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1239] How to know if credentials is reconfigured or how to get the last saved AP(ssid) name? #1060
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1060
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shariq-azim on GitHub (Apr 11, 2021).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1239
Basic Infos
I am trying to reconnect to the last known configurations or saved credentials(ssid, password) after the connection is lost temporarily for a while. In case it was reconfigured or had no wifi present before timeout ,it will return no proper/empty values.
Thus, If I somehow know if there was a change of ssid somehow I can force restart on it to work properly.
Hardware
WiFimanager Branch/Release: Master- Developement 2.0.1 alpha
Esp32
Core Version: Not sure :/
Description
Now, with the code that i have compiled so far. I am facing two issues
Unfortunately, since my program is meant to run both online and offline, I cannot keep it struck in the blocking while(WiFi.status() != WL_CONNECTED) loop..
Settings in IDE
Module: Esp32 dev module
Additional libraries:
Sketch
Debug Messages
succesful case if manally rebooted and wifi available
@tablatronix commented on GitHub (Apr 11, 2021):
esp32 has no autoconnect you will have to use the event hooks and add your own or add some timed loop check
and reconnect with standard esp methods begin() or reconnect()
esp32 should reconnect though, maybe it broke
@shariq-azim commented on GitHub (Apr 11, 2021):
@tablatronix hey that's what I am doing right in loop function?
`
void loop()
{
Serial.println("Loop started");
Serial.print("Wifi status: ");
Serial.println(WiFi.status());
if (WiFi.status() != WL_CONNECTED)
{
if (DEBUG_SW) Serial.println("Not Connected");
//even tried
// WiFi.disconnect();
// delay(1100); //custom
// WiFi.begin(ssid, pass);
}
else{
Serial.println("Re-attempting to connect");
WiFi.begin(ssid, pass);
}
}
else
{
if (DEBUG_SW) Serial.println(" Connected");
Blynk.run();
}
timer.run(); // Initiates SimpleTimer
server.handleClient(); //custom
delay(400); //custom
if (MODE == 0)
with_internet();
else
without_internet();
// put your main code here, to run repeatedly:
}
`
btw, are you aware if wifi manager library updates ssid chars, during its operation in loop function?
i put some logs, and saw "rm7pro" getting updated to either "rm7p " or "r 7pro".. it is even strangely updating the last saved ap ssid?
@tablatronix commented on GitHub (Apr 11, 2021):
It does not , sounds like a memory issue something is clobbering that memory
@tablatronix commented on GitHub (Apr 11, 2021):
Just do begin()
@shariq-azim commented on GitHub (Apr 12, 2021):
Hi there,
It definitely looks like memory issue.. But I was able to reconnect removing
if (WiFi.status() == WL_CONNECTED) { Serial.println( "connected once"); connected_once = true; }in main function..
And adding a while loop in loop function.
` if (WiFi.status() != WL_CONNECTED)
{
Serial.println("Re-attempting to connect");
WiFi.reconnect();
}
}`
But, my question remains "How to know if the credentials is reconfigured or how can we get the last saved AP(ssid) name"?
@tablatronix commented on GitHub (Apr 12, 2021):
you will want to add a timer for that probably, or else it will try on every loop when router is down or out of range
@tablatronix commented on GitHub (Apr 12, 2021):
WiFi.begin(); is all you need
you can get the ssid like you normally do for esps only diff with esp32 is it will be blank if wifi is not initialized yet ( remember no esp32 has no autoconnect)
@shariq-azim commented on GitHub (Sep 19, 2021):
Hello @tablatronix . I am late to properly understand and implement your suggestions. But , yes you are correct. Using Wifi.begin() instead of WiFi.reconnect() solved my issue.. Thanks
@shariq-azim commented on GitHub (Jun 2, 2023):
Hello @tablatronix , All this were still working well for a while and i also didnt check much to work on it.. Now all of a sudden when i thought to tweak it a little, i see the same issue coming up. the changes now done are just publishing into a new channel thats it.
My library version is 2.0.16-rc.2 now
@tablatronix commented on GitHub (Jun 3, 2023):
Yeah I had to disable some stuff you have have wifi init on esp32 to read the stored flash config
@shariq-azim commented on GitHub (Jun 3, 2023):
Sorry little confused what should i be doing?