Add node.restore().

If NodeMCU can't connect Wi-Fi, please use it.
After reboot, all will be OK.
RESTORE ITEMS:
wifi_station_set_auto_connect, wifi_set_phy_mode, wifi_softap_set_config,  wifi_station_set_config, wifi_set_opmode.
This commit is contained in:
vowstar 2015-07-04 03:54:22 +08:00
parent 2224f24dad
commit 89aaf475d0
1 changed files with 8 additions and 0 deletions

View File

@ -421,6 +421,13 @@ static int node_bootreason (lua_State *L)
return 1;
}
// Lua: restore()
static int node_restore (lua_State *L)
{
system_restore();
return 0;
}
// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
@ -446,6 +453,7 @@ const LUA_REG_TYPE node_map[] =
{ LSTRKEY( "CPU160MHZ" ), LNUMVAL( CPU160MHZ ) },
{ LSTRKEY( "setcpufreq" ), LFUNCVAL( node_setcpufreq) },
{ LSTRKEY( "bootreason" ), LFUNCVAL( node_bootreason) },
{ LSTRKEY( "restore" ), LFUNCVAL( node_restore) },
// Combined to dsleep(us, option)
// { LSTRKEY( "dsleepsetoption" ), LFUNCVAL( node_deepsleep_setoption) },
#if LUA_OPTIMIZE_MEMORY > 0