Skip to content

WiFi config(): warning for legacy idioms #9050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more detailed comments
  • Loading branch information
d-a-v committed Dec 10, 2023
commit 7032cad2e71576d2b9e62d8b8044bc97f0c75274
14 changes: 7 additions & 7 deletions doc/esp8266wifi/station-class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ config

Disable `DHCP <https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol>`__ client (Dynamic Host Configuration Protocol) and set the IP configuration of station interface to user defined arbitrary values. The interface will be a static IP configuration instead of values provided by DHCP.

Note that to reenable DHCP, all three parameters as 0.0.0.0 (local_ip, gateway and subnet as ``INADDR_ANY``) must be passed back to config() and re-connecting is needed.
Note that to reenable DHCP, all three parameters (local_ip, gateway and subnet) as IPv4 ``0U`` (= 0.0.0.0) must be passed back to config() and re-connecting is needed.

.. code:: cpp

WiFi.config(local_ip, gateway, subnet) (discouraged, insufficiently accurate, for Arduino API portability)
WiFi.config(local_ip, gateway, subnet) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
WiFi.config(local_ip, gateway, subnet, dns1)
WiFi.config(local_ip, gateway, subnet, dns1, dns2)

Expand All @@ -126,14 +126,14 @@ For Arduino networking API compatibility, the ESP8266WiFi library supports IPv4-

.. code:: cpp

WiFi.config(local_ip) (discouraged, insufficiently accurate, for Arduino API portability)
WiFi.config(local_ip, dns) (discouraged, insufficiently accurate, for Arduino API portability)
WiFi.config(local_ip, dns, gateway) (discouraged, insufficiently accurate, for Arduino API portability)
WiFi.config(local_ip) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
WiFi.config(local_ip, dns) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
WiFi.config(local_ip, dns, gateway) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
WiFi.config(local_ip, dns, gateway, subnet)

Versions where some of ``dns``, ``gateway`` and ``subnet`` parameters are not specified use a default value. Default ``subnet`` is 255.255.255.0. Default ``gateway`` and ``dns`` are derived from ``local_ip`` by changing the last number to 1 (It is discouraged to use these default values as they may not apply to every network configuration).
Versions where some of ``dns``, ``gateway`` and ``subnet`` parameters are not specified use a default value. Default ``subnet`` is 255.255.255.0. Default ``gateway`` and ``dns`` are derived from ``local_ip`` by changing the last number to 1. It is discouraged to use these default values as they may not apply to every network configuration.

To return to DHCP you can use ``WiFi.config(INADDR_NONE);``.
Reminder : To reenable DHCP you can use ``WiFi.config(0U, 0U, 0U);``.

**Warning: The default values for dns, gateway and subnet may not match your router's settings.** Also please note, that ``config(local_ip, gateway)`` is not supported and ``WiFi.config(local_ip, gateway, subnet)`` doesn't set the DNS server IP.

Expand Down