]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_core/commitdiff
Tweaks to init
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Wed, 29 Dec 2021 22:34:00 +0000 (22:34 +0000)
committerNathaniel Wesley Filardo <nwfilardo@gmail.com>
Wed, 29 Dec 2021 22:34:00 +0000 (22:34 +0000)
init.lua

index 654b68bd1ee6e19c296552813c2c0407ae72c5d2..7fb0e45c03b2bb6ff5c98c20407b5af614a6f602 100644 (file)
--- 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...")