Add message indicating that node.sleep() was disabled during build. (#2367)

This commit is contained in:
dnc40085 2018-05-08 13:43:12 -07:00 committed by Marcel Stör
parent 6a261aecdb
commit 106841c26c
1 changed files with 9 additions and 4 deletions

View File

@ -108,13 +108,18 @@ static int node_sleep( lua_State* L )
cfg.resume_cb_ptr = &node_sleep_resume_cb; cfg.resume_cb_ptr = &node_sleep_resume_cb;
pmSleep_suspend(&cfg); pmSleep_suspend(&cfg);
#else #else
c_printf("\n The option \"timer_suspend_enable\" in \"app/include/user_config.h\" was disabled during FW build!\n"); dbg_printf("\n The option \"TIMER_SUSPEND_ENABLE\" in \"app/include/user_config.h\" was disabled during FW build!\n");
return luaL_error(L, "light sleep is unavailable"); return luaL_error(L, "node.sleep() is unavailable");
#endif #endif
return 0; return 0;
} }
#else
static int node_sleep( lua_State* L )
{
dbg_printf("\n The options \"TIMER_SUSPEND_ENABLE\" and \"PMSLEEP_ENABLE\" in \"app/include/user_config.h\" were disabled during FW build!\n");
return luaL_error(L, "node.sleep() is unavailable");
}
#endif //PMSLEEP_ENABLE #endif //PMSLEEP_ENABLE
static int node_info( lua_State* L ) static int node_info( lua_State* L )
{ {
lua_pushinteger(L, NODE_VERSION_MAJOR); lua_pushinteger(L, NODE_VERSION_MAJOR);
@ -600,8 +605,8 @@ static const LUA_REG_TYPE node_map[] =
{ LSTRKEY( "restart" ), LFUNCVAL( node_restart ) }, { LSTRKEY( "restart" ), LFUNCVAL( node_restart ) },
{ LSTRKEY( "dsleep" ), LFUNCVAL( node_deepsleep ) }, { LSTRKEY( "dsleep" ), LFUNCVAL( node_deepsleep ) },
{ LSTRKEY( "dsleepMax" ), LFUNCVAL( dsleepMax ) }, { LSTRKEY( "dsleepMax" ), LFUNCVAL( dsleepMax ) },
#ifdef PMSLEEP_ENABLE
{ LSTRKEY( "sleep" ), LFUNCVAL( node_sleep ) }, { LSTRKEY( "sleep" ), LFUNCVAL( node_sleep ) },
#ifdef PMSLEEP_ENABLE
PMSLEEP_INT_MAP, PMSLEEP_INT_MAP,
#endif #endif
{ LSTRKEY( "info" ), LFUNCVAL( node_info ) }, { LSTRKEY( "info" ), LFUNCVAL( node_info ) },