diff --git a/displayword.lua b/displayword.lua index 0a9ed63..714b74c 100644 --- a/displayword.lua +++ b/displayword.lua @@ -38,7 +38,7 @@ end local data={} -- Module displaying of the words -local generateLEDs = function(words, colorForground, colorMin1, colorMin2, colorMin3, colorMin4, invertRows) +local generateLEDs = function(words, colorForground, colorMin1, colorMin2, colorMin3, colorMin4, invertRows, amountOfChars) -- Set the local variables needed for the colored progress bar if (words == nil) then return nil @@ -47,9 +47,6 @@ local generateLEDs = function(words, colorForground, colorMin1, colorMin2, color invertRows=false end - -- DEBUG code, to determine, if the color argmuments are necessary or not - print(tostring(color) .. " " .. tostring(color1)) - local minutes=0 if (words.min1 == 1) then minutes = minutes + 1 @@ -62,11 +59,16 @@ local generateLEDs = function(words, colorForground, colorMin1, colorMin2, color end -- always set a foreground value local colorFg = string.char(255,255,255) - if (colorForground ~= nil) then colorFg = colorForground end + if (amountOfChars ~= nil) then + data.amountOfChars = amountOfChars + else + data.amountOfChars = 0 + end + if ( (adc ~= nil) and (words.briPercent ~= nil) ) then local per = math.floor(100*adc.read(0)/1000) words.briPercent = tonumber( ((words.briPercent * 4) + per) / 5) diff --git a/main.lua b/main.lua index 002bfa0..b230fb8 100644 --- a/main.lua +++ b/main.lua @@ -63,7 +63,8 @@ function displayTime() if ((inv46 ~= nil) and (inv46 == "on")) then invertRows=true end - ledBuf = displayword.generateLEDs(words, color, color1, color2, color3, color4, invertRows) + displayword.generateLEDs(words, color, color1, color2, color3, color4, invertRows) + ledBuf = displayword.generateLEDs(words, color, color1, color2, color3, color4, invertRows, displayword.data.drawnCharacters) print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. " char: " .. tostring(displayword.data.drawnCharacters)) end displayword = nil