WiFi.config handle Arduino parameters ordering and auto dns,gw,mask #8892
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In WiFi libraries by Arduino
config
has parametersip, dnsIP, gatewayIP, subnet
. only ip is not optional. for unspecified subnet default is 255.255.255.0 and unspecified gateway and dns are based on IP with last number changed to 1.the ESP8266WiFi library accepts the 'esp\ ordering ip, gw, subnet, dns and Arduino ordering ip, dns, gw, subnet. The detection is based on the position of the subnet mask which has 255 as first number.
This PR adds handling of Arduino ordering of parameters. Parameter subnet is on position of dns1 which is an optional parameter so default value is used if needed.
And this PR adds a second
config
with two parameters local_ip and dns IP. dns IP is optional. gateway IP is calculated, dns IP is calculated if not provided. then the otherconfig
is invoked.this allows
config
invocations as in Arduino libraryit also allows
WiFi.config(INADDR_NONE)
to return to DHCP as in other WiFi libraries.overview of WiFi object API in significant libraries:
https://github.com/JAndrassy/Arduino-Networking-API/blob/main/ArduinoNetAPILibs.md#wifi-station-network-interface