local ie = OVL["init-early"]
if ie then ie() end
+local gotmr = tmr.create()
+got = gotmr
+
local function goab()
OVL["nwfnet-diag"]()(true)
OVL["diag"]()
tcpserv:listen(23,function(k)
local telnetd = OVL["telnetd"]()
telnetd.on["conn"] = function(s)
- tmr.unregister(6)
+ if gotmr then gotmr:stop() ; gotmr = nil end
s(string.format("NODE-%06X RECOVERY (auto reboot cancelled)",node.chipid()))
end
telnetd.server(k)
end
local function waitFLASH()
local function stop_()
- gpio.mode(3,gpio.INPUT); gpio.trig(3); tmr.unregister(6)
+ gpio.mode(3,gpio.INPUT); gpio.trig(3)
+ gotmr:stop(); got = nil; gotmr = nil
stop = nil; go = nil
end
function stop() stop_(); goab() 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)
- tmr.alarm(6,8000,tmr.ALARM_SINGLE,go)
+ gotmr:alarm(8000,tmr.ALARM_SINGLE,go)
gpio.trig(3,"low",function(_) print("Aborting..."); stop() end)
end
local function bootPANIC()
- print("Panic! Lingering for a minute with telnet console up; 'tmr.unregister(6)' to persist...")
- tmr.alarm(6,60000,tmr.ALARM_SINGLE,node.restart)
+ print("Panic! Lingering for a minute with telnet console up; 'got:stop()' to persist...")
+ gotmr:alarm(60000,tmr.ALARM_SINGLE,node.restart)
goab()
end
local bct = {
Schedule a reboot of the node "soon"; we need to give the ESP stack enough
time to write back the prompt, or we risk racing and panic-ing the stack::
- diag exec tmr.alarm(tmr.create(), 1000, tmr.ALARM_SINGLE, node.restart)
+ diag exec tmr.create():alarm(1000, tmr.ALARM_SINGLE, node.restart)
end end
end
local function defl_arm(self,t)
- tmr.alarm(self.tmr, t, tmr.ALARM_SINGLE, function() self:fire() end)
+ self.tmr:alarm(t, tmr.ALARM_SINGLE, function() self:fire() end)
end
return function(tmrix) return {
_q = {}, _tst = 0,