Skip to content

Commit

Permalink
Fixed error in documentation for node.sleep()
Browse files Browse the repository at this point in the history
  • Loading branch information
dnc40085 committed Mar 24, 2018
1 parent 520eeb0 commit 2dc0ee4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions app/pm/pmSleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions docs/en/modules/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -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[, duration, int_type, resume_cb, preserve_mode]})`--->
`node.sleep({wake_gpio[, int_type, resume_cb, preserve_mode]})`
<!---`node.sleep({wake_pin[, duration, int_type, resume_cb, preserve_mode]})`--->
`node.sleep({wake_pin[, int_type, resume_cb, preserve_mode]})`

#### Parameters
<!--- timed light_sleep currently does not work, the 'duration' parameter is here as a place holder--->
<!--- * `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))--->

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

0 comments on commit 2dc0ee4

Please sign in to comment.