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/generic-class.rst
+34-24
Original file line number
Diff line number
Diff line change
@@ -51,9 +51,6 @@ Once ``WiFi.persistent(false)`` is called, ``WiFi.begin``, ``WiFi.disconnect``,
51
51
mode
52
52
~~~~
53
53
54
-
Regular WiFi modes
55
-
__________________
56
-
57
54
.. code:: cpp
58
55
59
56
bool mode(WiFiMode_t m)
@@ -65,25 +62,6 @@ Switches to one of the regular WiFi modes, where ``m`` is one of:
65
62
- ``WIFI_AP``: switch to `Access Point (AP) <readme.rst#soft-access-point>`__ mode.
66
63
- ``WIFI_AP_STA``: enable both Station (STA) and Access Point (AP) mode.
67
64
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.
84
-
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.
86
-
87
65
getMode
88
66
~~~~~~~
89
67
@@ -170,6 +148,40 @@ getPhyMode
170
148
171
149
Gets the WiFi radio phy mode that is currently set.
172
150
151
+
forceSleepBegin
152
+
~~~~~~~~~~~~~~~
153
+
154
+
.. code:: cpp
155
+
156
+
bool forceSleepBegin (uint32_t sleepUs=0)
157
+
bool forceSleepWake ()
158
+
159
+
Saves the currently set WiFi mode and starts forced modem sleep for the specified time (us)
160
+
161
+
forceSleepWake
162
+
~~~~~~~~~~~~~~
163
+
164
+
.. code:: cpp
165
+
166
+
bool forceSleepWake ()
167
+
168
+
Called after `forceSleepBegin()`. Restores the previous WiFi mode. Attemtps reconnection when STA was active.
Stores the STA interface IP configuration in the specified state struct and calls ``forceSleepBegin(sleepUs)``.
179
+
Restores STA interface configuration from the ``state`` and calls ``forceSleepWake()``.
180
+
181
+
These method is intended to be used in low-power scenarios, e.g. where ESP.deepSleep is used between actions to preserve battery power. It is the user's responsibility to preserve the WiFiState between ``shutdown()`` and ``resumeFromShutdown()`` by storing it in the RTC user data and/or flash memory.
182
+
183
+
See `WiFiShutdown.ino <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiShutdown/WiFiShutdown.ino>`__ for an example of usage.
184
+
173
185
Other Function Calls
174
186
~~~~~~~~~~~~~~~~~~~~
175
187
@@ -179,8 +191,6 @@ Other Function Calls
179
191
WiFiSleepType_t getSleepMode ()
180
192
bool enableSTA (bool enable)
181
193
bool enableAP (bool enable)
182
-
bool forceSleepBegin (uint32 sleepUs=0)
183
-
bool forceSleepWake ()
184
194
int hostByName (const char *aHostname, IPAddress &aResult)
0 commit comments