From: Nathaniel Wesley Filardo Date: Sat, 23 Dec 2017 03:59:19 +0000 (-0500) Subject: init2: hackishly force wifi reconnects X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=f653fd0de2f7942c8028ee2cc5809f41cef6b7cd;p=acmetensortoys-esp-lua_lamp init2: hackishly force wifi reconnects --- diff --git a/init2.lua b/init2.lua index a4a871a..b24ccac 100644 --- 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()