From f2b625f0cbbb2ef950bb80acd391c507f7675f06 Mon Sep 17 00:00:00 2001 From: ollo Date: Fri, 29 Dec 2017 21:47:23 +0100 Subject: [PATCH] Secure, that the 'space' leds in the middle are only positive numbers --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 74d28a2..54c20bf 100644 --- a/init.lua +++ b/init.lua @@ -7,7 +7,8 @@ counter1=0 ws2812.write(string.char(0,0,0):rep(114)) tmr.alarm(2, 85, 1, function() counter1=counter1+1 - ws2812.write(string.char(128,0,0):rep(counter1) .. string.char(0,0,0):rep(MAXLEDS - (counter1*2)) .. string.char(0,0,64):rep(counter1)) + spaceLeds = math.max(MAXLEDS - (counter1*2), 0) + ws2812.write(string.char(128,0,0):rep(counter1) .. string.char(0,0,0):rep(spaceLeds) .. string.char(0,0,64):rep(counter1)) end) local blacklistfile="init.lua config.lua config.lua.new" @@ -54,3 +55,4 @@ tmr.alarm(1, 5000, 0, function() print("No Main file found") end end) +print("Init file end reached")