mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1590] Example for custom parameters #1357
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#1357
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 @probonopd on GitHub (Apr 16, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1590
Documentation says
I think there should be an example showing how to actually do this. Something like this:
@Halvhjearne commented on GitHub (Apr 27, 2023):
this was super usefull.
however i could be wrong but i think i think the way you do it there, the device will write to the flash on every reboot if im not mistaken.
maybe it would be better to have the saveConfigCallback change a bool to true and then put line 55-59 inside an if statement that triggers from said bool?
i did not test this ...
@tablatronix commented on GitHub (Apr 27, 2023):
There are already examples for spiffs and an empty one for littlefs, they can probably be cleaned up
@probonopd commented on GitHub (Apr 27, 2023):
Where? I can't seem to find them on https://github.com/tzapu/WiFiManager/wiki/Examples.
@tablatronix commented on GitHub (Apr 27, 2023):
https://github.com/tzapu/WiFiManager/tree/master/examples/Parameters
@probonopd commented on GitHub (Apr 29, 2023):
Thanks, maybe it should be linked from https://github.com/tzapu/WiFiManager/wiki/Examples.
@msx80 commented on GitHub (May 31, 2023):
I for one think the example provided here is interesting and useful enougth to grant inclusion in the Examples or at least in the example wiki page.
The Preferences machinery is much more suitable for saving the kind of parameters handled by WifiManager than LittleFS or SPIFF, where you have to deal with file operations (open, read, write etc) and/or json parsing. Small, short values are exacly what Preferences is about and it's way more elegant and clear.
One could even go as far as to argue it could be the default way of saving data, integrated directly into WifiManager, but that's for another discussion.
@tablatronix commented on GitHub (May 31, 2023):
Sorry I didn't even see the example, I will take a look. I personally use structs and just save/read them from flash or wherever.
I intended for someone to make a wrapper for params to do this, there can be different subclasses for params/FS, and you can add input types etc. See the child class example. Someone in issues helped create that for interating params programatically, and I might have to fix some of the ID issues
What is preferences.h?
I have no issue including better functionality, but I really do not want any FS stuff in WM if its not abstracted, someone will want to save to SD card or PSRAM or spi flash something etc
@msx80 commented on GitHub (Jun 12, 2023):
It's a default preference storing functionality for ESP32. It doesn't require installing a library, it's part of the package distribution.
But there's a compatible library that's a drop-in replacement for various other boards, like other ESP, various Arduinos and RP2040.
"Preferences" are actually the most abstracted persistent memory access technology. The default ESP32 one uses Non-Volatile-Storage, the compatible library uses a variety of FS systems depending on the underlying platform. All with the same interface.
@tablatronix commented on GitHub (Jun 12, 2023):
I have never heard of it, thanks.
@jonathanendersby commented on GitHub (Aug 5, 2023):
@tzapu These examples should be in the actual repo. They are clean and work!