Skip to content

Commit

Permalink
improving testing support for node.restart()
Browse files Browse the repository at this point in the history
  • Loading branch information
fikin committed May 31, 2024
1 parent f4c76ca commit 7e088a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/node.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lua/nodemcu-module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7e088a4

Please sign in to comment.