Skip to content

Commit 040c887

Browse files
committed
Fixed error in documentation for node.sleep()
1 parent b47a807 commit 040c887

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

app/pm/pmSleep.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#define STRINGIFY_VAL(x) #x
44
#define STRINGIFY(x) STRINGIFY_VAL(x)
55

6+
//TODO: figure out why timed light_sleep doesn't work
7+
68
//holds duration error string
79
//uint32 PMSLEEP_SLEEP_MAX_TIME=FPM_SLEEP_MAX_TIME-1;
810
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,
219221
return luaL_argerror( L, table_idx, "wake_pin: must be number" );
220222
}
221223
}
222-
else if(cfg->sleep_duration == 0){
223-
return luaL_argerror( L, table_idx, "wake_pin: must specify pin if sleep duration is indefinite" );
224-
}
224+
else{
225+
return luaL_argerror( L, table_idx, "wake_pin: must specify pin" );
226+
// else if(cfg->sleep_duration == 0){
227+
// return luaL_argerror( L, table_idx, "wake_pin: must specify pin if sleep duration is indefinite" );
228+
}
225229
lua_pop(L, 1);
226230

227231
lua_getfield(L, table_idx, "int_type");

docs/en/modules/node.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,16 +333,16 @@ Put NodeMCU in light sleep mode to reduce current consumption.
333333

334334
* NodeMCU can not enter light sleep mode if wifi is suspended.
335335
* All active timers will be suspended and then resumed when NodeMCU wakes from sleep.
336-
* Any previously suspended timers will be resumed when NodeMCU wakes from sleep.
337336

338337
!!! attention
339338
This is disabled by default. Modify `PMSLEEP_ENABLE` in `app/include/user_config.h` to enable it.
340339

341340
#### Syntax
342-
<!---`node.sleep({wake_gpio[, duration, int_type, resume_cb, preserve_mode]})`--->
343-
`node.sleep({wake_gpio[, int_type, resume_cb, preserve_mode]})`
341+
<!---`node.sleep({wake_pin[, duration, int_type, resume_cb, preserve_mode]})`--->
342+
`node.sleep({wake_pin[, int_type, resume_cb, preserve_mode]})`
344343

345344
#### Parameters
345+
<!--- timed light_sleep currently does not work, the 'duration' parameter is here as a place holder--->
346346
<!--- * `duration` Sleep duration in microseconds(μs). If a sleep duration of `0` is specified, suspension will be indefinite (Range: 0 or 50000 - 268435454 μs (0:4:28.000454))--->
347347

348348
* `wake_pin` 1-12, pin to attach wake interrupt to. Note that pin 0(GPIO 16) does not support interrupts.

0 commit comments

Comments
 (0)