mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #789] Adding new/additional WiFiParam to existing App causes crash at configuration #660
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#660
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 @gduprey on GitHub (Dec 19, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/789
Basic Infos
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
Description
I have an existing app with no parameters (no WiFiManagerParameters). Configuration works great (using either autoConnect() or startConfigPortal()). I then add a single new parameter to the application, flash it and when I try to connect to the the config portal, the ESP crashes (below).
If I flash the code with the new parameter but do NOT enter the config portal (i.e. use previously stored WiFi settings), everything works (no crash).
If I add a resetSettings() call, then things work fine (I can connect, configure WiFi and see the parameter in the portal and save). But if I store settings and then reboot the chip and re-enter config mode (startConfigPortal()), when I attempt to connect to the ESP AP, it crashes again.
If I remove the parameter, everything works as expected (I can configure and reconfigure many times with no crashes).
The crash happens after the config portal appears as an AP, at the moment you attempt to connect to it (and by connect, I mean join the AP's SSID from my phones WiFi settings page). So you never get a chance to even attempt to view the actual config portal web page with a browser - the WiFi connection alone initiates the crash.
I'm running on an ESP32/WROVER using the development branch WiFiManager.
Settings in IDE
Module: ESP32 WROVER
Additional libraries:
Sketch
Debug Messages
@pieman64 commented on GitHub (Dec 19, 2018):
@gduprey did you look at an example with parameters as your sketch looks to be missing quite a bit of code?
@gduprey commented on GitHub (Dec 19, 2018):
I stripped the code down to a very minimal example (that still demonstrates the problem).
@pieman64 commented on GitHub (Dec 19, 2018):
Parameters appear 2 or 3 times in the example code. Try one of them.
@gduprey commented on GitHub (Dec 19, 2018):
Yep - the block I pasted was stripped down, but was not the final one (missed a define and two variables). I have that and will post/edit the above when I get back home later today.
There may also be some interaction with the Arduino preferences API - I need to play with a few configs there too as something seems a little off (but not reliably, of course...)
@gduprey commented on GitHub (Dec 19, 2018):
Well, I'm embarrassed. Its not WiFiManager.
In the process of trimming things down and trying to make an oh-so-perfect report, I cut out (partially) use of the Preferences API. It appears that use of Preferences is not compatible with something in the WiFi system (I assume, the code that keeps/restores the last SSID/Password).
I did insure that I created my own instance of the Preferences object and I used a custom name space that could not conflict with any other used name space.
Might be worth a mention that you cannot use the Preference API with WiFi (again, not a WiFiManager issue, but the support for WiFIManagerParameter is going to encourage someone else to use Preferences to keep/store values for it).
Sorry for the noise.
@tablatronix commented on GitHub (Dec 19, 2018):
what is preferences API ?
@gduprey commented on GitHub (Dec 19, 2018):
Arduino-esp has a Preferences API that just overlays the underlying ESP32 nvm_* functions. It's just a thin "skin" over them. The nvs_* stuff abstracts some flash space into a key/value store for simple stuff and apparently, the underlying WiFi stuff uses the same stuff for storing the last ssid/password combo.
I don't quite understand why they conflict, but they definitely do.
In my case, I had a small number of configurable fields. I was storing their value in the nvs/Preference because it was only 3 fields and didn't seem worth the overhead of creating/parsing/writing a JSON file. So I'd open Preferences, read last saved values, if any, feed those into WiFiManagerParameters and then on the flip side, read those parameter values and store then via Preferences.
Nice a clean and small, but at least right now, not working
Heres a link to the Preferences API
@tablatronix commented on GitHub (Dec 19, 2018):
interesting, this must be new, I will check it out, pretty cool