Added parameter with the amount of characters

This commit is contained in:
ollo 2019-05-15 20:59:31 +02:00
parent e7d0ce1c43
commit 7bc6ec1fbe
2 changed files with 9 additions and 6 deletions

View File

@ -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)

View File

@ -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