You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/esp8266wifi/station-class.rst
+9-7
Original file line number
Diff line number
Diff line change
@@ -99,11 +99,11 @@ config
99
99
100
100
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.
101
101
102
-
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.
102
+
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.
103
103
104
104
.. code:: cpp
105
105
106
-
WiFi.config(local_ip, gateway, subnet)
106
+
WiFi.config(local_ip, gateway, subnet) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
@@ -122,16 +122,18 @@ The following IP configuration may be provided:
122
122
(like e.g. *www.google.co.uk*) and translate them for us to IP
123
123
addresses
124
124
125
-
For Arduino networking API compatibilty the ESP8266WiFi library supports for IPv4 additional versions of the ``config`` function.
125
+
For Arduino networking API compatibility, the ESP8266WiFi library supports IPv4-only additional versions of the ``config`` function:
126
126
127
127
.. code:: cpp
128
128
129
-
WiFi.config(local_ip)
130
-
WiFi.config(local_ip, dns)
131
-
WiFi.config(local_ip, dns, gateway)
129
+
WiFi.config(local_ip) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
130
+
WiFi.config(local_ip, dns) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
131
+
WiFi.config(local_ip, dns, gateway) (for Arduino API portability, discouraged as chosen defaults may not match the local network configuration)
132
132
WiFi.config(local_ip, dns, gateway, subnet)
133
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);``.
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. It is discouraged to use these default values as they may not apply to every network configuration.
135
+
136
+
Reminder : To reenable DHCP you can use ``WiFi.config(0U, 0U, 0U);``.
135
137
136
138
**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.
Copy file name to clipboardExpand all lines: libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h
+1
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,7 @@ class ESP8266WiFiSTAClass: public LwipIntf {
49
49
50
50
// two and one parameter version. 2nd parameter is DNS like in Arduino
51
51
// IPv4 only
52
+
[[deprecated("It is discouraged to use this 1 or 2 parameters network configuration legacy function config(ip[,dns]) as chosen defaults may not match the local network configuration")]]
52
53
boolconfig(IPAddress local_ip, IPAddress dns = INADDR_ANY);
0 commit comments