Refactored files to modules
This commit is contained in:
parent
e676f6f8cf
commit
7e7736e12f
@ -369,4 +369,4 @@ M = {
|
||||
countChars = countChars
|
||||
}
|
||||
end
|
||||
dw = M
|
||||
return M
|
||||
|
15
main.lua
15
main.lua
@ -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
|
||||
|
10
mqtt.lua
10
mqtt.lua
@ -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
|
||||
|
@ -146,4 +146,4 @@ M = {
|
||||
getTime = getTime
|
||||
}
|
||||
end
|
||||
tc = M
|
||||
return M
|
||||
|
@ -192,4 +192,4 @@ M = {
|
||||
showText = showText
|
||||
}
|
||||
end
|
||||
wc = M
|
||||
return M
|
||||
|
Loading…
Reference in New Issue
Block a user