From a2021fcb4808928f4a55a14fd8142a6f0dcab172 Mon Sep 17 00:00:00 2001 From: Ollo Date: Mon, 7 Dec 2020 21:12:48 +0100 Subject: [PATCH] Sync the time every 5 minutes from the internet --- main.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/main.lua b/main.lua index 59aca40..51e3e0e 100644 --- a/main.lua +++ b/main.lua @@ -154,20 +154,26 @@ function normalOperation() tmr.alarm(2, 500, 0 ,function() syncTimeFromInternet() + displayTime() end) tmr.alarm(3, 2000, 0 ,function() - if (startTelnetServer ~= nil) then - startTelnetServer() - else - print("NO Telent found") - end + if (startTelnetServer ~= nil) then + startTelnetServer() + else + print("NO Telent found") + end end) - displayTime() -- Start the time Thread tmr.alarm(1, 10000, 1 ,function() displayTime() collectgarbage() end) + + -- sync the time every 5 minutes + tmr.alarm(4, 300000, 1 ,function() + syncTimeFromInternet() + displayTime() + end) end -- when no wifi available, open an accesspoint and ask the user