]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_lamp/commitdiff
init2: hackishly force wifi reconnects
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Sat, 23 Dec 2017 03:59:19 +0000 (22:59 -0500)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Sat, 23 Dec 2017 03:59:19 +0000 (22:59 -0500)
init2.lua

index a4a871a05c32752ad1a768c3a2cf3b99e5d18f75..b24ccac10a79b20aa11d93debc0d515fbcfeb5fc 100644 (file)
--- a/init2.lua
+++ b/init2.lua
@@ -101,6 +101,9 @@ end
 
 local mqtt_beat_cron
 
+local wifitmr = tmr.create()
+wifitmr:register(10000, tmr.ALARM_SEMI, function() dofile("nwfnet-go.lc") end)
+
 -- network callbacks
 nwfnet.onnet["init"] = function(e,c)
   if     e == "mqttdscn" and c == mqc then
@@ -121,8 +124,11 @@ nwfnet.onnet["init"] = function(e,c)
   elseif e == "wstagoip"              then
     if not mqtt_reconn_poller then mqtt_reconn() end
        remotemsg("draw xx 0 0 4 ;")
+       wifitmr:stop()
   elseif e == "wstaconn"              then
        remotemsg("draw xx 0 4 0 ;")
+  elseif e == "wstadscn"              then
+       wifitmr:start()
   end
 end
 
@@ -139,3 +145,4 @@ dofile("cap1188-init.lc").init(6,5,ontouch_load)
 -- initialize network
 dofile("nwfnet-diag.lc")(true)
 dofile("nwfnet-go.lc")
+wifitmr:start()