From 6813822f6d0044d0b46164e0a805e3da6857b20c Mon Sep 17 00:00:00 2001 From: ollo Date: Wed, 1 Mar 2017 18:55:18 +0100 Subject: [PATCH] Display wordclock function with new parameters: color for minute1 to color for minute2 and amount of characters --- displayword.lua | 2 +- main.lua | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/displayword.lua b/displayword.lua index 3039f8f..7e47e1a 100644 --- a/displayword.lua +++ b/displayword.lua @@ -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 diff --git a/main.lua b/main.lua index fc0ba62..41d7147 100644 --- a/main.lua +++ b/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)