Forráskód Böngészése

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.

vowstar 9 éve
szülő
commit
89aaf475d0
1 módosított fájl, 8 hozzáadás és 0 törlés
  1. 8 0
      app/modules/node.c

+ 8 - 0
app/modules/node.c

@@ -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