Refactored files to modules

This commit is contained in:
Ollo 2022-01-23 18:30:46 +01:00
parent e676f6f8cf
commit 7e7736e12f
5 changed files with 23 additions and 8 deletions

View File

@ -369,4 +369,4 @@ M = {
countChars = countChars
}
end
dw = M
return M

View File

@ -28,14 +28,17 @@ function displayTime()
if (timezoneoffset == nil) then
timezoneoffset=0
end
mydofile("timecore")
local tc = require("timecore_diet")
if (tc == nil) then
return
end
local time = tc.getTime(sec, timezoneoffset)
tc = nil
timecore_diet=nil
package.loaded["timecore_diet"]=nil
collectgarbage()
mydofile("wordclock")
local wc = require("wordclock_diet")
if (wc ~= nil) then
words = wc.timestat(time.hour, time.minute)
if ((dim ~= nil) and (dim == "on")) then
@ -48,9 +51,12 @@ function displayTime()
end
end
wc = nil
wordclock_diet=nil
package.loaded["wordclock_diet"]=nil
collectgarbage()
print("wc: " .. tostring(node.heap()))
mydofile("displayword")
local dw = require("displayword_diet")
if (dw ~= nil) then
--if lines 4 to 6 are inverted due to hardware-fuckup, unfuck it here
local invertRows=false
@ -66,6 +72,9 @@ function displayTime()
print("Show number")
end
dw = nil
displayword_diet=nil
package.loaded["displayword_diet"]=nil
collectgarbage()
-- cleanup

View File

@ -137,14 +137,20 @@ function registerMqtt()
-- generate the temperatur to display, once as it will not change
local dispTemp = tonumber(data)
collectgarbage()
mydofile("wordclock")
if (dispTemp > 0) then
local wc = require("wordclock_diet")
if (wc ~= nil) then
tw = wc.showText(dw, rgbBuffer, invertRows, dispTemp)
wc = nil
print("MQTT | generated words for: " .. tostring(dispTemp))
else
print("MQTT | wordclock failed")
end
wc = nil
wordclock_diet=nil
package.loaded["wordclock_diet"]=nil
else
tw=nil
end
end
elseif (topic == (mqttPrefix .. "/cmd/num/col")) then
-- Set number of the color to display

View File

@ -146,4 +146,4 @@ M = {
getTime = getTime
}
end
tc = M
return M

View File

@ -192,4 +192,4 @@ M = {
showText = showText
}
end
wc = M
return M