Skip to content

Commit 1ed7bee

Browse files
yoursunnydevyte
authored andcommitted
doc: improve WiFi.persistent documentation (#5081)
fixes #3641
1 parent 9634f79 commit 1ed7bee

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

Diff for: doc/esp8266wifi/generic-class.rst

+26-30
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ onEvent
1010

1111
.. code:: cpp
1212
13-
void onEvent (WiFiEventCb cb, WiFiEvent_t event=WIFI_EVENT_ANY) __attribute__((deprecated))
13+
void onEvent (WiFiEventCb cb, WiFiEvent_t event=WIFI_EVENT_ANY) __attribute__((deprecated))
1414
1515
To see how to use ``onEvent`` please check example sketch `WiFiClientEvents.ino <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino>`__ available inside examples folder of the ESP8266WiFi library.
1616

@@ -19,13 +19,13 @@ WiFiEventHandler
1919

2020
.. code:: cpp
2121
22-
WiFiEventHandler onStationModeConnected (std::function< void(const WiFiEventStationModeConnected &)>)
23-
WiFiEventHandler onStationModeDisconnected (std::function< void(const WiFiEventStationModeDisconnected &)>)
24-
WiFiEventHandler onStationModeAuthModeChanged (std::function< void(const WiFiEventStationModeAuthModeChanged &)>)
25-
WiFiEventHandler onStationModeGotIP (std::function< void(const WiFiEventStationModeGotIP &)>)
26-
WiFiEventHandler onStationModeDHCPTimeout (std::function< void(void)>)
27-
WiFiEventHandler onSoftAPModeStationConnected (std::function< void(const WiFiEventSoftAPModeStationConnected &)>)
28-
WiFiEventHandler onSoftAPModeStationDisconnected (std::function< void(const WiFiEventSoftAPModeStationDisconnected &)>)
22+
WiFiEventHandler onStationModeConnected (std::function< void(const WiFiEventStationModeConnected &)>)
23+
WiFiEventHandler onStationModeDisconnected (std::function< void(const WiFiEventStationModeDisconnected &)>)
24+
WiFiEventHandler onStationModeAuthModeChanged (std::function< void(const WiFiEventStationModeAuthModeChanged &)>)
25+
WiFiEventHandler onStationModeGotIP (std::function< void(const WiFiEventStationModeGotIP &)>)
26+
WiFiEventHandler onStationModeDHCPTimeout (std::function< void(void)>)
27+
WiFiEventHandler onSoftAPModeStationConnected (std::function< void(const WiFiEventSoftAPModeStationConnected &)>)
28+
WiFiEventHandler onSoftAPModeStationDisconnected (std::function< void(const WiFiEventSoftAPModeStationDisconnected &)>)
2929
3030
To see a sample application with ``WiFiEventHandler``, please check separate section with `examples :arrow\_right: <generic-examples.rst>`__ dedicated specifically to the Generic Class..
3131

@@ -34,25 +34,21 @@ persistent
3434

3535
.. code:: cpp
3636
37-
WiFi.persistent (persistent)
37+
WiFi.persistent(persistent)
3838
39-
Module is able to reconnect to last used Wi-Fi network on power up or reset basing on settings stored in specific sectors of flash memory. By default these settings are written to flash each time they are used in functions like ``WiFi.begin(ssid, password)``. This happens no matter if SSID or password has been actually changed.
39+
ESP8266 is able to reconnect to the last used Wi-Fi network or establishes the same Access Point upon power up or reset.
40+
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.
41+
Frequently calling these functions could cause wear on the flash memory (see issue `#1054 <https://github.com/esp8266/Arduino/issues/1054>`__).
4042

41-
This might result in some wear of flash memory depending on how often such functions are called.
42-
43-
Setting ``persistent`` to ``false`` will get SSID / password written to flash only if currently used values do not match what is already stored in flash.
44-
45-
Please note that functions ``WiFi.disconnect`` or ``WiFi.softAPdisconnect`` reset currently used SSID / password. If ``persistent`` is set to ``false``, then using these functions will not affect SSID / password stored in flash.
46-
47-
To learn more about this functionality, and why it has been introduced, check issue report `#1054 <https://github.com/esp8266/Arduino/issues/1054>`__.
43+
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.
4844

4945
mode
5046
~~~~
5147

5248
.. code:: cpp
5349
54-
WiFi.mode(m)
55-
WiFi.getMode()
50+
WiFi.mode(m)
51+
WiFi.getMode()
5652
5753
- ``WiFi.mode(m)``: set mode to ``WIFI_AP``, ``WIFI_STA``,
5854
``WIFI_AP_STA`` or ``WIFI_OFF``
@@ -64,17 +60,17 @@ Other Function Calls
6460

6561
.. code:: cpp
6662
67-
int32_t channel (void)
68-
bool setSleepMode (WiFiSleepType_t type)
69-
WiFiSleepType_t getSleepMode ()
70-
bool setPhyMode (WiFiPhyMode_t mode)
71-
WiFiPhyMode_t getPhyMode ()
72-
void setOutputPower (float dBm)
73-
WiFiMode_t getMode ()
74-
bool enableSTA (bool enable)
75-
bool enableAP (bool enable)
76-
bool forceSleepBegin (uint32 sleepUs=0)
77-
bool forceSleepWake ()
63+
int32_t channel (void)
64+
bool setSleepMode (WiFiSleepType_t type)
65+
WiFiSleepType_t getSleepMode ()
66+
bool setPhyMode (WiFiPhyMode_t mode)
67+
WiFiPhyMode_t getPhyMode ()
68+
void setOutputPower (float dBm)
69+
WiFiMode_t getMode ()
70+
bool enableSTA (bool enable)
71+
bool enableAP (bool enable)
72+
bool forceSleepBegin (uint32 sleepUs=0)
73+
bool forceSleepWake ()
7874
int hostByName (const char *aHostname, IPAddress &aResult)
7975
8076
Documentation for the above functions is not yet prepared.

0 commit comments

Comments
 (0)