Skip to content

Commit 66975c2

Browse files
dnc40085Konrad Eisele
authored and
Konrad Eisele
committed
Update wifi suspend documentation (nodemcu#1910)
* Added message about potential for wifi crashes and more Added message about potential for wifi crashes caused by long running functions Modified description for wifi.resume() and wifi.suspend()
1 parent 3fda0d0 commit 66975c2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/en/modules/wifi.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
| :----- | :-------------------- | :---------- | :------ |
44
| 2015-05-12 | [Zeroday](https://github.com/funshine) | [dnc40085](https://github.com/dnc40085) | [wifi.c](../../../app/modules/wifi.c)|
55

6+
!!! important
7+
The WiFi subsystem is maintained by background tasks that must run periodically. Any function or task that takes longer than 15ms (milliseconds) may cause the WiFi subsystem to crash. To avoid these potential crashes, it is advised that the WiFi subsystem be suspended with [wifi.suspend()](#wifisuspend) prior to the execution of any tasks or functions that exceed this 15ms guideline.
8+
9+
610
The NodeMCU WiFi control is spread across several tables:
711

812
- `wifi` for overall WiFi configuration
@@ -78,6 +82,10 @@ The current physical mode as one of `wifi.PHYMODE_B`, `wifi.PHYMODE_G` or `wifi.
7882

7983
Wake up WiFi from suspended state or cancel pending wifi suspension
8084

85+
!!! note
86+
Wifi resume occurs asynchronously, this means that the resume request will only be processed when control of the processor is passed back to the SDK (after MyResumeFunction() has completed)
87+
The resume callback also occurs asynchronously and will only execute after wifi has resumed normal operation.
88+
8189
#### Syntax
8290
`wifi.resume([resume_cb])`
8391

@@ -257,7 +265,10 @@ none
257265

258266
Suspend Wifi to reduce current consumption.
259267

260-
This function is also useful for preventing WiFi stack related crashes when executing functions or tasks that take longer than ~500ms
268+
!!! note
269+
Wifi suspension occurs asynchronously, this means that the suspend request will only be processed when control of the processor is passed back to the SDK (after MySuspendFunction() has completed)
270+
The suspend callback also occurs asynchronously and will only execute after wifi has been successfully been suspended.
271+
261272

262273
#### Syntax
263274
`wifi.suspend({duration[, suspend_cb, resume_cb, preserve_mode]})`

0 commit comments

Comments
 (0)