Refactored files to modules
This commit is contained in:
parent
e676f6f8cf
commit
7e7736e12f
@ -369,4 +369,4 @@ M = {
|
|||||||
countChars = countChars
|
countChars = countChars
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
dw = M
|
return M
|
||||||
|
15
main.lua
15
main.lua
@ -28,14 +28,17 @@ function displayTime()
|
|||||||
if (timezoneoffset == nil) then
|
if (timezoneoffset == nil) then
|
||||||
timezoneoffset=0
|
timezoneoffset=0
|
||||||
end
|
end
|
||||||
mydofile("timecore")
|
local tc = require("timecore_diet")
|
||||||
if (tc == nil) then
|
if (tc == nil) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local time = tc.getTime(sec, timezoneoffset)
|
local time = tc.getTime(sec, timezoneoffset)
|
||||||
tc = nil
|
tc = nil
|
||||||
|
timecore_diet=nil
|
||||||
|
package.loaded["timecore_diet"]=nil
|
||||||
|
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
mydofile("wordclock")
|
local wc = require("wordclock_diet")
|
||||||
if (wc ~= nil) then
|
if (wc ~= nil) then
|
||||||
words = wc.timestat(time.hour, time.minute)
|
words = wc.timestat(time.hour, time.minute)
|
||||||
if ((dim ~= nil) and (dim == "on")) then
|
if ((dim ~= nil) and (dim == "on")) then
|
||||||
@ -48,9 +51,12 @@ function displayTime()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
wc = nil
|
wc = nil
|
||||||
|
wordclock_diet=nil
|
||||||
|
package.loaded["wordclock_diet"]=nil
|
||||||
|
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
print("wc: " .. tostring(node.heap()))
|
print("wc: " .. tostring(node.heap()))
|
||||||
mydofile("displayword")
|
local dw = require("displayword_diet")
|
||||||
if (dw ~= nil) then
|
if (dw ~= nil) then
|
||||||
--if lines 4 to 6 are inverted due to hardware-fuckup, unfuck it here
|
--if lines 4 to 6 are inverted due to hardware-fuckup, unfuck it here
|
||||||
local invertRows=false
|
local invertRows=false
|
||||||
@ -66,6 +72,9 @@ function displayTime()
|
|||||||
print("Show number")
|
print("Show number")
|
||||||
end
|
end
|
||||||
dw = nil
|
dw = nil
|
||||||
|
displayword_diet=nil
|
||||||
|
package.loaded["displayword_diet"]=nil
|
||||||
|
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
|
|
||||||
-- cleanup
|
-- cleanup
|
||||||
|
10
mqtt.lua
10
mqtt.lua
@ -137,14 +137,20 @@ function registerMqtt()
|
|||||||
-- generate the temperatur to display, once as it will not change
|
-- generate the temperatur to display, once as it will not change
|
||||||
local dispTemp = tonumber(data)
|
local dispTemp = tonumber(data)
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
mydofile("wordclock")
|
if (dispTemp > 0) then
|
||||||
|
local wc = require("wordclock_diet")
|
||||||
if (wc ~= nil) then
|
if (wc ~= nil) then
|
||||||
tw = wc.showText(dw, rgbBuffer, invertRows, dispTemp)
|
tw = wc.showText(dw, rgbBuffer, invertRows, dispTemp)
|
||||||
wc = nil
|
|
||||||
print("MQTT | generated words for: " .. tostring(dispTemp))
|
print("MQTT | generated words for: " .. tostring(dispTemp))
|
||||||
else
|
else
|
||||||
print("MQTT | wordclock failed")
|
print("MQTT | wordclock failed")
|
||||||
end
|
end
|
||||||
|
wc = nil
|
||||||
|
wordclock_diet=nil
|
||||||
|
package.loaded["wordclock_diet"]=nil
|
||||||
|
else
|
||||||
|
tw=nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif (topic == (mqttPrefix .. "/cmd/num/col")) then
|
elseif (topic == (mqttPrefix .. "/cmd/num/col")) then
|
||||||
-- Set number of the color to display
|
-- Set number of the color to display
|
||||||
|
@ -146,4 +146,4 @@ M = {
|
|||||||
getTime = getTime
|
getTime = getTime
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
tc = M
|
return M
|
||||||
|
@ -192,4 +192,4 @@ M = {
|
|||||||
showText = showText
|
showText = showText
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
wc = M
|
return M
|
||||||
|
Loading…
Reference in New Issue
Block a user