Skip to content

Commit 6122465

Browse files
committedJul 26, 2018
Adding Notes in WiFi.begin docs (closes esp8266#4949)
* Also fixing formatting of unrelated link in station class docs.
1 parent ff74813 commit 6122465

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed
 

‎doc/esp8266wifi/station-class.rst

+21-19
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ By default, ESP will attempt to reconnect to Wi-Fi network whenever it is discon
6262
begin
6363
^^^^^
6464

65-
There are several versions (called *`function overloads <https://en.wikipedia.org/wiki/Function_overloading>`__* in C++) of ``begin`` function. One was presented just above:
65+
There are several versions (called `function overloads <https://en.wikipedia.org/wiki/Function_overloading>`__ in C++) of ``begin`` function. One was presented just above:
6666
``WiFi.begin(ssid, password)``. Overloads provide flexibility in number or type of accepted parameters.
6767

6868
The simplest overload of ``begin`` is as follows:
@@ -71,7 +71,9 @@ The simplest overload of ``begin`` is as follows:
7171
7272
WiFi.begin()
7373
74-
Calling it will instruct module to switch to the station mode and connect to the last used access point basing on configuration saved in flash memory.
74+
Calling it will enable station mode and connect to the last used access point based on configuration saved in flash memory.
75+
76+
Notes: \* It is possible that calling ``begin`` will result in the module being in STA + softAP mode if the module was previously placed into AP mode. \* If you notice strange behavior with DNS or other network functionality, check which mode your module is in (see ``WiFi.mode()`` in the `Generic Class Documentation <generic-class.rst#mode>`__).
7577

7678
Below is the syntax of another overload of ``begin`` with the all possible parameters:
7779

@@ -89,7 +91,7 @@ Disable `DHCP <https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
8991

9092
.. code:: cpp
9193
92-
WiFi.config(local_ip, gateway, subnet, dns1, dns2)
94+
WiFi.config(local_ip, gateway, subnet, dns1, dns2)
9395
9496
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.
9597

@@ -160,7 +162,7 @@ Reconnect the station. This is done by disconnecting from the access point an th
160162

161163
.. code:: cpp
162164
163-
WiFi.reconnect()
165+
WiFi.reconnect()
164166
165167
Notes: 1. Station should be already connected to an access point. If this is not the case, then function will return ``false`` not performing any action. 2. If ``true`` is returned it means that connection sequence has been successfully started. User should still check for connection status, waiting until ``WL_CONNECTED`` is reported:
166168

@@ -180,7 +182,7 @@ Sets currently configured SSID and password to ``null`` values and disconnects t
180182

181183
.. code:: cpp
182184
183-
WiFi.disconnect(wifioff)
185+
WiFi.disconnect(wifioff)
184186
185187
The ``wifioff`` is an optional ``boolean`` parameter. If set to ``true``, then the station mode will be turned off.
186188

@@ -191,7 +193,7 @@ Returns ``true`` if Station is connected to an access point or ``false`` if not.
191193

192194
.. code:: cpp
193195
194-
WiFi.isConnected()
196+
WiFi.isConnected()
195197
196198
setAutoConnect
197199
^^^^^^^^^^^^^^
@@ -200,7 +202,7 @@ Configure module to automatically connect on power on to the last used access po
200202

201203
.. code:: cpp
202204
203-
WiFi.setAutoConnect(autoConnect)
205+
WiFi.setAutoConnect(autoConnect)
204206
205207
The ``autoConnect`` is an optional parameter. If set to ``false`` then auto connection functionality up will be disabled. If omitted or set to ``true``, then auto connection will be enabled.
206208

@@ -222,7 +224,7 @@ Set whether module will attempt to reconnect to an access point in case it is di
222224

223225
.. code:: cpp
224226
225-
WiFi.setAutoReconnect(autoReconnect)
227+
WiFi.setAutoReconnect(autoReconnect)
226228
227229
If parameter ``autoReconnect`` is set to ``true``, then module will try to reestablish lost connection to the AP. If set to ``false`` then module will stay disconnected.
228230

@@ -235,7 +237,7 @@ Wait until module connects to the access point. This function is intended for mo
235237

236238
.. code:: cpp
237239
238-
WiFi.waitForConnectResult()
240+
WiFi.waitForConnectResult()
239241
240242
Function returns one of the following connection statuses: \* ``WL_CONNECTED`` after successful connection is established \* ``WL_NO_SSID_AVAIL``\ in case configured SSID cannot be reached \* ``WL_CONNECT_FAILED`` if password is incorrect \* ``WL_IDLE_STATUS`` when Wi-Fi is in process of changing between statuses \* ``WL_DISCONNECTED`` if module is not configured in station mode
241243

@@ -249,7 +251,7 @@ Get the MAC address of the ESP station's interface.
249251

250252
.. code:: cpp
251253
252-
WiFi.macAddress(mac)
254+
WiFi.macAddress(mac)
253255
254256
Function should be provided with ``mac`` that is a pointer to memory location (an ``uint8_t`` array the size of 6 elements) to save the mac address. The same pointer value is returned by the function itself.
255257

@@ -274,7 +276,7 @@ If you do not feel comfortable with pointers, then there is optional version of
274276

275277
.. code:: cpp
276278
277-
WiFi.macAddress()
279+
WiFi.macAddress()
278280
279281
*Example code:*
280282

@@ -292,7 +294,7 @@ Function used to obtain IP address of ESP station's interface.
292294

293295
.. code:: cpp
294296
295-
WiFi.localIP()
297+
WiFi.localIP()
296298
297299
The type of returned value is `IPAddress <https://github.com/esp8266/Arduino/blob/master/cores/esp8266/IPAddress.h>`__. There is a couple of methods available to display this type of data. They are presented in examples below that cover description of ``subnetMask``, ``gatewayIP`` and ``dnsIP`` that return the IPAdress as well.
298300

@@ -399,7 +401,7 @@ The hostname may be changed using the following function:
399401

400402
.. code:: cpp
401403
402-
WiFi.hostname(aHostname)
404+
WiFi.hostname(aHostname)
403405
404406
Input parameter ``aHostname`` may be a type of ``char*``, ``const char*`` or ``String``. Maximum length of assigned hostname is 32 characters. Function returns either ``true`` or ``false`` depending on result. For instance, if the limit of 32 characters is exceeded, function will return ``false`` without assigning the new hostname.
405407

@@ -427,7 +429,7 @@ Return the status of Wi-Fi connection.
427429
428430
WiFi.status()
429431
430-
Function returns one of the following connection statuses:
432+
Function returns one of the following connection statuses:
431433

432434
- ``WL_CONNECTED`` after successful connection is established
433435
- ``WL_NO_SSID_AVAIL`` in case configured SSID cannot be reached
@@ -531,7 +533,7 @@ Below is similar function, but returning BSSID but as a ``String`` type.
531533

532534
.. code:: cpp
533535
534-
WiFi.BSSIDstr()
536+
WiFi.BSSIDstr()
535537
536538
*Example code:*
537539

@@ -552,7 +554,7 @@ Return the signal strength of Wi-Fi network, that is formally called `Received S
552554

553555
.. code:: cpp
554556
555-
WiFi.RSSI()
557+
WiFi.RSSI()
556558
557559
Signal strength value is provided in dBm. The type of returned value is ``int32_t``.
558560

@@ -615,7 +617,7 @@ Depending on connection result function returns either ``true`` or ``false`` (``
615617

616618
::
617619

618-
Wi-Fi mode set to WIFI_STA
620+
Wi-Fi mode set to WIFI_STA
619621
Begin WPS (press WPS button on your router) ... Success
620622
.........
621623
Connected, IP address: 192.168.1.102
@@ -631,7 +633,7 @@ Start smart configuration mode by sniffing for special packets that contain SSID
631633

632634
.. code:: cpp
633635
634-
beginSmartConfig()
636+
beginSmartConfig()
635637
636638
Query Smart Config status, to decide when stop configuration. Function returns either ``true`` or ``false of``\ boolean\` type.
637639

@@ -643,6 +645,6 @@ Stop smart config, free the buffer taken by ``beginSmartConfig()``. Depending on
643645

644646
.. code:: cpp
645647
646-
stopSmartConfig()
648+
stopSmartConfig()
647649
648650
For additional details regarding Smart Config please refer to `ESP8266 API User Guide <http://bbs.espressif.com/viewtopic.php?f=51&t=1023>`__.

0 commit comments

Comments
 (0)