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
|
if engine.monitors.primary == periph then
|
||||||
return true
|
return true
|
||||||
else
|
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
|
if monitor == periph then return true end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -72,7 +72,7 @@ function renderer.init_displays()
|
|||||||
_init_display(engine.monitors.primary)
|
_init_display(engine.monitors.primary)
|
||||||
|
|
||||||
-- init unit displays
|
-- init unit displays
|
||||||
for _, monitor in ipairs(engine.monitors.units) do
|
for _, monitor in ipairs(engine.monitors.unit_displays) do
|
||||||
_init_display(monitor)
|
_init_display(monitor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -91,7 +91,7 @@ end
|
|||||||
function renderer.validate_unit_display_sizes()
|
function renderer.validate_unit_display_sizes()
|
||||||
local valid = true
|
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()
|
local w, h = monitor.getSize()
|
||||||
if w ~= 79 or h ~= 52 then
|
if w ~= 79 or h ~= 52 then
|
||||||
log.warning(util.c("RENDERER: unit ", id, " display resolution not 79 wide by 52 tall: ", w, ", ", h))
|
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)
|
main_view(engine.ui.main_display)
|
||||||
|
|
||||||
-- show unit views on unit displays
|
-- show unit views on unit displays
|
||||||
for i = 1, #engine.monitors.units do
|
for i = 1, #engine.monitors.unit_displays do
|
||||||
engine.ui.unit_displays[i] = DisplayBox{window=engine.monitors.units[i],fg_bg=style.root}
|
engine.ui.unit_displays[i] = DisplayBox{window=engine.monitors.unit_displays[i],fg_bg=style.root}
|
||||||
unit_view(engine.ui.unit_displays[i], i)
|
unit_view(engine.ui.unit_displays[i], i)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ function renderer.close_ui()
|
|||||||
engine.ui.unit_displays = {}
|
engine.ui.unit_displays = {}
|
||||||
|
|
||||||
-- clear unit monitors
|
-- 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
|
-- re-draw dmesg
|
||||||
engine.dmesg_window.setVisible(true)
|
engine.dmesg_window.setVisible(true)
|
||||||
|
@ -71,8 +71,8 @@ function api.new_session(id, in_queue, out_queue, timeout)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- send a CAPI packet
|
-- send a CAPI packet
|
||||||
---@param msg_type CAPI_TYPE
|
-----@param msg_type CAPI_TYPE
|
||||||
---@param msg table
|
-----@param msg table
|
||||||
-- local function _send(msg_type, msg)
|
-- local function _send(msg_type, msg)
|
||||||
-- local s_pkt = comms.scada_packet()
|
-- local s_pkt = comms.scada_packet()
|
||||||
-- local c_pkt = comms.capi_packet()
|
-- local c_pkt = comms.capi_packet()
|
||||||
|
@ -20,7 +20,7 @@ local sounder = require("coordinator.sounder")
|
|||||||
|
|
||||||
local apisessions = require("coordinator.session.apisessions")
|
local apisessions = require("coordinator.session.apisessions")
|
||||||
|
|
||||||
local COORDINATOR_VERSION = "v0.13.7"
|
local COORDINATOR_VERSION = "v0.13.8"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
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
|
end
|
||||||
|
|
||||||
-- send a packet to the coordinator API
|
-- send a packet to the coordinator API
|
||||||
---@param msg_type CAPI_TYPE
|
-----@param msg_type CAPI_TYPE
|
||||||
---@param msg table
|
-----@param msg table
|
||||||
-- local function _send_api(msg_type, msg)
|
-- local function _send_api(msg_type, msg)
|
||||||
-- local s_pkt = comms.scada_packet()
|
-- local s_pkt = comms.scada_packet()
|
||||||
-- local pkt = comms.capi_packet()
|
-- local pkt = comms.capi_packet()
|
||||||
|
@ -40,13 +40,12 @@ end
|
|||||||
|
|
||||||
-- close out the UI
|
-- close out the UI
|
||||||
function renderer.close_ui()
|
function renderer.close_ui()
|
||||||
|
if ui.display ~= nil then
|
||||||
-- stop blinking indicators
|
-- stop blinking indicators
|
||||||
flasher.clear()
|
flasher.clear()
|
||||||
|
|
||||||
if ui.display ~= nil then
|
|
||||||
-- hide to stop animation callbacks
|
-- hide to stop animation callbacks
|
||||||
ui.display.hide()
|
ui.display.hide()
|
||||||
end
|
|
||||||
|
|
||||||
-- clear root UI elements
|
-- clear root UI elements
|
||||||
ui.display = nil
|
ui.display = nil
|
||||||
@ -62,6 +61,7 @@ function renderer.close_ui()
|
|||||||
term.setBackgroundColor(colors.black)
|
term.setBackgroundColor(colors.black)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1, 1)
|
term.setCursorPos(1, 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- is the UI ready?
|
-- is the UI ready?
|
||||||
|
@ -104,7 +104,7 @@ local function main()
|
|||||||
local ui_ok, message = pcall(renderer.start_ui)
|
local ui_ok, message = pcall(renderer.start_ui)
|
||||||
if not ui_ok then
|
if not ui_ok then
|
||||||
renderer.close_ui()
|
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))
|
log.error(util.c("startup> GUI crashed with error ", message))
|
||||||
else
|
else
|
||||||
-- start clock
|
-- start clock
|
||||||
|
@ -40,13 +40,12 @@ end
|
|||||||
|
|
||||||
-- close out the UI
|
-- close out the UI
|
||||||
function renderer.close_ui()
|
function renderer.close_ui()
|
||||||
|
if ui.display ~= nil then
|
||||||
-- stop blinking indicators
|
-- stop blinking indicators
|
||||||
flasher.clear()
|
flasher.clear()
|
||||||
|
|
||||||
if ui.display ~= nil then
|
|
||||||
-- hide to stop animation callbacks
|
-- hide to stop animation callbacks
|
||||||
ui.display.hide()
|
ui.display.hide()
|
||||||
end
|
|
||||||
|
|
||||||
-- clear root UI elements
|
-- clear root UI elements
|
||||||
ui.display = nil
|
ui.display = nil
|
||||||
@ -62,6 +61,7 @@ function renderer.close_ui()
|
|||||||
term.setBackgroundColor(colors.black)
|
term.setBackgroundColor(colors.black)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1, 1)
|
term.setCursorPos(1, 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- is the UI ready?
|
-- is the UI ready?
|
||||||
|
@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
|
|||||||
local renderer = require("reactor-plc.renderer")
|
local renderer = require("reactor-plc.renderer")
|
||||||
local threads = require("reactor-plc.threads")
|
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 = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
@ -41,13 +41,12 @@ end
|
|||||||
|
|
||||||
-- close out the UI
|
-- close out the UI
|
||||||
function renderer.close_ui()
|
function renderer.close_ui()
|
||||||
|
if ui.display ~= nil then
|
||||||
-- stop blinking indicators
|
-- stop blinking indicators
|
||||||
flasher.clear()
|
flasher.clear()
|
||||||
|
|
||||||
if ui.display ~= nil then
|
|
||||||
-- hide to stop animation callbacks
|
-- hide to stop animation callbacks
|
||||||
ui.display.hide()
|
ui.display.hide()
|
||||||
end
|
|
||||||
|
|
||||||
-- clear root UI elements
|
-- clear root UI elements
|
||||||
ui.display = nil
|
ui.display = nil
|
||||||
@ -63,6 +62,7 @@ function renderer.close_ui()
|
|||||||
term.setBackgroundColor(colors.black)
|
term.setBackgroundColor(colors.black)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1, 1)
|
term.setCursorPos(1, 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- is the UI ready?
|
-- 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 sps_rtu = require("rtu.dev.sps_rtu")
|
||||||
local turbinev_rtu = require("rtu.dev.turbinev_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_TYPE = types.RTU_UNIT_TYPE
|
||||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||||
|
Loading…
Reference in New Issue
Block a user