Added parameter with the amount of characters
This commit is contained in:
parent
e7d0ce1c43
commit
7bc6ec1fbe
@ -38,7 +38,7 @@ end
|
|||||||
local data={}
|
local data={}
|
||||||
|
|
||||||
-- Module displaying of the words
|
-- 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
|
-- Set the local variables needed for the colored progress bar
|
||||||
if (words == nil) then
|
if (words == nil) then
|
||||||
return nil
|
return nil
|
||||||
@ -47,9 +47,6 @@ local generateLEDs = function(words, colorForground, colorMin1, colorMin2, color
|
|||||||
invertRows=false
|
invertRows=false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- DEBUG code, to determine, if the color argmuments are necessary or not
|
|
||||||
print(tostring(color) .. " " .. tostring(color1))
|
|
||||||
|
|
||||||
local minutes=0
|
local minutes=0
|
||||||
if (words.min1 == 1) then
|
if (words.min1 == 1) then
|
||||||
minutes = minutes + 1
|
minutes = minutes + 1
|
||||||
@ -62,11 +59,16 @@ local generateLEDs = function(words, colorForground, colorMin1, colorMin2, color
|
|||||||
end
|
end
|
||||||
-- always set a foreground value
|
-- always set a foreground value
|
||||||
local colorFg = string.char(255,255,255)
|
local colorFg = string.char(255,255,255)
|
||||||
|
|
||||||
if (colorForground ~= nil) then
|
if (colorForground ~= nil) then
|
||||||
colorFg = colorForground
|
colorFg = colorForground
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (amountOfChars ~= nil) then
|
||||||
|
data.amountOfChars = amountOfChars
|
||||||
|
else
|
||||||
|
data.amountOfChars = 0
|
||||||
|
end
|
||||||
|
|
||||||
if ( (adc ~= nil) and (words.briPercent ~= nil) ) then
|
if ( (adc ~= nil) and (words.briPercent ~= nil) ) then
|
||||||
local per = math.floor(100*adc.read(0)/1000)
|
local per = math.floor(100*adc.read(0)/1000)
|
||||||
words.briPercent = tonumber( ((words.briPercent * 4) + per) / 5)
|
words.briPercent = tonumber( ((words.briPercent * 4) + per) / 5)
|
||||||
|
3
main.lua
3
main.lua
@ -63,7 +63,8 @@ function displayTime()
|
|||||||
if ((inv46 ~= nil) and (inv46 == "on")) then
|
if ((inv46 ~= nil) and (inv46 == "on")) then
|
||||||
invertRows=true
|
invertRows=true
|
||||||
end
|
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))
|
print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second .. " char: " .. tostring(displayword.data.drawnCharacters))
|
||||||
end
|
end
|
||||||
displayword = nil
|
displayword = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user