Handle uninitialized constants

This commit is contained in:
ollo 2016-12-30 14:16:19 +01:00
parent b80a604b46
commit 4810985a54

View File

@ -42,8 +42,11 @@ function syncTimeFromInternet()
end end
function displayTime() function displayTime()
sec, usec = rtctime.get() sec, usec = rtctime.get()
-- Handle lazy programmer:
if (timezoneoffset == nil) then
timezoneoffset=0
end
time = getTime(sec, timezoneoffset) time = getTime(sec, timezoneoffset)
print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second) print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second)
words = display_timestat(time.hour, time.minute) words = display_timestat(time.hour, time.minute)
@ -110,8 +113,8 @@ function normalOperation()
tmr.alarm(2, 500, 0 ,function() tmr.alarm(2, 500, 0 ,function()
syncTimeFromInternet() syncTimeFromInternet()
end) end)
print("Start webserver...")
tmr.alarm(3, 2000, 0 ,function() tmr.alarm(3, 2000, 0 ,function()
print("Start webserver...")
mydofile("webserver") mydofile("webserver")
startWebServer() startWebServer()
end) end)