#90 flashing GUI indicator lights

This commit is contained in:
Mikayla Fischler
2022-10-12 16:37:11 -04:00
parent 77dc7ec0c9
commit bfa87815fa
6 changed files with 176 additions and 32 deletions

View File

@@ -1,4 +1,5 @@
local log = require("scada-common.log")
local flasher = require("graphics.flasher")
local iocontrol = require("coordinator.iocontrol")
@@ -107,6 +108,9 @@ function renderer.start_ui()
table.insert(ui.unit_layouts, unit_view(monitor, id))
end
-- start flasher callback task
flasher.init()
-- report ui as ready
engine.ui_ready = true
end
@@ -114,25 +118,33 @@ end
-- close out the UI
function renderer.close_ui()
if engine.ui_ready then
-- report ui as not ready
engine.ui_ready = false
-- report ui as not ready
engine.ui_ready = false
-- stop blinking indicators
flasher.clear()
if engine.ui_ready then
-- hide to stop animation callbacks
ui.main_layout.hide()
for i = 1, #ui.unit_layouts do
ui.unit_layouts[i].hide()
engine.monitors.unit_displays[i].clear()
end
-- clear root UI elements
ui.main_layout = nil
ui.unit_layouts = {}
-- re-draw dmesg
engine.dmesg_window.setVisible(true)
engine.dmesg_window.redraw()
else
-- clear unit displays
for i = 1, #ui.unit_layouts do
engine.monitors.unit_displays[i].clear()
end
end
-- clear root UI elements
ui.main_layout = nil
ui.unit_layouts = {}
-- re-draw dmesg
engine.dmesg_window.setVisible(true)
engine.dmesg_window.redraw()
end
-- is the UI ready?