Commit 89aaf475 authored by vowstar's avatar vowstar
Browse files

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.
parent 2224f24d
...@@ -421,6 +421,13 @@ static int node_bootreason (lua_State *L) ...@@ -421,6 +421,13 @@ static int node_bootreason (lua_State *L)
return 1; return 1;
} }
// Lua: restore()
static int node_restore (lua_State *L)
{
system_restore();
return 0;
}
// Module function map // Module function map
#define MIN_OPT_LEVEL 2 #define MIN_OPT_LEVEL 2
#include "lrodefs.h" #include "lrodefs.h"
...@@ -446,6 +453,7 @@ const LUA_REG_TYPE node_map[] = ...@@ -446,6 +453,7 @@ const LUA_REG_TYPE node_map[] =
{ LSTRKEY( "CPU160MHZ" ), LNUMVAL( CPU160MHZ ) }, { LSTRKEY( "CPU160MHZ" ), LNUMVAL( CPU160MHZ ) },
{ LSTRKEY( "setcpufreq" ), LFUNCVAL( node_setcpufreq) }, { LSTRKEY( "setcpufreq" ), LFUNCVAL( node_setcpufreq) },
{ LSTRKEY( "bootreason" ), LFUNCVAL( node_bootreason) }, { LSTRKEY( "bootreason" ), LFUNCVAL( node_bootreason) },
{ LSTRKEY( "restore" ), LFUNCVAL( node_restore) },
// Combined to dsleep(us, option) // Combined to dsleep(us, option)
// { LSTRKEY( "dsleepsetoption" ), LFUNCVAL( node_deepsleep_setoption) }, // { LSTRKEY( "dsleepsetoption" ), LFUNCVAL( node_deepsleep_setoption) },
#if LUA_OPTIMIZE_MEMORY > 0 #if LUA_OPTIMIZE_MEMORY > 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment