mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 09:05:56 +03:00
[GH-ISSUE #957] Question: Use of Static IP #813
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#813
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 @lbussy on GitHub (Oct 22, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/957
Working in the development branch:
I found a reference (in a comment) in the script referring to using a static IP, and I also dug in the source code a bit:
github.com/tzapu/WiFiManager@9a85b107fa/examples/Advanced/Advanced.ino (L52)Am I correct in my understanding that to use this it should get set before calling
wm.autoConnect(ssid, pwd);and that doing so will auto-connect to the configured access point with that IP information instead of using WiFi.config(ip, gw, sn, dns);?I also saw:
The implication there is I don't have to set up custom fields to configure static IP and DNS (yay!). What's not clear is whether those fields autosave anywhere or if I need to save them manually. If the latter, how do I access the field values to save? If they are auto-saved, how do I access them initially to set the setSTAStaticIPConfig() call?
I looked through all the rest of the examples as well as chased it a bit through the source code but did not find my answer. The core documentation was likewise not helpful. I got as far as ESP8266WiFiGenericClass::persistent() and then got lost. Hopefully I didn't miss an obvious answer to this.
@lbussy commented on GitHub (Oct 23, 2019):
"Seems like" that's how it works - that
setShowStaticFields(true)will allow setting a static IP and thatsetShowDnsFields(true)allows setting a DNS server. Further, somehow,ESP8266WiFiGenericClass::persistent()saves that off automagically. It seems like there's no need to usesetSTAStaticIPConfig()when this is done.Hopefully, that's correct. It seems to work anyway.
@tablatronix commented on GitHub (Jun 13, 2021):
The esp will not remember static or ip info you will have to save it and restore it
@lbussy commented on GitHub (Jun 13, 2021):
Understood, thanks. I was just cleaning up an old issue.