Show boot process

This commit is contained in:
Ollo 2021-03-21 15:31:05 +01:00
parent fd5ec411f1
commit 2e77516d43

View File

@ -64,16 +64,6 @@ function displayTime()
dw = nil dw = nil
collectgarbage() collectgarbage()
print("dw: " .. tostring(node.heap())) print("dw: " .. tostring(node.heap()))
if (rgbBuffer ~= nil) then
ws2812.write(rgbBuffer)
else
-- set FG to fix value: RED
local color = string.char(255,0,0)
rgbBuffer:fill(0,0,0) -- disable all LEDs
for i=108,110, 1 do rgbBuffer:set(i, color) end
ws2812.write(rgbBuffer)
print("Fallback no time displayed")
end
-- cleanup -- cleanup
i=nil i=nil
@ -100,10 +90,24 @@ function normalOperation()
syncTimeFromInternet() syncTimeFromInternet()
setupCounter=setupCounter-1 setupCounter=setupCounter-1
alive = 1 alive = 1
rgbBuffer:set(19, color) -- N
rgbBuffer:set(31, color) -- T
if ((inv46 ~= nil) and (inv46 == "on")) then
rgbBuffer:set(45, color) -- P
else
rgbBuffer:set(55, color) -- P
end
elseif (setupCounter > 3) then elseif (setupCounter > 3) then
-- Here the WLAN is found, and something is done -- Here the WLAN is found, and something is done
mydofile("mqtt") mydofile("mqtt")
rgbBuffer:fill(0,0,0) -- disable all LEDs
if (startMqttClient ~= nil) then if (startMqttClient ~= nil) then
if ((inv46 ~= nil) and (inv46 == "on")) then
rgbBuffer:set(34, color) -- M
else
rgbBuffer:set(44, color) -- M
end
rgbBuffer:set(82, color) -- T
startMqttClient() startMqttClient()
else else
print("NO Mqtt found") print("NO Mqtt found")
@ -126,6 +130,16 @@ function normalOperation()
displayTime() displayTime()
alive = alive + 1 alive = alive + 1
end end
if (rgbBuffer ~= nil) then
ws2812.write(rgbBuffer)
else
-- set FG to fix value: RED
local color = string.char(255,0,0)
rgbBuffer:fill(0,0,0) -- disable all LEDs
for i=108,110, 1 do rgbBuffer:set(i, color) end
ws2812.write(rgbBuffer)
print("Fallback no time displayed")
end
-- Feed the system watchdog. -- Feed the system watchdog.
tmr.wdclr() tmr.wdclr()
end) end)