From 81f397240934eaed0877e468d914d1fe27434097 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Wed, 29 Dec 2021 22:34:00 +0000 Subject: [PATCH] Tweaks to init --- init.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 654b68b..7fb0e45 100644 --- a/init.lua +++ b/init.lua @@ -34,7 +34,6 @@ local ie = OVL["init-early"] if ie then pcall(ie) end local gotmr = tmr.create() -got = gotmr local function goab() OVL["nwfnet-diag"]()(true) @@ -44,7 +43,7 @@ local function goab() tcpserv:listen(23,function(k) local telnetd = OVL["telnetd"]() telnetd.on["conn"] = function(s) - if gotmr then gotmr:stop() ; gotmr = nil end + if gotmr then gotmr:unregister() ; gotmr = nil end s(string.format("NODE-%06X RECOVERY (auto reboot cancelled)",node.chipid())) end telnetd.server(k) @@ -57,15 +56,15 @@ end local function waitFLASH() local function stop_() gpio.mode(3,gpio.INPUT); gpio.trig(3) - gotmr:stop(); got = nil; gotmr = nil + gotmr:unregister(); got = nil; gotmr = nil stop = nil; go = nil end - function stop() stop_(); goab() end + function stop(full) stop_(); if not full then goab() end end function go() print("Continuing boot..."); stop_(); goi2() end print("Reset delay! Bounce GPIO3 low or type 'stop()' to stop autoboot, or 'go()' to go...") gpio.mode(3,gpio.INT,gpio.PULLUP) gotmr:alarm(8000,tmr.ALARM_SINGLE,go) - gpio.trig(3,"low",function(_) print("Aborting..."); stop() end) + gpio.trig(3,"down",function(_) print("Aborting..."); stop() end) end local function bootPANIC() print("Panic! Lingering for a minute with telnet console up; 'stop()' to persist...") -- 2.50.1