mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1439] getWiFiIsSaved returning wrong value #1233
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#1233
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 @OekoSolveMG on GitHub (Jun 22, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1439
Basic Infos
Hardware
WiFimanager Branch / Release: v2.0.11-beta
Esp8266 / Esp32: ESP32
Hardware: M5 Stack Core 1
Core Version: 2.4.0, staging
Description
When the WiFi has not been completly initalized needs some time
WiFi_SSIDhas some trash data inconf.sta.ssid, which then gets converted into a String meaning the String isn't empty. CausinggetWiFiIsSavedto return true because the ssid isn't empty even tough there isn't any data saved.Underlying Problem
I debugged some more and the problem seems to be that the
esp_wifi_get_config()method always returnsESP_ERR_WIFI_NOT_INIT(WiFi driver was not installed by esp_wifi_init).This seems to be the problem becuase the autoConnect only initalizes the WiFiManager if the isWiFiSaved() method returns true. This method can't return true tough until WiFi has been initalized.
I tried to call
WiFi.begin();before attempting to reconnect. This will fix the issue because the esp has now initalized the wifi configuration.Serial log
Attempts to connect to the WiFi with saved credentials even tough there are none.
Simple fix
Instead of always returning the data converted into a string, which might cause issues see current code below:
WiFiManager.cpp / 3602
The library should instead check if getting the configuration was successfull in the first place and if not return an empty string. Similar to how it returns the value if the boolean flag
persistentisn't true.WiFiManager.cpp / 3602
@murmeltier08 commented on GitHub (Jan 31, 2023):
Same problem here. Please fix it :)
@tablatronix commented on GitHub (Jan 31, 2023):
This was removed already from the code
@murmeltier08 commented on GitHub (Feb 1, 2023):
but it not working before autoconnect. i need to check this flag in the beginning of the code.
@tablatronix commented on GitHub (Feb 1, 2023):
ahh yeah its not working at the moment I need to add wifiinit code, I was testing how to do it without causing delays in boot connect..
The easiest way is to just init wifi yourself in your code add a WiFi.mode(WIFI_STA); at the beginning. Another option is maybe we could read it directly from flash, but that changes now and then and would be a pita
esp32 IDF changed how this all works and its annoying
@Vitallyz commented on GitHub (Feb 25, 2023):
Hi! Is there any alternative way I can check if the drive is going to try to connect using the existing wifi config or if it will enter AP mode?
Or is there a way to know that we are going to enter (or entered) AP mode? Trying to show some info on the display of my device.
Thanks!
@tablatronix commented on GitHub (Mar 23, 2023):
Still thinking of how to fix this, now that the fatal wifi connect bugs in ESP seem to be fixed I can test wifiinit and try to optimize any connection delays from any change I make