Display wordclock function with new parameters: color for minute1 to color for minute2 and amount of characters

This commit is contained in:
ollo 2017-03-01 18:55:18 +01:00
parent 3a55addf66
commit 6813822f6d
2 changed files with 3 additions and 11 deletions

View File

@ -1,5 +1,5 @@
-- Module displaying of the words
function generateLEDs(words, color)
function generateLEDs(words, color, colorMin1, colorMin2, colorMin3, colorMin4, characters)
local space=string.char(0,0,0)
-- update the background color, if set

View File

@ -51,17 +51,9 @@ function displayTime()
print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second)
words = display_timestat(time.hour, time.minute)
if ((words.min1 == 1) and (color1 ~= nil)) then
color=color1
elseif ((words.min2 == 1) and (color2 ~= nil)) then
color=color2
elseif ((words.min3 == 1) and (color3 ~= nil)) then
color=color1
elseif ((words.min4 == 1) and (color4 ~= nil)) then
color=color4
end
ledBuf = generateLEDs(words, color)
ledBuf = generateLEDs(words, color, color1, color2, color3, color4,
display_countwords_de(words))
-- Write the buffer to the LEDs
ws2812.write(ledBuf)