mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #528] Connection result feedback in STA #442
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#442
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 @gepd on GitHub (Feb 18, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/528
From #513
Requesting an option to display the reason why the connection wasn't able to be performed in the last try (STA mode). You will no always have access to read the debug output.
What could be the best way to implement this?
EEPROM, SPIFFS?
@tablatronix
Can be a lifetime variable
I was thinking in storing it because how will you know the connection result after a possible reset?
@tablatronix commented on GitHub (Feb 18, 2018):
True but I dont have the library doing resets anymore. That typically is not needed after 2.1.0 i think. Unless you mean uexpected resets?
@gepd commented on GitHub (Feb 18, 2018):
Yes, I mean assuming that it happens.
I don't know if it will ever happen or if storing it will be really useful. Today I just needed to know the reason why it wasn't connecting
@tablatronix commented on GitHub (Feb 18, 2018):
ok I added this easiest as possible, so let me know if its not specific enough.
caveats
If this is not satisfactory, I can change to getLastConxFailure, and add if(!WL_CONNECTED) conditions and only log failures, I wasn't sure if that was needed.
I made
getWLStatusString()public alsoalso I am just using uint8_t instead of wl_status_t, just cause all the internals would have to be changed, and it probably doesn't matter
@gepd commented on GitHub (Feb 18, 2018):
I was doing something similar, and I can say now there is no need to store the result value.
I'll check your implementation, in my tests I was getting the value from
waitForConnectResultand then I shown it when I was in AP mode again.I guess, know if the problem was the ssid or password will be enough in most of the cases.
@tablatronix commented on GitHub (Feb 18, 2018):
also note
afaik STATION_WRONG_PASSWORD is not implemented in SDK last time I checked.
that is why
WL_CONNECT_FAILEDis used for bothSTATION_CONNECT_FAILandSTATION_WRONG_PASSWORD@gepd commented on GitHub (Feb 19, 2018):
What do you think to add this value in
HTTP_STATUS_OFF? But only when SSID or password is wrong@tablatronix commented on GitHub (Feb 19, 2018):
Not sure I understand
@gepd commented on GitHub (Feb 19, 2018):
I mean, at this moment you have a message info showing the state of the network.
When it's not connected (HTTP_STATUS_OFF), it only shows
**Not Connected** to networkname.It would be more useful to display
But only if
WL_NO_SSID_AVAILorWL_CONNECT_FAILED@tablatronix commented on GitHub (Feb 19, 2018):
hmm, good idea
@tablatronix commented on GitHub (Feb 19, 2018):
It looks like esp32 doesnt give much info on failure, just disconnected, ill keep looking but i didnt even see any useful events in the event system
@gepd commented on GitHub (Feb 20, 2018):
I've tested your last changes and
WL_NO_SSID_AVAILworks as expected, with a wrong password I only getWL_CONNECT_FAILEDIs the
WL_STATION_WRONG_PASSWORDflag recently introduced by espressif?@tablatronix commented on GitHub (Feb 20, 2018):
In esp8266 it has always been there but not working. There is no equiv in esp32, there is an auth fail, but i only see it triggered when ap doesnt exist not on password falure, in fact i see no events for wrong password, just the default which is disconnected.
@tablatronix commented on GitHub (Feb 20, 2018):
I tried debugging the reasoncodes and got nothing
@gepd commented on GitHub (Feb 20, 2018):
I got it, the event needs an extra argument to get the reason:
@tablatronix commented on GitHub (Feb 20, 2018):
I just commited that, lol
The question now is how the fuck do you use this to do anything since its a static member function pointer..
I also spent most of my time debugging this damn thing, since nothing was making sense in debug logs
https://github.com/espressif/arduino-esp32/issues/1128
Earlier today , I got no meaning ful codes, today on another dev machine and network I was able to test all of this, and got logical reason codes.
@tablatronix commented on GitHub (Feb 20, 2018):
oddly sometimes I get no events at all, which seems odd, even if the router was not compatible or adhoc, I would think it would fire something.
@tablatronix commented on GitHub (Feb 20, 2018):
ok I just hacked it in using a
static uint8_t _lastconxresulttmp;and copying it into_lastconxresulttmpas needed. Should work for now.@tablatronix commented on GitHub (Feb 20, 2018):
sometimes I get this instead
not sure if this counts as wrong_password or not, probably not
@gepd commented on GitHub (Feb 20, 2018):
I think it does. When I set a wrong pass I always get:
@tablatronix commented on GitHub (Feb 20, 2018):
But this is WL_DISCONNECTED not WL_CONNECT_FAILED
hmm
It seem to be a uncaught event, if i set the password correct it connects, so it is a auth failure, not sure why the wl status is wrong
@tablatronix commented on GitHub (Feb 20, 2018):
oh ok i see now
This is changing the event status to disconnect, because it is auto reconnecting and losing the event somehow
@tablatronix commented on GitHub (Feb 20, 2018):
I am trying to propose a fix for this, but I cannot figure out why this only runs 3 times, and not in a loop.
if WIFI_REASON_AUTH_EXPIRE status never gets updated, and there is no other event to stop the loop, so why does it only run 3 times ?
@tablatronix commented on GitHub (Feb 20, 2018):
ohhh duh, i never actually looked at this code
waitforconnectresult is the only thing preventing infinite loops in the event handler.. ugh
while((!status() || status() >= WL_DISCONNECTED) && i++ < 100) {
@tablatronix commented on GitHub (Feb 20, 2018):
Yeah so this actually runs forever, unless you change the mode which we do. hmm
@tablatronix commented on GitHub (Feb 20, 2018):
well anyways, auto_expire could be auth took too long and other reasons, so it is probably not a good idea to tell users wrong password unless we know it for certain
@tablatronix commented on GitHub (Feb 20, 2018):
https://github.com/espressif/arduino-esp32/issues/234
@tablatronix commented on GitHub (Feb 20, 2018):
I suppose we could change wrong password to "Auth Failure" to cover more bases
@gepd commented on GitHub (Feb 20, 2018):
Yes, It may be better.
I tried the latest changes and all seems to be working well