mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#219 bugfixes with renderer exit handling
This commit is contained in:
parent
783c4936cc
commit
43e708aa0d
@ -57,7 +57,7 @@ function renderer.is_monitor_used(periph)
|
||||
if engine.monitors.primary == periph then
|
||||
return true
|
||||
else
|
||||
for _, monitor in ipairs(engine.monitors.units) do
|
||||
for _, monitor in ipairs(engine.monitors.unit_displays) do
|
||||
if monitor == periph then return true end
|
||||
end
|
||||
end
|
||||
@ -72,7 +72,7 @@ function renderer.init_displays()
|
||||
_init_display(engine.monitors.primary)
|
||||
|
||||
-- init unit displays
|
||||
for _, monitor in ipairs(engine.monitors.units) do
|
||||
for _, monitor in ipairs(engine.monitors.unit_displays) do
|
||||
_init_display(monitor)
|
||||
end
|
||||
end
|
||||
@ -91,7 +91,7 @@ end
|
||||
function renderer.validate_unit_display_sizes()
|
||||
local valid = true
|
||||
|
||||
for id, monitor in ipairs(engine.monitors.units) do
|
||||
for id, monitor in ipairs(engine.monitors.unit_displays) do
|
||||
local w, h = monitor.getSize()
|
||||
if w ~= 79 or h ~= 52 then
|
||||
log.warning(util.c("RENDERER: unit ", id, " display resolution not 79 wide by 52 tall: ", w, ", ", h))
|
||||
@ -120,8 +120,8 @@ function renderer.start_ui()
|
||||
main_view(engine.ui.main_display)
|
||||
|
||||
-- show unit views on unit displays
|
||||
for i = 1, #engine.monitors.units do
|
||||
engine.ui.unit_displays[i] = DisplayBox{window=engine.monitors.units[i],fg_bg=style.root}
|
||||
for i = 1, #engine.monitors.unit_displays do
|
||||
engine.ui.unit_displays[i] = DisplayBox{window=engine.monitors.unit_displays[i],fg_bg=style.root}
|
||||
unit_view(engine.ui.unit_displays[i], i)
|
||||
end
|
||||
|
||||
@ -150,7 +150,7 @@ function renderer.close_ui()
|
||||
engine.ui.unit_displays = {}
|
||||
|
||||
-- clear unit monitors
|
||||
for _, monitor in ipairs(engine.monitors.units) do monitor.clear() end
|
||||
for _, monitor in ipairs(engine.monitors.unit_displays) do monitor.clear() end
|
||||
|
||||
-- re-draw dmesg
|
||||
engine.dmesg_window.setVisible(true)
|
||||
|
@ -71,8 +71,8 @@ function api.new_session(id, in_queue, out_queue, timeout)
|
||||
end
|
||||
|
||||
-- send a CAPI packet
|
||||
---@param msg_type CAPI_TYPE
|
||||
---@param msg table
|
||||
-----@param msg_type CAPI_TYPE
|
||||
-----@param msg table
|
||||
-- local function _send(msg_type, msg)
|
||||
-- local s_pkt = comms.scada_packet()
|
||||
-- local c_pkt = comms.capi_packet()
|
||||
|
@ -20,7 +20,7 @@ local sounder = require("coordinator.sounder")
|
||||
|
||||
local apisessions = require("coordinator.session.apisessions")
|
||||
|
||||
local COORDINATOR_VERSION = "v0.13.7"
|
||||
local COORDINATOR_VERSION = "v0.13.8"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
File diff suppressed because one or more lines are too long
@ -82,8 +82,8 @@ function pocket.comms(version, modem, local_port, sv_port, api_port, range, sv_w
|
||||
end
|
||||
|
||||
-- send a packet to the coordinator API
|
||||
---@param msg_type CAPI_TYPE
|
||||
---@param msg table
|
||||
-----@param msg_type CAPI_TYPE
|
||||
-----@param msg table
|
||||
-- local function _send_api(msg_type, msg)
|
||||
-- local s_pkt = comms.scada_packet()
|
||||
-- local pkt = comms.capi_packet()
|
||||
|
@ -40,28 +40,28 @@ end
|
||||
|
||||
-- close out the UI
|
||||
function renderer.close_ui()
|
||||
-- stop blinking indicators
|
||||
flasher.clear()
|
||||
|
||||
if ui.display ~= nil then
|
||||
-- stop blinking indicators
|
||||
flasher.clear()
|
||||
|
||||
-- hide to stop animation callbacks
|
||||
ui.display.hide()
|
||||
|
||||
-- clear root UI elements
|
||||
ui.display = nil
|
||||
|
||||
-- restore colors
|
||||
for i = 1, #style.colors do
|
||||
local r, g, b = term.nativePaletteColor(style.colors[i].c)
|
||||
term.setPaletteColor(style.colors[i].c, r, g, b)
|
||||
end
|
||||
|
||||
-- reset terminal
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
end
|
||||
|
||||
-- clear root UI elements
|
||||
ui.display = nil
|
||||
|
||||
-- restore colors
|
||||
for i = 1, #style.colors do
|
||||
local r, g, b = term.nativePaletteColor(style.colors[i].c)
|
||||
term.setPaletteColor(style.colors[i].c, r, g, b)
|
||||
end
|
||||
|
||||
-- reset terminal
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
end
|
||||
|
||||
-- is the UI ready?
|
||||
|
@ -104,7 +104,7 @@ local function main()
|
||||
local ui_ok, message = pcall(renderer.start_ui)
|
||||
if not ui_ok then
|
||||
renderer.close_ui()
|
||||
println_ts(util.c("UI error: ", message))
|
||||
println(util.c("UI error: ", message))
|
||||
log.error(util.c("startup> GUI crashed with error ", message))
|
||||
else
|
||||
-- start clock
|
||||
|
@ -40,28 +40,28 @@ end
|
||||
|
||||
-- close out the UI
|
||||
function renderer.close_ui()
|
||||
-- stop blinking indicators
|
||||
flasher.clear()
|
||||
|
||||
if ui.display ~= nil then
|
||||
-- stop blinking indicators
|
||||
flasher.clear()
|
||||
|
||||
-- hide to stop animation callbacks
|
||||
ui.display.hide()
|
||||
|
||||
-- clear root UI elements
|
||||
ui.display = nil
|
||||
|
||||
-- restore colors
|
||||
for i = 1, #style.colors do
|
||||
local r, g, b = term.nativePaletteColor(style.colors[i].c)
|
||||
term.setPaletteColor(style.colors[i].c, r, g, b)
|
||||
end
|
||||
|
||||
-- reset terminal
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
end
|
||||
|
||||
-- clear root UI elements
|
||||
ui.display = nil
|
||||
|
||||
-- restore colors
|
||||
for i = 1, #style.colors do
|
||||
local r, g, b = term.nativePaletteColor(style.colors[i].c)
|
||||
term.setPaletteColor(style.colors[i].c, r, g, b)
|
||||
end
|
||||
|
||||
-- reset terminal
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
end
|
||||
|
||||
-- is the UI ready?
|
||||
|
@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
|
||||
local renderer = require("reactor-plc.renderer")
|
||||
local threads = require("reactor-plc.threads")
|
||||
|
||||
local R_PLC_VERSION = "v1.1.16"
|
||||
local R_PLC_VERSION = "v1.1.17"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
@ -41,28 +41,28 @@ end
|
||||
|
||||
-- close out the UI
|
||||
function renderer.close_ui()
|
||||
-- stop blinking indicators
|
||||
flasher.clear()
|
||||
|
||||
if ui.display ~= nil then
|
||||
-- stop blinking indicators
|
||||
flasher.clear()
|
||||
|
||||
-- hide to stop animation callbacks
|
||||
ui.display.hide()
|
||||
|
||||
-- clear root UI elements
|
||||
ui.display = nil
|
||||
|
||||
-- restore colors
|
||||
for i = 1, #style.colors do
|
||||
local r, g, b = term.nativePaletteColor(style.colors[i].c)
|
||||
term.setPaletteColor(style.colors[i].c, r, g, b)
|
||||
end
|
||||
|
||||
-- reset terminal
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
end
|
||||
|
||||
-- clear root UI elements
|
||||
ui.display = nil
|
||||
|
||||
-- restore colors
|
||||
for i = 1, #style.colors do
|
||||
local r, g, b = term.nativePaletteColor(style.colors[i].c)
|
||||
term.setPaletteColor(style.colors[i].c, r, g, b)
|
||||
end
|
||||
|
||||
-- reset terminal
|
||||
term.setTextColor(colors.white)
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.clear()
|
||||
term.setCursorPos(1, 1)
|
||||
end
|
||||
|
||||
-- is the UI ready?
|
||||
|
@ -28,7 +28,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||
|
||||
local RTU_VERSION = "v1.0.4"
|
||||
local RTU_VERSION = "v1.0.5"
|
||||
|
||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||
|
Loading…
Reference in New Issue
Block a user