LwipIntfDev - disconnect()/end() should not clear static IP settings #1866
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.
when I wrote the test sketch for WiFi libraries I wanted to do
begin
with DHCP, thenbegin
with static IP and then againbegin
with DHCP. I thought thatdisconnect()
should clear the static IP for return to DHCP, but it turned out that all libraries I tested preserved the static IP settings over disconnect() (except my WiFiEspAT). I learned that the right way to return to DHCP isconfig(0)
orconfig(INADDR_NONE)
. And this really worked in all libraries and in modern Ethernet libraries (the ones withconfig
) too.So the user of the library can config the static IP and then
disconnect
and laterbegin
again with the same static IP.Now WiFiTest and ModernEthernetTest do an additional begin/disconnect to test if the library preserves the static IP over
disconnect
. And they reported the your library resets the static IP indisconnect()
/end()
.The fix is easy and with the previous PR with the
config
with one and two parameters, the config(INADDR_NONE) works to return to DHCP.The tests are:
WiFiTest
ModernEthernetTest