More word decoding debug output

This commit is contained in:
Ollo 2021-03-21 14:13:48 +01:00
parent 4d4be95a3c
commit e2592cc774

View File

@ -5,11 +5,12 @@ do
-- @fn generateLEDs -- @fn generateLEDs
-- Module displaying of the words -- Module displaying of the words
-- @param data struct with the following paramter: -- @param data struct with the following paramter:
-- aoC amount of characters to be used -- aoC amount of characters for the complete message
-- mC amout of characters per minute
-- dC drawn characters -- dC drawn characters
local updateColor = function (data) local updateColor = function (data)
if (data.aoC > 0) then if (data.aoC > 0) and (data.mC ~= nil) and (data.mC > 0) then
local div = tonumber(data.dC/data.aoC) local div = tonumber(data.dC/data.mC)
if (div < 1) then if (div < 1) then
return data.colorFg return data.colorFg
elseif (div < 2) then elseif (div < 2) then
@ -64,7 +65,7 @@ local swapLine = function(data, lineOffset)
if (data.rgbBuffer == nil) then if (data.rgbBuffer == nil) then
return false return false
end end
for i = 0,10 do for i = 0,4 do
local num=tonumber(lineOffset)+i local num=tonumber(lineOffset)+i
local num2=tonumber(lineOffset)+10-i local num2=tonumber(lineOffset)+10-i
local tmpColor=data.rgbBuffer:get(num) local tmpColor=data.rgbBuffer:get(num)
@ -85,7 +86,7 @@ end
-- @param colorM3 foreground color if three minutes after a displayable time is present -- @param colorM3 foreground color if three minutes after a displayable time is present
-- @param colorM4 foreground color if four minutes after a displayable time is present -- @param colorM4 foreground color if four minutes after a displayable time is present
-- @param invertRows wheather line 4,5 and 6 shall be inverted or not -- @param invertRows wheather line 4,5 and 6 shall be inverted or not
-- @param aoC Amount of characters to be displayed -- @param aoC Amount of characters to be displayed
local generateLEDs = function(rgbBuffer, words, colorBg, colorFg, colorM1, colorM2, colorM3, colorM4, invertRows, aoC) local generateLEDs = function(rgbBuffer, words, colorBg, colorFg, colorM1, colorM2, colorM3, colorM4, invertRows, aoC)
-- 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
@ -111,7 +112,8 @@ local generateLEDs = function(rgbBuffer, words, colorBg, colorFg, colorM1, color
end end
if (aoC ~= nil) then if (aoC ~= nil) then
data.aoC = aoC/minutes data.aoC = aoC
data.mC = aoC/minutes
else else
data.aoC = 0 data.aoC = 0
end end
@ -133,6 +135,7 @@ local generateLEDs = function(rgbBuffer, words, colorBg, colorFg, colorM1, color
data.colorM2=colorM2 data.colorM2=colorM2
data.colorM3=colorM3 data.colorM3=colorM3
data.colorM4=colorM4 data.colorM4=colorM4
print("Minutes : " .. tostring(minutes) .. " using " .. tostring(data.aoC) .. " chars with " .. tostring(data.mC) .. " per color")
end end
data.dC=0 -- drawn characters data.dC=0 -- drawn characters
local charsPerLine=11 local charsPerLine=11