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
Improve resume speed by passing in last known BSSID
Provide a simpler example for WIFI_SHUTDOWN/WIFI_RESUME
Add documentation for WIFI_SHUTDOWN and WIFI_RESUME.
Copy file name to clipboardExpand all lines: doc/esp8266wifi/generic-class.rst
+34-8
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ For the SoftAP interface, when the interface is brought up, any servers should b
32
32
33
33
A detailed explanation of ``WiFiEventHandler`` can be found in the section with `examples :arrow\_right: <generic-examples.rst>`__ dedicated specifically to the Generic Class..
34
34
35
-
Alternatively, check the example sketch `WiFiEvents.ino <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiEvents/WiFiEvents.ino>`__ available inside examples folder of the ESP8266WiFi library.
35
+
Alternatively, check the example sketch `WiFiEvents.ino <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiEvents/WiFiEvents.ino>`__ available in the examples folder of the ESP8266WiFi library.
36
36
37
37
38
38
persistent
@@ -42,30 +42,56 @@ persistent
42
42
43
43
WiFi.persistent(persistent)
44
44
45
-
ESP8266 is able to reconnect to the last used Wi-Fi network or establishes the same Access Point upon power up or reset.
45
+
ESP8266 is able to reconnect to the last used WiFi network or establishes the same Access Point upon power up or reset.
46
46
By default, these settings are written to specific sectors of flash memory every time they are changed in ``WiFi.begin(ssid, passphrase)`` or ``WiFi.softAP(ssid, passphrase, channel)``, and when ``WiFi.disconnect`` or ``WiFi.softAPdisconnect`` is invoked.
47
47
Frequently calling these functions could cause wear on the flash memory (see issue `#1054 <https://github.com/esp8266/Arduino/issues/1054>`__).
48
48
49
-
Once ``WiFi.persistent(false)`` is called, ``WiFi.begin``, ``WiFi.disconnect``, ``WiFi.softAP``, or ``WiFi.softAPdisconnect`` only changes the current in-memory Wi-Fi settings, and does not affect the Wi-Fi settings stored in flash memory.
49
+
Once ``WiFi.persistent(false)`` is called, ``WiFi.begin``, ``WiFi.disconnect``, ``WiFi.softAP``, or ``WiFi.softAPdisconnect`` only changes the current in-memory WiFi settings, and does not affect the WiFi settings stored in flash memory.
50
50
51
51
mode
52
52
~~~~
53
53
54
+
Regular WiFi modes
55
+
__________________
56
+
54
57
.. code:: cpp
55
58
56
-
WiFi.mode(m)
59
+
bool mode(WiFiMode_t m)
60
+
61
+
Switches to one of the regular WiFi modes, where ``m`` is one of:
62
+
63
+
- ``WIFI_OFF``: turn WiFi off.
64
+
- ``WIFI_STA``: switch to `Station (STA) <readme.rst#station>`__ mode.
65
+
- ``WIFI_AP``: switch to `Access Point (AP) <readme.rst#soft-access-point>`__ mode.
66
+
- ``WIFI_AP_STA``: enable both Station (STA) and Access Point (AP) mode.
67
+
68
+
Pseudo-modes
69
+
____________
70
+
71
+
.. code:: cpp
72
+
73
+
bool mode(WiFiMode_t m, WiFiState* state)
74
+
75
+
Used with the following pseudo-modes, where ``m`` is one of:
76
+
77
+
- ``WIFI_SHUTDOWN``: Fills in the provided ``WiFiState`` structure, switches to ``WIFI_OFF`` mode and puts WiFi into forced sleep, preserving energy.
78
+
- ``WIFI_RESUME``: Turns WiFi on and tries to re-establish the WiFi connection stored in the ``WiFiState`` structure.
79
+
80
+
These modes are used in low-power scenarios, e.g. where ESP.deepSleep is used between actions to preserve battery power.
81
+
82
+
It is the user's responsibility to preserve the WiFiState between ``WIFI_SHUTDOWN`` and ``WIFI_RESUME``, e.g. by storing it
83
+
in RTC user data and/or flash memory.
57
84
58
-
- ``WiFi.mode(m)``: set mode to ``WIFI_AP``, ``WIFI_STA``,
59
-
``WIFI_AP_STA`` or ``WIFI_OFF``
85
+
There is an example sketch `WiFiShutdown.ino <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiShutdown/WiFiShutdown.ino>`__ available in the examples folder of the ESP8266WiFi library.
60
86
61
87
getMode
62
88
~~~~~~~
63
89
64
90
.. code:: cpp
65
91
66
-
WiFiMode_t WiFi.getMode()
92
+
WiFiMode_t getMode()
67
93
68
-
- ``WiFi.getMode()``: return current Wi-Fi mode (one out of four modes above)
94
+
Gets the current WiFi mode (one out of four regular modes above).
Copy file name to clipboardExpand all lines: doc/libraries.rst
+2-2
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
Libraries
2
2
=========
3
3
4
-
WiFi(ESP8266WiFi library)
5
-
-------------------------
4
+
WiFi(ESP8266WiFi library)
5
+
--------------------------
6
6
7
7
ESP8266WiFi library has been developed basing on ESP8266 SDK, using naming convention and overall functionality philosophy of the `Arduino WiFi Shield library <https://www.arduino.cc/en/Reference/WiFi>`__. Over time the wealth Wi-Fi features ported from ESP8266 SDK to this library outgrew the APIs of WiFi Shield library and it became apparent that we need to provide separate documentation on what is new and extra.
0 commit comments