From 039026995a83c273db718cadc5542131e202ffe4 Mon Sep 17 00:00:00 2001 From: dnc40085 Date: Sun, 16 Apr 2017 10:38:08 -0700 Subject: [PATCH] Update wifi suspend documentation (#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() --- docs/en/modules/wifi.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/en/modules/wifi.md b/docs/en/modules/wifi.md index 42c25699..c16288e3 100644 --- a/docs/en/modules/wifi.md +++ b/docs/en/modules/wifi.md @@ -3,6 +3,10 @@ | :----- | :-------------------- | :---------- | :------ | | 2015-05-12 | [Zeroday](https://github.com/funshine) | [dnc40085](https://github.com/dnc40085) | [wifi.c](../../../app/modules/wifi.c)| +!!! important + 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. + + The NodeMCU WiFi control is spread across several tables: - `wifi` for overall WiFi configuration @@ -78,6 +82,10 @@ The current physical mode as one of `wifi.PHYMODE_B`, `wifi.PHYMODE_G` or `wifi. Wake up WiFi from suspended state or cancel pending wifi suspension +!!! note + 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) + The resume callback also occurs asynchronously and will only execute after wifi has resumed normal operation. + #### Syntax `wifi.resume([resume_cb])` @@ -257,7 +265,10 @@ none Suspend Wifi to reduce current consumption. -This function is also useful for preventing WiFi stack related crashes when executing functions or tasks that take longer than ~500ms +!!! note + 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) + The suspend callback also occurs asynchronously and will only execute after wifi has been successfully been suspended. + #### Syntax `wifi.suspend({duration[, suspend_cb, resume_cb, preserve_mode]})`