Display wordclock function with new parameters: color for minute1 to color for minute2 and amount of characters
This commit is contained in:
parent
3a55addf66
commit
6813822f6d
@ -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
|
||||
|
12
main.lua
12
main.lua
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user