Shrinked wordclock struct
This commit is contained in:
parent
84f5611a67
commit
7941501cc5
144
displayword.lua
144
displayword.lua
@ -7,13 +7,13 @@ local updateColor = function (data)
|
|||||||
if (div < 1) then
|
if (div < 1) then
|
||||||
return data.colorFg
|
return data.colorFg
|
||||||
elseif (div < 2) then
|
elseif (div < 2) then
|
||||||
return data.colorMin1
|
return data.colorM1
|
||||||
elseif (div < 3) then
|
elseif (div < 3) then
|
||||||
return data.colorMin2
|
return data.colorM2
|
||||||
elseif (div < 4) then
|
elseif (div < 4) then
|
||||||
return data.colorMin3
|
return data.colorM3
|
||||||
elseif (div < 5) then
|
elseif (div < 5) then
|
||||||
return data.colorMin4
|
return data.colorM4
|
||||||
else
|
else
|
||||||
return data.colorFg
|
return data.colorFg
|
||||||
end
|
end
|
||||||
@ -53,8 +53,18 @@ end
|
|||||||
|
|
||||||
local data={}
|
local data={}
|
||||||
|
|
||||||
|
-- @fn generateLEDs
|
||||||
-- Module displaying of the words
|
-- Module displaying of the words
|
||||||
local generateLEDs = function(words, colorBg, colorFg, colorMin1, colorMin2, colorMin3, colorMin4, invertRows, amountOfChars)
|
-- @param words
|
||||||
|
-- @param colorBg background color
|
||||||
|
-- @param colorFg foreground color
|
||||||
|
-- @param colorM1 foreground color if one minute after a displayable time is present
|
||||||
|
-- @param colorM2 foreground color if two 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 invertRows wheather line 4,5 and 6 shall be inverted or not
|
||||||
|
-- @param amountOfChars Amount of characters to be displayed
|
||||||
|
local generateLEDs = function(words, colorBg, colorFg, colorM1, colorM2, colorM3, colorM4, 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
|
||||||
@ -64,13 +74,13 @@ local generateLEDs = function(words, colorBg, colorFg, colorMin1, colorMin2, col
|
|||||||
end
|
end
|
||||||
|
|
||||||
local minutes=1
|
local minutes=1
|
||||||
if (words.min1 == 1) then
|
if (words.m1 == 1) then
|
||||||
minutes = minutes + 1
|
minutes = minutes + 1
|
||||||
elseif (words.min2 == 1) then
|
elseif (words.m2 == 1) then
|
||||||
minutes = minutes + 2
|
minutes = minutes + 2
|
||||||
elseif (words.min3 == 1) then
|
elseif (words.m3 == 1) then
|
||||||
minutes = minutes + 3
|
minutes = minutes + 3
|
||||||
elseif (words.min4 == 1) then
|
elseif (words.m4 == 1) then
|
||||||
minutes = minutes + 4
|
minutes = minutes + 4
|
||||||
end
|
end
|
||||||
-- always set a foreground value
|
-- always set a foreground value
|
||||||
@ -89,17 +99,17 @@ local generateLEDs = function(words, colorBg, colorFg, colorMin1, colorMin2, col
|
|||||||
words.briPercent = tonumber( ((words.briPercent * 4) + per) / 5)
|
words.briPercent = tonumber( ((words.briPercent * 4) + per) / 5)
|
||||||
print("Minutes : " .. tostring(minutes) .. " bright: " .. tostring(words.briPercent) .. "% current: " .. tostring(per) .. "%")
|
print("Minutes : " .. tostring(minutes) .. " bright: " .. tostring(words.briPercent) .. "% current: " .. tostring(per) .. "%")
|
||||||
data.colorFg = string.char(string.byte(colorFg,1) * briPercent / 100, string.byte(colorFg,2) * briPercent / 100, string.byte(colorFg,3) * briPercent / 100)
|
data.colorFg = string.char(string.byte(colorFg,1) * briPercent / 100, string.byte(colorFg,2) * briPercent / 100, string.byte(colorFg,3) * briPercent / 100)
|
||||||
data.colorMin1 = string.char(string.byte(colorMin1,1) * briPercent / 100, string.byte(colorMin1,2) * briPercent / 100, string.byte(colorMin1,3) * briPercent / 100)
|
data.colorM1 = string.char(string.byte(colorM1,1) * briPercent / 100, string.byte(colorM1,2) * briPercent / 100, string.byte(colorM1,3) * briPercent / 100)
|
||||||
data.colorMin2 = string.char(string.byte(colorMin2,1) * briPercent / 100, string.byte(colorMin2,2) * briPercent / 100, string.byte(colorMin2,3) * briPercent / 100)
|
data.colorM2 = string.char(string.byte(colorM2,1) * briPercent / 100, string.byte(colorM2,2) * briPercent / 100, string.byte(colorM2,3) * briPercent / 100)
|
||||||
data.colorMin3 = string.char(string.byte(colorMin3,1) * briPercent / 100, string.byte(colorMin3,2) * briPercent / 100, string.byte(colorMin3,3) * briPercent / 100)
|
data.colorM3 = string.char(string.byte(colorM3,1) * briPercent / 100, string.byte(colorM3,2) * briPercent / 100, string.byte(colorM3,3) * briPercent / 100)
|
||||||
data.colorMin4 = string.char(string.byte(colorMin4,1) * briPercent / 100, string.byte(colorMin4,2) * briPercent / 100, string.byte(colorMin4,3) * briPercent / 100)
|
data.colorM4 = string.char(string.byte(colorM4,1) * briPercent / 100, string.byte(colorM4,2) * briPercent / 100, string.byte(colorM4,3) * briPercent / 100)
|
||||||
else
|
else
|
||||||
-- devide by five (Minute 0, Minute 1 to Minute 4 takes the last chars)
|
-- devide by five (Minute 0, Minute 1 to Minute 4 takes the last chars)
|
||||||
data.colorFg=colorFg
|
data.colorFg=colorFg
|
||||||
data.colorMin1=colorMin1
|
data.colorM1=colorM1
|
||||||
data.colorMin2=colorMin2
|
data.colorM2=colorM2
|
||||||
data.colorMin3=colorMin3
|
data.colorM3=colorM3
|
||||||
data.colorMin4=colorMin4
|
data.colorM4=colorM4
|
||||||
end
|
end
|
||||||
data.drawnCharacters=0
|
data.drawnCharacters=0
|
||||||
local charsPerLine=11
|
local charsPerLine=11
|
||||||
@ -135,7 +145,7 @@ buf=buf .. space:rep(1)
|
|||||||
end
|
end
|
||||||
-- L fill character
|
-- L fill character
|
||||||
buf=buf .. space:rep(1)
|
buf=buf .. space:rep(1)
|
||||||
if (words.fiveMin== 1) then
|
if (words.m5== 1) then
|
||||||
buf= buf .. drawLEDs(data,4) -- FUENF
|
buf= buf .. drawLEDs(data,4) -- FUENF
|
||||||
else
|
else
|
||||||
buf= buf .. space:rep(4)
|
buf= buf .. space:rep(4)
|
||||||
@ -146,12 +156,12 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.tenMin == 1) then
|
if (words.m10 == 1) then
|
||||||
line= drawLEDs(data,4) -- ZEHN
|
line= drawLEDs(data,4) -- ZEHN
|
||||||
else
|
else
|
||||||
line= space:rep(4)
|
line= space:rep(4)
|
||||||
end
|
end
|
||||||
if (words.twenty == 1) then
|
if (words.m20 == 1) then
|
||||||
line= line .. drawLEDs(data,7) -- ZWANZIG
|
line= line .. drawLEDs(data,7) -- ZWANZIG
|
||||||
else
|
else
|
||||||
line= line .. space:rep(7)
|
line= line .. space:rep(7)
|
||||||
@ -167,9 +177,9 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.threequater == 1) then
|
if (words.h3q == 1) then
|
||||||
line= drawLEDs(data,11) -- Dreiviertel
|
line= drawLEDs(data,11) -- DREIVIERTEL
|
||||||
elseif (words.quater == 1) then
|
elseif (words.hq == 1) then
|
||||||
line= space:rep(4)
|
line= space:rep(4)
|
||||||
line= line .. drawLEDs(data,7) -- VIERTEL
|
line= line .. drawLEDs(data,7) -- VIERTEL
|
||||||
else
|
else
|
||||||
@ -183,13 +193,13 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.after == 1) then
|
if (words.ha == 1) then
|
||||||
line= space:rep(2) -- TG
|
line= space:rep(2) -- TG
|
||||||
line= line .. drawLEDs(data,4) -- NACH
|
line= line .. drawLEDs(data,4) -- NACH
|
||||||
else
|
else
|
||||||
line= space:rep(6)
|
line= space:rep(6)
|
||||||
end
|
end
|
||||||
if (words.before == 1) then
|
if (words.hb == 1) then
|
||||||
line= line .. drawLEDs(data,3) -- VOR
|
line= line .. drawLEDs(data,3) -- VOR
|
||||||
line= line .. space:rep(2)
|
line= line .. space:rep(2)
|
||||||
else
|
else
|
||||||
@ -214,7 +224,7 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
line= space:rep(5)
|
line= space:rep(5)
|
||||||
end
|
end
|
||||||
if (words.twelve == 1) then
|
if (words.h12 == 1) then
|
||||||
line= line .. drawLEDs(data,5) -- ZWOELF
|
line= line .. drawLEDs(data,5) -- ZWOELF
|
||||||
line= line .. space:rep(1) -- P
|
line= line .. space:rep(1) -- P
|
||||||
else
|
else
|
||||||
@ -233,18 +243,18 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.seven == 1) then
|
if (words.h7 == 1) then
|
||||||
line= space:rep(5)
|
line= space:rep(5)
|
||||||
line= line .. drawLEDs(data,6) -- SIEBEN
|
line= line .. drawLEDs(data,6) -- SIEBEN
|
||||||
elseif (words.oneLong == 1) then
|
elseif (words.h1l == 1) then
|
||||||
line= space:rep(2)
|
line= space:rep(2)
|
||||||
line= line .. drawLEDs(data,4) -- EINS
|
line= line .. drawLEDs(data,4) -- EINS
|
||||||
line= line .. space:rep(5)
|
line= line .. space:rep(5)
|
||||||
elseif (words.one == 1) then
|
elseif (words.h1 == 1) then
|
||||||
line= space:rep(2)
|
line= space:rep(2)
|
||||||
line= line .. drawLEDs(data,3) -- EIN
|
line= line .. drawLEDs(data,3) -- EIN
|
||||||
line= line .. space:rep(6)
|
line= line .. space:rep(6)
|
||||||
elseif (words.two == 1) then
|
elseif (words.h2 == 1) then
|
||||||
line= drawLEDs(data,4) -- ZWEI
|
line= drawLEDs(data,4) -- ZWEI
|
||||||
line= line .. space:rep(7)
|
line= line .. space:rep(7)
|
||||||
else
|
else
|
||||||
@ -263,11 +273,11 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.three == 1) then
|
if (words.h3 == 1) then
|
||||||
line= space:rep(1)
|
line= space:rep(1)
|
||||||
line= line .. drawLEDs(data,4) -- DREI
|
line= line .. drawLEDs(data,4) -- DREI
|
||||||
line= line .. space:rep(6)
|
line= line .. space:rep(6)
|
||||||
elseif (words.five == 1) then
|
elseif (words.h5 == 1) then
|
||||||
line= space:rep(7)
|
line= space:rep(7)
|
||||||
line= line .. drawLEDs(data,4) -- FUENF
|
line= line .. drawLEDs(data,4) -- FUENF
|
||||||
else
|
else
|
||||||
@ -280,15 +290,15 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.four == 1) then
|
if (words.h4 == 1) then
|
||||||
line= space:rep(7)
|
line= space:rep(7)
|
||||||
line= line .. drawLEDs(data,4) -- VIER
|
line= line .. drawLEDs(data,4) -- VIER
|
||||||
elseif (words.nine == 1) then
|
elseif (words.h9 == 1) then
|
||||||
line= space:rep(3)
|
line= space:rep(3)
|
||||||
line= line .. drawLEDs(data,4) -- NEUN
|
line= line .. drawLEDs(data,4) -- NEUN
|
||||||
line= line .. space:rep(4)
|
line= line .. space:rep(4)
|
||||||
elseif (words.eleven == 1) then
|
elseif (words.h11 == 1) then
|
||||||
line= drawLEDs(data,3) -- ELEVEN
|
line= drawLEDs(data,3) -- ELF
|
||||||
line= line .. space:rep(8)
|
line= line .. space:rep(8)
|
||||||
else
|
else
|
||||||
line= space:rep(11)
|
line= space:rep(11)
|
||||||
@ -303,11 +313,11 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.eight == 1) then
|
if (words.h8 == 1) then
|
||||||
line= space:rep(1)
|
line= space:rep(1)
|
||||||
line= line .. drawLEDs(data,4) -- ACHT
|
line= line .. drawLEDs(data,4) -- ACHT
|
||||||
line= line .. space:rep(6)
|
line= line .. space:rep(6)
|
||||||
elseif (words.ten == 1) then
|
elseif (words.h10 == 1) then
|
||||||
line= space:rep(5)
|
line= space:rep(5)
|
||||||
line= line .. drawLEDs(data,4) -- ZEHN
|
line= line .. drawLEDs(data,4) -- ZEHN
|
||||||
line= line .. space:rep(2)
|
line= line .. space:rep(2)
|
||||||
@ -321,14 +331,14 @@ if (words.fiveMin== 1) then
|
|||||||
else
|
else
|
||||||
space = colorBg
|
space = colorBg
|
||||||
end
|
end
|
||||||
if (words.six == 1) then
|
if (words.h6 == 1) then
|
||||||
line= space:rep(1)
|
line= space:rep(1)
|
||||||
line= line .. drawLEDs(data,5) -- SECHS
|
line= line .. drawLEDs(data,5) -- SECHS
|
||||||
line= line .. space:rep(2)
|
line= line .. space:rep(2)
|
||||||
else
|
else
|
||||||
line= space:rep(8)
|
line= space:rep(8)
|
||||||
end
|
end
|
||||||
if (words.clock == 1) then
|
if (words.cl == 1) then
|
||||||
line= line .. drawLEDs(data,3) -- UHR
|
line= line .. drawLEDs(data,3) -- UHR
|
||||||
else
|
else
|
||||||
line= line .. space:rep(3)
|
line= line .. space:rep(3)
|
||||||
@ -338,22 +348,22 @@ if (words.fiveMin== 1) then
|
|||||||
buf = buf .. line:sub((11-i)*3-2,(11-i)*3)
|
buf = buf .. line:sub((11-i)*3-2,(11-i)*3)
|
||||||
end
|
end
|
||||||
------ Minutes -----------
|
------ Minutes -----------
|
||||||
if (words.min1 == 1) then
|
if (words.m1 == 1) then
|
||||||
buf= buf .. colorFg
|
buf= buf .. colorFg
|
||||||
else
|
else
|
||||||
buf= buf .. space:rep(1)
|
buf= buf .. space:rep(1)
|
||||||
end
|
end
|
||||||
if (words.min2 == 1) then
|
if (words.m2 == 1) then
|
||||||
buf= buf .. colorFg
|
buf= buf .. colorFg
|
||||||
else
|
else
|
||||||
buf= buf .. space:rep(1)
|
buf= buf .. space:rep(1)
|
||||||
end
|
end
|
||||||
if (words.min3 == 1) then
|
if (words.m3 == 1) then
|
||||||
buf= buf .. colorFg
|
buf= buf .. colorFg
|
||||||
else
|
else
|
||||||
buf= buf .. space:rep(1)
|
buf= buf .. space:rep(1)
|
||||||
end
|
end
|
||||||
if (words.min4 == 1) then
|
if (words.m4 == 1) then
|
||||||
buf= buf .. colorFg
|
buf= buf .. colorFg
|
||||||
else
|
else
|
||||||
buf= buf .. space:rep(1)
|
buf= buf .. space:rep(1)
|
||||||
@ -371,53 +381,51 @@ local countChars = function(words)
|
|||||||
characters = characters + 2
|
characters = characters + 2
|
||||||
elseif (key == "is") then
|
elseif (key == "is") then
|
||||||
characters = characters + 3
|
characters = characters + 3
|
||||||
elseif (key == "fiveMin") then
|
elseif (key == "m5") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "tenMin") then
|
elseif (key == "m10") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "after") then
|
elseif (key == "ha") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "before") then
|
elseif (key == "hb") then
|
||||||
characters = characters + 3
|
characters = characters + 3
|
||||||
elseif (key == "threeHour") then
|
elseif (key == "h3") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "quater") then
|
elseif (key == "hq") then
|
||||||
characters = characters + 7
|
characters = characters + 7
|
||||||
elseif (key == "threequater") then
|
elseif (key == "h3q") then
|
||||||
characters = characters + 11
|
characters = characters + 11
|
||||||
elseif (key == "half") then
|
elseif (key == "half") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "one") then
|
elseif (key == "h1") then
|
||||||
characters = characters + 3
|
characters = characters + 3
|
||||||
elseif (key == "oneLong") then
|
elseif (key == "h1l") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "two") then
|
elseif (key == "h2") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "three") then
|
elseif (key == "h3") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "four") then
|
elseif (key == "h4") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "five") then
|
elseif (key == "h5") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "six") then
|
elseif (key == "h6") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "seven") then
|
elseif (key == "h7") then
|
||||||
characters = characters + 6
|
characters = characters + 6
|
||||||
elseif (key == "eight") then
|
elseif (key == "h8") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "nine") then
|
elseif (key == "h9") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "ten") then
|
elseif (key == "h10") then
|
||||||
characters = characters + 4
|
characters = characters + 4
|
||||||
elseif (key == "eleven") then
|
elseif (key == "h11") then
|
||||||
characters = characters + 3
|
characters = characters + 3
|
||||||
elseif (key == "twelve") then
|
elseif (key == "h12") then
|
||||||
characters = characters + 5
|
characters = characters + 5
|
||||||
elseif (key == "twenty") then
|
elseif (key == "m20") then
|
||||||
characters = characters + 7
|
characters = characters + 7
|
||||||
elseif (key == "clock") then
|
elseif (key == "cl") then
|
||||||
characters = characters + 3
|
|
||||||
elseif (key == "sr_nc") then
|
|
||||||
characters = characters + 3
|
characters = characters + 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
-- Revese engeeniered code of display_wc_ger.c by Vlad Tepesch
|
-- Revese engeeniered code of display_wc_ger.c by Vlad Tepesch
|
||||||
-- See https://www.mikrocontroller.net/articles/Word_Clock_Variante_1#Download
|
-- See https://www.mikrocontroller.net/articles/Word_cl_Variante_1#Download
|
||||||
|
|
||||||
-- @fn display_timestat
|
-- @fn display_timestat
|
||||||
-- Return the leds to use the granuality is 5 minutes
|
-- Return the leds to use the granuality is 5 minutes
|
||||||
@ -12,10 +12,12 @@ function display_timestat(hours, minutes, longmode)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- generate an empty return type
|
-- generate an empty return type
|
||||||
local ret = { it=0, is=0, fiveMin=0, tenMin=0, after=0, before=0, threeHour=0, quater=0, threequater=0, half=0, s=0,
|
-- Values: it, is, 5 minutes, 10 minutes, afer, before, three hour, quarter, dreiviertel, half, s
|
||||||
one=0, oneLong=0, two=0, three=0, four=0, five=0, six=0, seven=0, eight=0, nine=0, ten=0, eleven=0, twelve=0,
|
-- hours: one, one Long, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve
|
||||||
twenty=0,
|
-- Special ones: twenty, clock, minute 1 flag, minute 2 flag, minute 3 flag, minute 4 flag
|
||||||
clock=0, sr_nc=0, min1=0, min2=0, min3=0, min4=0 }
|
local ret = { it=0, is=0, m5=0, m10=0, ha=0, hb=0, h3=0, hq=0, h3q=0, half=0, s=0,
|
||||||
|
h1=0, h1l=0, h2=0, h3=0, h4=0, h5=0, h6=0, h7=0, h8=0, h9=0, h10=0, h11=0, h12=0,
|
||||||
|
m20=0, cl=0, m1=0, m2=0, m3=0, m4=0 }
|
||||||
|
|
||||||
-- return black screen if there is no real time given
|
-- return black screen if there is no real time given
|
||||||
if (hours == nil or minutes == nil) then
|
if (hours == nil or minutes == nil) then
|
||||||
@ -38,61 +40,61 @@ function display_timestat(hours, minutes, longmode)
|
|||||||
-- Handle minutes
|
-- Handle minutes
|
||||||
if (minutes > 0) then
|
if (minutes > 0) then
|
||||||
if (minutes==1) then
|
if (minutes==1) then
|
||||||
ret.fiveMin=1
|
ret.m5=1
|
||||||
ret.after=1
|
ret.ha=1
|
||||||
elseif (minutes==2) then
|
elseif (minutes==2) then
|
||||||
ret.tenMin=1
|
ret.m10=1
|
||||||
ret.after=1
|
ret.ha=1
|
||||||
elseif (minutes==3) then
|
elseif (minutes==3) then
|
||||||
ret.quater=1
|
ret.hq=1
|
||||||
ret.after=1
|
ret.ha=1
|
||||||
elseif (minutes==4) then
|
elseif (minutes==4) then
|
||||||
ret.twenty=1
|
ret.m20=1
|
||||||
ret.after=1
|
ret.ha=1
|
||||||
elseif (minutes==5) then
|
elseif (minutes==5) then
|
||||||
ret.fiveMin=1
|
ret.m5=1
|
||||||
ret.half=1
|
ret.half=1
|
||||||
ret.before=1
|
ret.hb=1
|
||||||
elseif (minutes==6) then
|
elseif (minutes==6) then
|
||||||
ret.half=1
|
ret.half=1
|
||||||
elseif (minutes==7) then
|
elseif (minutes==7) then
|
||||||
ret.fiveMin=1
|
ret.m5=1
|
||||||
ret.half=1
|
ret.half=1
|
||||||
ret.after=1
|
ret.ha=1
|
||||||
elseif (minutes==8) then
|
elseif (minutes==8) then
|
||||||
ret.twenty=1
|
ret.m20=1
|
||||||
ret.before=1
|
ret.hb=1
|
||||||
elseif (minutes==9) then
|
elseif (minutes==9) then
|
||||||
-- Hande if three quater or quater before is displayed
|
-- Hande if three quater or quater before is displayed
|
||||||
if ((threequater ~= nil) and (threequater==true or threequater=="on")) then
|
if ((threequater ~= nil) and (threequater==true or threequater=="on")) then
|
||||||
ret.threequater=1
|
ret.h3q=1
|
||||||
else
|
else
|
||||||
ret.quater = 1
|
ret.hq = 1
|
||||||
ret.before = 1
|
ret.hb = 1
|
||||||
end
|
end
|
||||||
elseif (minutes==10) then
|
elseif (minutes==10) then
|
||||||
ret.tenMin=1
|
ret.m10=1
|
||||||
ret.before=1
|
ret.hb=1
|
||||||
elseif (minutes==11) then
|
elseif (minutes==11) then
|
||||||
ret.fiveMin=1
|
ret.m5=1
|
||||||
ret.before=1
|
ret.hb=1
|
||||||
end
|
end
|
||||||
|
|
||||||
if (minutes > 4) then
|
if (minutes > 4) then
|
||||||
hours=hours+1
|
hours=hours+1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ret.clock=1
|
ret.cl=1
|
||||||
end
|
end
|
||||||
-- Display the minutes as as extra gimmic on min1 to min 4 to display the cut number
|
-- Display the minutes as as extra gimmic on m1 to min 4 to display the cut number
|
||||||
if (minutesLeds==1) then
|
if (minutesLeds==1) then
|
||||||
ret.min1=1
|
ret.m1=1
|
||||||
elseif (minutesLeds==2) then
|
elseif (minutesLeds==2) then
|
||||||
ret.min2=1
|
ret.m2=1
|
||||||
elseif (minutesLeds==3) then
|
elseif (minutesLeds==3) then
|
||||||
ret.min3=1
|
ret.m3=1
|
||||||
elseif (minutesLeds==4) then
|
elseif (minutesLeds==4) then
|
||||||
ret.min4=1
|
ret.m4=1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- handle hours
|
-- handle hours
|
||||||
@ -106,32 +108,32 @@ function display_timestat(hours, minutes, longmode)
|
|||||||
|
|
||||||
if (hours == 1) then
|
if (hours == 1) then
|
||||||
if ((ret.it == 1) and (ret.half == 0) ) then
|
if ((ret.it == 1) and (ret.half == 0) ) then
|
||||||
ret.one=1
|
ret.h1=1
|
||||||
else
|
else
|
||||||
ret.oneLong=1
|
ret.h1l=1
|
||||||
end
|
end
|
||||||
elseif (hours == 2) then
|
elseif (hours == 2) then
|
||||||
ret.two=1
|
ret.h2=1
|
||||||
elseif (hours == 3) then
|
elseif (hours == 3) then
|
||||||
ret.three=1
|
ret.h3=1
|
||||||
elseif (hours == 4) then
|
elseif (hours == 4) then
|
||||||
ret.four=1
|
ret.h4=1
|
||||||
elseif (hours == 5) then
|
elseif (hours == 5) then
|
||||||
ret.five=1
|
ret.h5=1
|
||||||
elseif (hours == 6) then
|
elseif (hours == 6) then
|
||||||
ret.six=1
|
ret.h6=1
|
||||||
elseif (hours == 7) then
|
elseif (hours == 7) then
|
||||||
ret.seven=1
|
ret.h7=1
|
||||||
elseif (hours == 8) then
|
elseif (hours == 8) then
|
||||||
ret.eight=1
|
ret.h8=1
|
||||||
elseif (hours == 9) then
|
elseif (hours == 9) then
|
||||||
ret.nine=1
|
ret.h9=1
|
||||||
elseif (hours == 10) then
|
elseif (hours == 10) then
|
||||||
ret.ten=1
|
ret.h10=1
|
||||||
elseif (hours == 11) then
|
elseif (hours == 11) then
|
||||||
ret.eleven=1
|
ret.h11=1
|
||||||
elseif (hours == 12) then
|
elseif (hours == 12) then
|
||||||
ret.twelve=1
|
ret.h12=1
|
||||||
end
|
end
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user