From e14a7a576e0f86d3f6dee33b7fa6052c76927ec8 Mon Sep 17 00:00:00 2001 From: ollo Date: Fri, 3 May 2019 23:18:27 +0200 Subject: [PATCH] Show WLAN when connecting --- main.lua | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/main.lua b/main.lua index 3e75444..bd88399 100644 --- a/main.lua +++ b/main.lua @@ -102,15 +102,37 @@ function normalOperation() connect_counter=0 -- Wait to be connect to the WiFi access point. - tmr.alarm(0, 1000, 1, function() + tmr.alarm(0, 500, 1, function() connect_counter=connect_counter+1 if wifi.sta.status() ~= 5 then print(connect_counter .. "/60 Connecting to AP...") - if (connect_counter % 2 == 0) then + if (connect_counter % 5 ~= 4) then local wlanColor=string.char((connect_counter % 6)*20,(connect_counter % 5)*20,(connect_counter % 3)*20) local space=string.char(0,0,0) - local buf=space:rep(6) .. wlanColor .. space:rep(4) - buf= buf .. space:rep(3) .. wlanColor:rep(3) + local buf=space:rep(6) + if ((connect_counter % 5) >= 1) then + buf = buf .. wlanColor + else + buf = buf .. space + end + buf = buf .. space:rep(4) + buf= buf .. space:rep(3) + if ((connect_counter % 5) >= 3) then + buf = buf .. wlanColor + else + buf = buf .. space + end + if ((connect_counter % 5) >= 2) then + buf = buf .. wlanColor + else + buf = buf .. space + end + if ((connect_counter % 5) >= 0) then + buf = buf .. wlanColor + else + buf = buf .. space + end + buf = buf .. space:rep(100) ws2812.write(buf) else ws2812.write(string.char(0,0,0):rep(114))