Handle not drawn characters
This commit is contained in:
parent
6a70803b6c
commit
e924b638f1
@ -35,12 +35,14 @@ local drawLEDs = function(data, numberNewChars)
|
|||||||
if (data.rgbBuffer == nil) then
|
if (data.rgbBuffer == nil) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local tmpBuf=nil
|
local skipped=0
|
||||||
|
if (data.sC ~= nil) then
|
||||||
|
skipped=tonumber(data.sC)
|
||||||
|
end
|
||||||
for i=1,numberNewChars do
|
for i=1,numberNewChars do
|
||||||
data.rgbBuffer:set(data.dC + 1, updateColor(data))
|
data.rgbBuffer:set(skipped + data.dC + 1, updateColor(data))
|
||||||
data.dC=data.dC+1
|
data.dC=data.dC+1
|
||||||
end
|
end
|
||||||
return tmpBuf
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Utility function for round
|
-- Utility function for round
|
||||||
@ -136,7 +138,8 @@ local generateLEDs = function(rgbBuffer, words, colorBg, colorFg, colorM1, color
|
|||||||
data.colorM3=colorM3
|
data.colorM3=colorM3
|
||||||
data.colorM4=colorM4
|
data.colorM4=colorM4
|
||||||
end
|
end
|
||||||
data.dC=0
|
data.dC=0 -- drawn characters
|
||||||
|
data.sC=0 -- skipped characters
|
||||||
local charsPerLine=11
|
local charsPerLine=11
|
||||||
|
|
||||||
-- Space / background has no color by default
|
-- Space / background has no color by default
|
||||||
@ -151,7 +154,6 @@ local generateLEDs = function(rgbBuffer, words, colorBg, colorFg, colorM1, color
|
|||||||
rgbBuffer:fill(colorBg) -- draw the background
|
rgbBuffer:fill(colorBg) -- draw the background
|
||||||
|
|
||||||
-- Set the foreground color as the default color
|
-- Set the foreground color as the default color
|
||||||
local buf=data.colorFg
|
|
||||||
local lineIdx=1
|
local lineIdx=1
|
||||||
-- line 1----------------------------------------------
|
-- line 1----------------------------------------------
|
||||||
lineIdx=11
|
lineIdx=11
|
||||||
@ -161,21 +163,21 @@ local generateLEDs = function(rgbBuffer, words, colorBg, colorFg, colorM1, color
|
|||||||
if (words.it==1) then
|
if (words.it==1) then
|
||||||
drawLEDs(data,2) -- ES
|
drawLEDs(data,2) -- ES
|
||||||
else
|
else
|
||||||
data.dC=data.dC+2
|
data.sC=data.sC+2
|
||||||
end
|
end
|
||||||
-- K fill character
|
-- K fill character
|
||||||
buf=buf .. space:rep(1)
|
data.sC=data.sC+1
|
||||||
if (words.is == 1) then
|
if (words.is == 1) then
|
||||||
drawLEDs(data,3) -- IST
|
drawLEDs(data,3) -- IST
|
||||||
else
|
else
|
||||||
data.dC=data.dC+3
|
data.sC=data.sC+3
|
||||||
end
|
end
|
||||||
-- L fill character
|
-- L fill character
|
||||||
buf=buf .. space:rep(1)
|
data.sC=data.sC+1
|
||||||
if (words.m5== 1) then
|
if (words.m5== 1) then
|
||||||
drawLEDs(data,4) -- FUENF
|
drawLEDs(data,4) -- FUENF
|
||||||
else
|
else
|
||||||
data.dC=data.dC+4
|
data.sC=data.sC+4
|
||||||
end
|
end
|
||||||
-- line 2-- even row (so inverted) --------------------
|
-- line 2-- even row (so inverted) --------------------
|
||||||
lineIdx=12
|
lineIdx=12
|
||||||
@ -185,12 +187,12 @@ if (words.m5== 1) then
|
|||||||
if (words.m10 == 1) then
|
if (words.m10 == 1) then
|
||||||
drawLEDs(data,4) -- ZEHN
|
drawLEDs(data,4) -- ZEHN
|
||||||
else
|
else
|
||||||
data.dC=data.dC+4
|
data.sC=data.sC+4
|
||||||
end
|
end
|
||||||
if (words.m20 == 1) then
|
if (words.m20 == 1) then
|
||||||
drawLEDs(data,7) -- ZWANZIG
|
drawLEDs(data,7) -- ZWANZIG
|
||||||
else
|
else
|
||||||
data.dC=data.dC+7
|
data.sC=data.sC+7
|
||||||
end
|
end
|
||||||
-- swap line
|
-- swap line
|
||||||
swapLine(data,lineIdx)
|
swapLine(data,lineIdx)
|
||||||
@ -202,10 +204,10 @@ if (words.m5== 1) then
|
|||||||
if (words.h3q == 1) then
|
if (words.h3q == 1) then
|
||||||
line= drawLEDs(data,11) -- DREIVIERTEL
|
line= drawLEDs(data,11) -- DREIVIERTEL
|
||||||
elseif (words.hq == 1) then
|
elseif (words.hq == 1) then
|
||||||
data.dC=data.dC+4
|
data.sC=data.sC+4
|
||||||
drawLEDs(data,7) -- VIERTEL
|
drawLEDs(data,7) -- VIERTEL
|
||||||
else
|
else
|
||||||
data.dC=data.dC+11
|
data.sC=data.sC+11
|
||||||
end
|
end
|
||||||
--line 4-------- even row (so inverted) -------------
|
--line 4-------- even row (so inverted) -------------
|
||||||
lineIdx=34
|
lineIdx=34
|
||||||
@ -213,16 +215,16 @@ if (words.m5== 1) then
|
|||||||
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[4]) end
|
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[4]) end
|
||||||
end
|
end
|
||||||
if (words.ha == 1) then
|
if (words.ha == 1) then
|
||||||
data.dC=data.dC+2 -- TG
|
data.sC=data.sC+2 -- TG
|
||||||
drawLEDs(data,4) -- NACH
|
drawLEDs(data,4) -- NACH
|
||||||
else
|
else
|
||||||
data.dC=data.dC+6
|
data.sC=data.sC+6
|
||||||
end
|
end
|
||||||
if (words.hb == 1) then
|
if (words.hb == 1) then
|
||||||
drawLEDs(data,3) -- VOR
|
drawLEDs(data,3) -- VOR
|
||||||
data.dC=data.dC+2
|
data.sC=data.sC+2
|
||||||
else
|
else
|
||||||
data.dC=data.dC+5
|
data.sC=data.sC+5
|
||||||
end
|
end
|
||||||
if (invertRows ~= true) then
|
if (invertRows ~= true) then
|
||||||
swapLine(data,lineIdx)
|
swapLine(data,lineIdx)
|
||||||
@ -234,15 +236,15 @@ if (words.m5== 1) then
|
|||||||
end
|
end
|
||||||
if (words.half == 1) then
|
if (words.half == 1) then
|
||||||
drawLEDs(data,4) -- HALB
|
drawLEDs(data,4) -- HALB
|
||||||
data.dC=data.dC+1 -- X
|
data.sC=data.sC+1 -- X
|
||||||
else
|
else
|
||||||
data.dC=data.dC+5
|
data.sC=data.sC+5
|
||||||
end
|
end
|
||||||
if (words.h12 == 1) then
|
if (words.h12 == 1) then
|
||||||
drawLEDs(data,5) -- ZWOELF
|
drawLEDs(data,5) -- ZWOELF
|
||||||
data.dC=data.dC+1 -- P
|
data.sC=data.sC+1 -- P
|
||||||
else
|
else
|
||||||
data.dC=data.dC+6
|
data.sC=data.sC+6
|
||||||
end
|
end
|
||||||
if (invertRows == true) then
|
if (invertRows == true) then
|
||||||
swapLine(data,lineIdx)
|
swapLine(data,lineIdx)
|
||||||
@ -253,21 +255,21 @@ if (words.m5== 1) then
|
|||||||
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[6]) end
|
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[6]) end
|
||||||
end
|
end
|
||||||
if (words.h7 == 1) then
|
if (words.h7 == 1) then
|
||||||
data.dC=data.dC+5
|
data.sC=data.sC+5
|
||||||
drawLEDs(data,6) -- SIEBEN
|
drawLEDs(data,6) -- SIEBEN
|
||||||
elseif (words.h1l == 1) then
|
elseif (words.h1l == 1) then
|
||||||
data.dC=data.dC+2
|
data.sC=data.sC+2
|
||||||
drawLEDs(data,4) -- EINS
|
drawLEDs(data,4) -- EINS
|
||||||
data.dC=data.dC+5
|
data.sC=data.sC+5
|
||||||
elseif (words.h1 == 1) then
|
elseif (words.h1 == 1) then
|
||||||
data.dC=data.dC+2
|
data.sC=data.sC+2
|
||||||
drawLEDs(data,3) -- EIN
|
drawLEDs(data,3) -- EIN
|
||||||
data.dC=data.dC+6
|
data.sC=data.sC+6
|
||||||
elseif (words.h2 == 1) then
|
elseif (words.h2 == 1) then
|
||||||
drawLEDs(data,4) -- ZWEI
|
drawLEDs(data,4) -- ZWEI
|
||||||
data.dC=data.dC+7
|
data.sC=data.sC+7
|
||||||
else
|
else
|
||||||
data.dC=data.dC+7
|
data.sC=data.sC+7
|
||||||
end
|
end
|
||||||
if (invertRows ~= true) then
|
if (invertRows ~= true) then
|
||||||
swapLine(data,lineIdx)
|
swapLine(data,lineIdx)
|
||||||
@ -278,14 +280,14 @@ if (words.m5== 1) then
|
|||||||
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[7]) end
|
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[7]) end
|
||||||
end
|
end
|
||||||
if (words.h3 == 1) then
|
if (words.h3 == 1) then
|
||||||
data.dC=data.dC+1
|
data.sC=data.sC+1
|
||||||
line= line .. drawLEDs(data,4) -- DREI
|
line= line .. drawLEDs(data,4) -- DREI
|
||||||
data.dC=data.dC+6
|
data.sC=data.sC+6
|
||||||
elseif (words.h5 == 1) then
|
elseif (words.h5 == 1) then
|
||||||
data.dC=data.dC+7
|
data.sC=data.sC+7
|
||||||
line= line .. drawLEDs(data,4) -- FUENF
|
line= line .. drawLEDs(data,4) -- FUENF
|
||||||
else
|
else
|
||||||
data.dC=data.dC+11
|
data.sC=data.sC+11
|
||||||
end
|
end
|
||||||
------------even row (so inverted) ---------------------
|
------------even row (so inverted) ---------------------
|
||||||
lineIdx=78
|
lineIdx=78
|
||||||
@ -293,17 +295,17 @@ if (words.m5== 1) then
|
|||||||
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[8]) end
|
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[8]) end
|
||||||
end
|
end
|
||||||
if (words.h4 == 1) then
|
if (words.h4 == 1) then
|
||||||
data.dC=data.dC+7
|
data.sC=data.sC+7
|
||||||
drawLEDs(data,4) -- VIER
|
drawLEDs(data,4) -- VIER
|
||||||
elseif (words.h9 == 1) then
|
elseif (words.h9 == 1) then
|
||||||
data.dC=data.dC+3
|
data.sC=data.sC+3
|
||||||
drawLEDs(data,4) -- NEUN
|
drawLEDs(data,4) -- NEUN
|
||||||
data.dC=data.dC+4
|
data.sC=data.sC+4
|
||||||
elseif (words.h11 == 1) then
|
elseif (words.h11 == 1) then
|
||||||
drawLEDs(data,3) -- ELF
|
drawLEDs(data,3) -- ELF
|
||||||
data.dC=data.dC+8
|
data.sC=data.sC+8
|
||||||
else
|
else
|
||||||
data.dC=data.dC+11
|
data.sC=data.sC+11
|
||||||
end
|
end
|
||||||
swapLine(data,lineIdx)
|
swapLine(data,lineIdx)
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
@ -312,15 +314,15 @@ if (words.m5== 1) then
|
|||||||
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[9]) end
|
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[9]) end
|
||||||
end
|
end
|
||||||
if (words.h8 == 1) then
|
if (words.h8 == 1) then
|
||||||
data.dC=data.dC+1
|
data.sC=data.sC+1
|
||||||
drawLEDs(data,4) -- ACHT
|
drawLEDs(data,4) -- ACHT
|
||||||
data.dC=data.dC+6
|
data.sC=data.sC+6
|
||||||
elseif (words.h10 == 1) then
|
elseif (words.h10 == 1) then
|
||||||
data.dC=data.dC+5
|
data.sC=data.sC+5
|
||||||
drawLEDs(data,4) -- ZEHN
|
drawLEDs(data,4) -- ZEHN
|
||||||
data.dC=data.dC+2
|
data.sC=data.sC+2
|
||||||
else
|
else
|
||||||
data.dC=data.dC+11
|
data.sC=data.sC+11
|
||||||
end
|
end
|
||||||
|
|
||||||
------------even row (so inverted) ---------------------
|
------------even row (so inverted) ---------------------
|
||||||
@ -329,16 +331,16 @@ if (words.m5== 1) then
|
|||||||
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[10]) end
|
for i=lineIdx,lineIdx+11, 1 do data.rgbBuffer:set(i, rowbgColor[10]) end
|
||||||
end
|
end
|
||||||
if (words.h6 == 1) then
|
if (words.h6 == 1) then
|
||||||
data.dC=data.dC+1
|
data.sC=data.sC+1
|
||||||
drawLEDs(data,5) -- SECHS
|
drawLEDs(data,5) -- SECHS
|
||||||
data.dC=data.dC+2
|
data.sC=data.sC+2
|
||||||
else
|
else
|
||||||
data.dC=data.dC+8
|
data.sC=data.sC+8
|
||||||
end
|
end
|
||||||
if (words.cl == 1) then
|
if (words.cl == 1) then
|
||||||
drawLEDs(data,3) -- UHR
|
drawLEDs(data,3) -- UHR
|
||||||
else
|
else
|
||||||
data.dC=data.dC+3
|
data.sC=data.sC+3
|
||||||
end
|
end
|
||||||
swapLine(data,lineIdx)
|
swapLine(data,lineIdx)
|
||||||
------ Minutes -----------
|
------ Minutes -----------
|
||||||
|
Loading…
Reference in New Issue
Block a user