#643 self check and backplane checks for multiple fission reactor logic adapters

This commit is contained in:
Mikayla
2025-11-13 21:54:56 +00:00
parent 4dabc3f0aa
commit d43112bdeb
4 changed files with 35 additions and 11 deletions

View File

@@ -118,6 +118,14 @@ function backplane.init(config, __shared_memory)
plc_state.reactor_formed = false
end
end
-- detect and warn about multiple reactors
if #ppm.get_all_devices("fissionReactorLogicAdapter") > 1 then
println("startup> !! DANGER !! more than one reactor was detected! do not share reactor connections between multiple PLCs! they may not all be protected and used as configured")
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")
end
end
-- get the active NIC
@@ -139,7 +147,13 @@ function backplane.attach(iface, type, device, print_no_fp)
local sys = _bp.smem.plc_sys
if type ~= nil and device ~= nil then
if state.no_reactor and (type == "fissionReactorLogicAdapter") then
if type == "fissionReactorLogicAdapter" then
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")
return
end
-- reconnected reactor
log.info("BKPLN: REACTOR LINK_UP " .. iface)
@@ -250,6 +264,14 @@ function backplane.detach(iface, type, device, print_no_fp)
state.no_reactor = true
state.degraded = true
-- 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
log.info("BKPLN: found another fission reactor logic adapter")
backplane.attach(r_iface, type, reactor, print_no_fp)
end
elseif _bp.smem.networked and type == "modem" then
---@cast device Modem

View File

@@ -141,6 +141,7 @@ local function self_check()
self.self_check_msg("> check fission reactor formed...")
-- this consumes events, but that is fine here
self.self_check_msg(nil, reactor and reactor.isFormed(), "ensure the fission reactor multiblock is formed")
self.self_check_msg("> check for no more than one reactor...", #ppm.get_all_devices("fissionReactorLogicAdapter") <= 1, "there MUST be no more than one reactor connected, as a PLC uses the first one it finds, which may not always be the same one")
self.self_check_msg("> check configuration...", valid_cfg, "go through Configure System and apply settings to set any missing settings and repair any corrupted ones")