From 7e088a455346134bc6676ebe9ad325bac2a88761 Mon Sep 17 00:00:00 2001 From: Nikolay Fiykov Date: Fri, 31 May 2024 15:53:21 +0300 Subject: [PATCH] improving testing support for node.restart() --- lua/node.lua | 7 ++++++- lua/nodemcu-module.lua | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/node.lua b/lua/node.lua index e2cd0f2..9a31760 100644 --- a/lua/node.lua +++ b/lua/node.lua @@ -100,7 +100,12 @@ end ---stock API ---raises error "node.restart" node.restart = function() - error("node.restart") + if _G["NODEMCU_RESTART_IGNORE"] then + print("node.restart() ignored") + nodemcu.node.restartIgnored = true + else + error("node.restart") + end end ---stock API diff --git a/lua/nodemcu-module.lua b/lua/nodemcu-module.lua index b045e4c..e908ea6 100644 --- a/lua/nodemcu-module.lua +++ b/lua/nodemcu-module.lua @@ -216,7 +216,9 @@ NodeMCU.add_reset_fn("node", function() outputToSerial = true, inputStr = "", cpufreq = 80, + restartIgnored = false, } + _G["NODEMCU_RESTART_IGNORE"] = nil _G["NODEMCU_LFS_RELOAD_FAIL"] = nil end)