From 1fe0a2b80cffc931590af1664c70e233d506f5b9 Mon Sep 17 00:00:00 2001 From: ollo Date: Wed, 20 Apr 2016 17:51:28 +0200 Subject: [PATCH] Minute 1 to 4 are also correctly set, next to the displayed logic --- .gitignore | 1 + unit/example.lua | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ wordclock.lua | 4 +--- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e5899e4..c16ac34 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ wlancfg.lua +*.swp diff --git a/unit/example.lua b/unit/example.lua index 059e339..0290ed4 100644 --- a/unit/example.lua +++ b/unit/example.lua @@ -133,8 +133,59 @@ checkWords(leds, expected, 13 , 00) -- test the minutes inbetween leds=display_timestat(14,01) expected={} +expected.itis=1 expected.two=1 expected.min1=1 expected.clock=1 checkWords(leds, expected, 14 , 01) +leds=display_timestat(15,02) +expected={} +expected.itis=1 +expected.three=1 +expected.min2=1 +expected.clock=1 +checkWords(leds, expected, 15 , 02) + +leds=display_timestat(16,03) +expected={} +expected.itis=1 +expected.four=1 +expected.min3=1 +expected.clock=1 +checkWords(leds, expected, 16 , 03) + +leds=display_timestat(17,04) +expected={} +expected.itis=1 +expected.five=1 +expected.min4=1 +expected.clock=1 +checkWords(leds, expected, 17 , 04) + +leds=display_timestat(18,06) +expected={} +expected.fiveMin=1 +expected.after=1 +expected.min1=1 +expected.six=1 +checkWords(leds, expected, 18 , 06) + +leds=display_timestat(19,09) +expected={} +expected.fiveMin=1 +expected.after=1 +expected.min4=1 +expected.seven=1 +checkWords(leds, expected, 19 , 09) + +leds=display_timestat(20,17) +expected={} +expected.quater=1 +expected.after=1 +expected.min2=1 +expected.eight=1 +checkWords(leds, expected, 20 , 17) + + + diff --git a/wordclock.lua b/wordclock.lua index 905196c..8dc143d 100755 --- a/wordclock.lua +++ b/wordclock.lua @@ -20,9 +20,7 @@ function display_timestat(hours, minutes, longmode) -- transcode minutes local minutesLeds = minutes%5 - minutes=minutes/5 - - + minutes=math.floor(minutes/5) -- "It is" only display each half hour and each hour -- or if longmode is set