From 2dc0ee4035d12566424d4fa3eb187de66faaf6a9 Mon Sep 17 00:00:00 2001 From: dnc40085 Date: Sat, 24 Mar 2018 03:27:00 -0700 Subject: [PATCH] Fixed error in documentation for node.sleep() --- app/pm/pmSleep.c | 10 +++++++--- docs/en/modules/node.md | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/pm/pmSleep.c b/app/pm/pmSleep.c index 94528868e5..d1774fc196 100644 --- a/app/pm/pmSleep.c +++ b/app/pm/pmSleep.c @@ -3,6 +3,8 @@ #define STRINGIFY_VAL(x) #x #define STRINGIFY(x) STRINGIFY_VAL(x) +//TODO: figure out why timed light_sleep doesn't work + //holds duration error string //uint32 PMSLEEP_SLEEP_MAX_TIME=FPM_SLEEP_MAX_TIME-1; const char *PMSLEEP_DURATION_ERR_STR="duration: 0 or "STRINGIFY(PMSLEEP_SLEEP_MIN_TIME)"-"STRINGIFY(PMSLEEP_SLEEP_MAX_TIME)" us"; @@ -219,9 +221,11 @@ int pmSleep_parse_table_lua( lua_State* L, int table_idx, pmSleep_param_t *cfg, return luaL_argerror( L, table_idx, "wake_pin: must be number" ); } } - else if(cfg->sleep_duration == 0){ - return luaL_argerror( L, table_idx, "wake_pin: must specify pin if sleep duration is indefinite" ); - } + else{ + return luaL_argerror( L, table_idx, "wake_pin: must specify pin" ); +// else if(cfg->sleep_duration == 0){ +// return luaL_argerror( L, table_idx, "wake_pin: must specify pin if sleep duration is indefinite" ); + } lua_pop(L, 1); lua_getfield(L, table_idx, "int_type"); diff --git a/docs/en/modules/node.md b/docs/en/modules/node.md index aefbeb0ad6..2e19de48ae 100644 --- a/docs/en/modules/node.md +++ b/docs/en/modules/node.md @@ -333,16 +333,16 @@ Put NodeMCU in light sleep mode to reduce current consumption. * NodeMCU can not enter light sleep mode if wifi is suspended. * All active timers will be suspended and then resumed when NodeMCU wakes from sleep. -* Any previously suspended timers will be resumed when NodeMCU wakes from sleep. !!! attention This is disabled by default. Modify `PMSLEEP_ENABLE` in `app/include/user_config.h` to enable it. #### Syntax - -`node.sleep({wake_gpio[, int_type, resume_cb, preserve_mode]})` + +`node.sleep({wake_pin[, int_type, resume_cb, preserve_mode]})` #### Parameters + * `wake_pin` 1-12, pin to attach wake interrupt to. Note that pin 0(GPIO 16) does not support interrupts.