#643 warn about report multiple logic adapters on the front panel

This commit is contained in:
Mikayla Fischler
2025-11-15 17:11:28 -05:00
parent d43112bdeb
commit 983724f45f
4 changed files with 45 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ local network = require("scada-common.network")
local ppm = require("scada-common.ppm")
local util = require("scada-common.util")
local databus = require("reactor-plc.databus")
local println = util.println
---@class plc_backplane
@@ -125,6 +127,8 @@ function backplane.init(config, __shared_memory)
log.warning("BKPLN: !! DANGER !! more than one reactor was detected on startup!")
log.warning("BKPLN: do NOT share reactor connections between multiple PLCs! they may not all be protected and used as configured")
databus.tx_multi_reactor(true)
end
end
@@ -151,6 +155,8 @@ function backplane.attach(iface, type, device, print_no_fp)
if not state.no_reactor then
log.warning("BKPLN: !! DANGER !! an additional reactor (" .. iface .. ") was connected and will not be used!")
log.warning("BKPLN: do NOT share reactor connections between multiple PLCs! they may not all be protected and used as configured")
databus.tx_multi_reactor(true)
return
end
@@ -265,6 +271,9 @@ function backplane.detach(iface, type, device, print_no_fp)
state.no_reactor = true
state.degraded = true
-- clear this tentatively, so then if there is >1, that will be reported in backplane.attach in the following if statement
databus.tx_multi_reactor(false)
-- try to find another reactor (this should not work unless multiple were incorrectly connected)
local reactor, r_iface = ppm.get_fission_reactor()
if reactor and r_iface then

View File

@@ -56,6 +56,12 @@ function databus.tx_hw_status(plc_state)
databus.ps.publish("has_wl_modem", plc_state.wl_modem)
end
-- transmiti f the reactor dangerously has multiple fission reactor logic adapters
---@param multi boolean has multiple reactors
function databus.tx_multi_reactor(multi)
databus.ps.publish("has_multi_reactor", multi)
end
-- transmit thread (routine) statuses
---@param thread string thread name
---@param ok boolean thread state

View File

@@ -2,6 +2,7 @@
-- Reactor PLC Front Panel GUI
--
local tcd = require("scada-common.tcd")
local types = require("scada-common.types")
local util = require("scada-common.util")
@@ -161,6 +162,34 @@ local function init(panel, config)
TextBox{parent=hw_labels,text="NT v"..databus.ps.get("comms_version"),fg_bg=s_hi_box}
TextBox{parent=hw_labels,text="SN "..comp_id.."-PLC",fg_bg=s_hi_box}
-- warning about multiple reactors connected
local warn_strings = { "!! DANGER !!\n>1 REACTOR\nLOGIC ADAPTER", "REMOVE\nALL BUT ONE\nLOGIC ADAPTER" }
local multi_warn = TextBox{parent=status,text=warn_strings[1],width=status.get_width()-2,alignment=ALIGN.CENTER,fg_bg=cpair(colors.yellow,colors.red),hidden=true}
local warn_toggle = true
local function flash_warn()
multi_warn.recolor(util.trinary(warn_toggle, colors.black, colors.yellow))
multi_warn.set_value(util.trinary(warn_toggle, warn_strings[2], warn_strings[1]))
warn_toggle = not warn_toggle
if databus.ps.get("has_multi_reactor") then tcd.dispatch_unique(2, flash_warn) end
end
multi_warn.register(databus.ps, "has_multi_reactor", function (v)
if v then
multi_warn.show(true)
warn_toggle = false
flash_warn()
tcd.dispatch_unique(2, flash_warn)
else
tcd.abort(flash_warn)
multi_warn.hide(true)
end
end)
--
-- rps list
--

View File

@@ -19,7 +19,7 @@ local plc = require("reactor-plc.plc")
local renderer = require("reactor-plc.renderer")
local threads = require("reactor-plc.threads")
local R_PLC_VERSION = "v1.10.0"
local R_PLC_VERSION = "v1.10.1"
local println = util.println
local println_ts = util.println_ts