Skip to content

Commit ce21084

Browse files
authored
document WiFi.config Arduino parameters versions (#9045)
1 parent 71764d2 commit ce21084

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/esp8266wifi/station-class.rst

+15
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Note that to reenable DHCP, all three parameters as 0.0.0.0 (local_ip, gateway a
103103

104104
.. code:: cpp
105105
106+
WiFi.config(local_ip, gateway, subnet)
107+
WiFi.config(local_ip, gateway, subnet, dns1)
106108
WiFi.config(local_ip, gateway, subnet, dns1, dns2)
107109
108110
Function will return ``true`` if configuration change is applied successfully. If configuration can not be applied, because e.g. module is not in station or station + soft access point mode, then ``false`` will be returned.
@@ -120,6 +122,19 @@ The following IP configuration may be provided:
120122
(like e.g. *www.google.co.uk*) and translate them for us to IP
121123
addresses
122124

125+
For Arduino networking API compatibilty the ESP8266WiFi library supports for IPv4 additional versions of the ``config`` function.
126+
127+
.. code:: cpp
128+
129+
WiFi.config(local_ip)
130+
WiFi.config(local_ip, dns)
131+
WiFi.config(local_ip, dns, gateway)
132+
WiFi.config(local_ip, dns, gateway, subnet)
133+
134+
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. To return to DHCP you can use ``WiFi.config(INADDR_NONE);``.
135+
136+
**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.
137+
123138
*Example code:*
124139

125140
.. code:: cpp

0 commit comments

Comments
 (0)