mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-28 01:25:49 +03:00
[GH-ISSUE #1521] Clarify semantics of the "length" argument in WiFiManagerParameter #1297
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#1297
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 @alranel on GitHub (Nov 17, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1521
Hi! I like the WiFiManagerParameter feature very much.
I'm having some issues in understanding exactly the semantics of the "length" argument in constructor. Is it supposed to hold the maximum length of the acceptable parameter or the length of the supplied default char array?
If I call it this way, the parameter will not be displayed in the web portal:
(Also, can't you just call
strlen()on the supplied default to get its default instead of asking the caller?)If I call it this way, I'm getting an ESP exception:
If I call it this way, the parameter is not displayed in the web portal and I get an error on the console saying it is "out of scope" while it's not (here I think the "out of scope" logic is giving a false postive):
The only way I got it working is this one:
However this approach seems to defeat the purpose of WiFiManager supporting arbitrary length strings, and still requires me to update the char array with
strcpy(device_id, param.getValue())myself so I don't see why the library would force me to declare a static char array because I might want to use a different storage for the returned value.I would suggest to:
WiFiManagerParameter("device_id", "Device ID", "")is completely equivalent toWiFiManagerParameter("device_id", "Device ID")...unless I did not understand the intended usage of the library, in which case I am sorry in advance :)
@tablatronix commented on GitHub (Nov 28, 2022):
hmm let me check on this I do not this is correct behavior.