Merged
This commit is contained in:
commit
bba21e562b
@ -25,6 +25,7 @@ Then disconnect the serial terminal and copy the required files to the microcont
|
||||
Install the optional packages:
|
||||
<pre>
|
||||
./tools/initialDietFlash.sh /dev/ttyUSB0 mqtt.lua
|
||||
./tools/initialDietFlash.sh /dev/ttyUSB0 mqtt2.lua
|
||||
./tools/initialDietFlash.sh /dev/ttyUSB0 ds18b20.lua
|
||||
</pre>
|
||||
|
||||
|
5
main.lua
5
main.lua
@ -66,11 +66,6 @@ function displayTime()
|
||||
local c = dw.countChars(words)
|
||||
dw.generateLEDs(rgbBuffer, words, colorBg, color, color1, color2, color3, color4, invertRows, c)
|
||||
end
|
||||
if ( (tw ~= nil) and (tcol ~= nil) ) then
|
||||
local c1 = dw.countChars(tw)
|
||||
dw.generateLEDs(rgbBuffer, tw, nil, tcol, nil, nil, nil, nil, invertRows, c1)
|
||||
print("Show number")
|
||||
end
|
||||
dw = nil
|
||||
displayword_diet=nil
|
||||
package.loaded["displayword_diet"]=nil
|
||||
|
5
mqtt.lua
5
mqtt.lua
@ -1,7 +1,3 @@
|
||||
-- Global Variables
|
||||
-- Display other numbers, e.g. Temperatur
|
||||
tw=nil
|
||||
tcol=nil
|
||||
-- Module Variables
|
||||
-- Mqtt variable
|
||||
local mMqttClient=nil
|
||||
@ -196,6 +192,7 @@ function registerMqtt()
|
||||
elseif (string.match(topic, "color4$")) then
|
||||
color4 = parseBgColor(data, "color4")
|
||||
print("Updated color4" )
|
||||
--FIXME load here the mqtt2 file
|
||||
else
|
||||
for i=1,10,1 do
|
||||
if (string.match(topic, "row".. tostring(i) .."$")) then
|
||||
|
34
mqtt2.lua
Normal file
34
mqtt2.lua
Normal file
@ -0,0 +1,34 @@
|
||||
-- Global Variables
|
||||
-- Display other numbers, e.g. Temperatur
|
||||
tw=nil
|
||||
tcol=nil
|
||||
|
||||
function parseMqttSub(client, topic, data)
|
||||
|
||||
if (topic == (mqttPrefix .. "/cmd/num/val")) then
|
||||
if (( data == "" ) or (data == nil)) then
|
||||
tw=nil
|
||||
print("MQTT | wordclock failed")
|
||||
else
|
||||
-- generate the temperatur to display, once as it will not change
|
||||
local dispTemp = tonumber(data)
|
||||
collectgarbage()
|
||||
mydofile("wordclock")
|
||||
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
|
||||
end
|
||||
elseif (topic == (mqttPrefix .. "/cmd/num/col")) then
|
||||
-- Set number of the color to display
|
||||
if (( data ~= "" ) and (data ~= nil)) then
|
||||
tcol = parseBgColor(data, "num/col")
|
||||
else
|
||||
tcol = nil
|
||||
print("MQTT | Hide number")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user