Updated driver to show error screen when not connected.

This commit is contained in:
Andrew Lalis 2022-05-30 09:21:12 +02:00
parent 3c51204261
commit 2f7e3ec20c
1 changed files with 5 additions and 3 deletions

View File

@ -62,10 +62,12 @@ end
local function displaySignal(signal) local function displaySignal(signal)
local color = colors.white local color = colors.white
if signal.segment.occupied ~= nil then if signal.segment.occupied ~= nil then
if signal.segment.occupied then if signal.segment.occupied == true then
color = colors.red color = colors.red
else elseif signal.segment.occupied == false then
color = colors.lime color = colors.lime
else
color = colors.blue
end end
end end
signal.segment.monitor.setBackgroundColor(color) signal.segment.monitor.setBackgroundColor(color)
@ -270,7 +272,7 @@ while true do
elseif event == "websocket_closed" then elseif event == "websocket_closed" then
for _, component in pairs(config.components) do for _, component in pairs(config.components) do
if component.type == "SIGNAL" then if component.type == "SIGNAL" then
component.segment.occupied = nil component.segment.occupied = "ERROR"
displaySignal(component) displaySignal(component)
end end
end end