Merge branch 'devel' into 580-wired-comms-networking

This commit is contained in:
Mikayla
2025-09-30 13:08:45 +00:00
46 changed files with 1542 additions and 350 deletions

View File

@@ -195,12 +195,12 @@ local function self_check()
valid = is_int_min_max(entry.unit, 1, 4)
elseif p_type == "dynamicValve" then
valid = (entry.unit == nil and is_int_min_max(entry.index, 1, 4)) or is_int_min_max(entry.unit, 1, 4)
elseif p_type == "environmentDetector" then
elseif p_type == "environmentDetector" or p_type == "environment_detector" then
valid = (entry.unit == nil or is_int_min_max(entry.unit, 1, 4)) and util.is_int(entry.index)
else
valid = true
if p_type ~= nil and not (p_type == "inductionPort" or p_type == "spsPort") then
if p_type ~= nil and not (p_type == "inductionPort" or p_type == "reinforcedInductionPort" or p_type == "spsPort") then
self.self_check_msg("> check " .. entry.name .. " valid...", false, "unrecognized device type")
end
end

View File

@@ -43,8 +43,8 @@ local self = {
local peripherals = {}
local RTU_DEV_TYPES = { "boilerValve", "turbineValve", "dynamicValve", "inductionPort", "spsPort", "solarNeutronActivator", "environmentDetector" }
local NEEDS_UNIT = { "boilerValve", "turbineValve", "dynamicValve", "solarNeutronActivator", "environmentDetector" }
local RTU_DEV_TYPES = { "boilerValve", "turbineValve", "dynamicValve", "inductionPort", "reinforcedInductionPort", "spsPort", "solarNeutronActivator", "environmentDetector", "environment_detector" }
local NEEDS_UNIT = { "boilerValve", "turbineValve", "dynamicValve", "solarNeutronActivator", "environmentDetector", "environment_detector" }
-- create the peripherals configuration view
---@param tool_ctl _rtu_cfg_tool_ctl
@@ -165,14 +165,14 @@ function peripherals.create(tool_ctl, main_pane, cfg_sys, peri_cfg, style)
end
self.p_desc.set_value("Each reactor unit can have at most 1 tank and the facility can have at most 4. Each facility tank must have a unique # 1 through 4, regardless of where it is connected. Only a total of 4 tanks can be displayed on the flow monitor.")
elseif type == "environmentDetector" then
elseif type == "environmentDetector" or type == "environment_detector" then
reposition("This is the below system's # env. detector.", 29, 99, 17, 6, 8)
self.p_assign_btn.show()
self.p_assign_btn.redraw()
if self.p_assign_btn.get_value() == 1 then self.p_unit.disable() else self.p_unit.enable() end
self.p_desc.set_value("You can connect more than one environment detector for a particular unit or the facility. In that case, the maximum radiation reading from those assigned to that particular unit or the facility will be used for alarms and display.")
elseif type == "inductionPort" or type == "spsPort" then
local dev = tri(type == "inductionPort", "induction matrix", "SPS")
elseif type == "inductionPort" or type == "reinforcedInductionPort" or type == "spsPort" then
local dev = tri(type == "inductionPort" or type == "reinforcedInductionPort", "induction matrix", "SPS")
self.p_idx.hide(true)
self.p_unit.hide(true)
self.p_prompt.set_value("This is the " .. dev .. " for the facility.")
@@ -212,10 +212,10 @@ function peripherals.create(tool_ctl, main_pane, cfg_sys, peri_cfg, style)
tool_ctl.update_peri_list()
TextBox{parent=peri_c_3,x=1,y=1,height=4,text="This feature is intended for advanced users. If you are clicking this just because your device is not shown, follow the connection instructions in 'I don't see my device!'."}
TextBox{parent=peri_c_3,x=1,y=6,height=4,text="Peripheral Name"}
local p_name = TextField{parent=peri_c_3,x=1,y=7,width=49,height=1,max_len=128,fg_bg=bw_fg_bg}
local p_type = Radio2D{parent=peri_c_3,x=1,y=9,rows=4,columns=2,default=1,options=RTU_DEV_TYPES,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.purple}
TextBox{parent=peri_c_3,x=1,y=1,height=4,text="This feature is intended for advanced users. If you just can't see your device, click 'I don't see my device!' instead."}
TextBox{parent=peri_c_3,x=1,y=5,height=4,text="Peripheral Name"}
local p_name = TextField{parent=peri_c_3,x=1,y=6,width=49,height=1,max_len=128,fg_bg=bw_fg_bg}
local p_type = Radio2D{parent=peri_c_3,x=1,y=8,rows=5,columns=2,default=1,options=RTU_DEV_TYPES,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.purple}
local man_p_err = TextBox{parent=peri_c_3,x=8,y=14,width=35,text="Please enter a peripheral name.",fg_bg=cpair(colors.red,colors.lightGray),hidden=true}
man_p_err.hide(true)
@@ -281,7 +281,7 @@ function peripherals.create(tool_ctl, main_pane, cfg_sys, peri_cfg, style)
local idx = tonumber(self.p_idx.get_value())
if util.table_contains(NEEDS_UNIT, peri_type) then
if (peri_type == "dynamicValve" or peri_type == "environmentDetector") and for_facility then
if (peri_type == "dynamicValve" or peri_type == "environmentDetector" or peri_type == "environment_detector") and for_facility then
-- skip
elseif not (util.is_int(u) and u > 0 and u < 5) then
self.p_err.set_value("Unit ID must be within 1 to 4.")
@@ -310,7 +310,7 @@ function peripherals.create(tool_ctl, main_pane, cfg_sys, peri_cfg, style)
else index = idx end
elseif peri_type == "dynamicValve" then
index = 1
elseif peri_type == "environmentDetector" then
elseif peri_type == "environmentDetector" or peri_type == "environment_detector" then
if not (util.is_int(idx) and idx > 0) then
self.p_err.set_value("Index must be greater than 0.")
self.p_err.show()

View File

@@ -506,7 +506,7 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, ext, style)
local u, idx = def.unit, def.index
if util.table_contains(NEEDS_UNIT, mount.type) then
if (mount.type == "dynamicValve" or mount.type == "environmentDetector") and for_facility then
if (mount.type == "dynamicValve" or mount.type == "environmentDetector" or mount.type == "environment_detector") and for_facility then
-- skip
elseif not (util.is_int(u) and u > 0 and u < 5) then
err = true
@@ -527,7 +527,7 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, ext, style)
else index = idx end
elseif mount.type == "dynamicValve" then
index = 1
elseif mount.type == "environmentDetector" then
elseif mount.type == "environmentDetector" or mount.type == "environment_detector" then
if not (util.is_int(idx) and idx > 0) then
err = true
else index = idx end

View File

@@ -31,7 +31,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.12.2"
local RTU_VERSION = "v1.12.3"
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
local RTU_HW_STATE = databus.RTU_HW_STATE
@@ -439,8 +439,8 @@ local function main()
println_ts(util.c("sys_config> failed to check if '", name, "' is formed"))
log.warning(util.c("sys_config> failed to check if '", name, "' is a formed dynamic tank multiblock"))
end
elseif type == "inductionPort" then
-- induction matrix multiblock
elseif type == "inductionPort" or type == "reinforcedInductionPort" then
-- induction matrix multiblock (normal or reinforced)
if not validate_assign(true) then return false end
rtu_type = RTU_UNIT_TYPE.IMATRIX
@@ -471,7 +471,7 @@ local function main()
rtu_type = RTU_UNIT_TYPE.SNA
rtu_iface, faulted = sna_rtu.new(device)
elseif type == "environmentDetector" then
elseif type == "environmentDetector" or type == "environment_detector" then
-- advanced peripherals environment detector
if not validate_index(1) then return false end
if not validate_assign(entry.unit == nil) then return false end

View File

@@ -74,7 +74,7 @@ local function handle_unit_mount(smem, println_ts, iface, type, device, unit)
end
unit.type = RTU_UNIT_TYPE.DYNAMIC_VALVE
elseif type == "inductionPort" then
elseif type == "inductionPort" or type == "reinforcedInductionPort" then
-- induction matrix multiblock
if unit.reactor ~= 0 then fail(util.c("induction matrix '", unit.name, "' cannot init, not assigned to facility")) end
@@ -89,7 +89,7 @@ local function handle_unit_mount(smem, println_ts, iface, type, device, unit)
if unit.reactor < 1 or unit.reactor > 4 then fail(util.c("SNA '", unit.name, "' cannot init, not assigned to a valid unit")) end
unit.type = RTU_UNIT_TYPE.SNA
elseif type == "environmentDetector" then
elseif type == "environmentDetector" or type == "environment_detector" then
-- advanced peripherals environment detector
if unit.reactor < 0 or unit.reactor > 4 then fail(util.c("environment detector '", unit.name, "' cannot init, no valid assignment provided")) end
if (unit.index == false) or unit.index < 1 then fail(util.c("environment detector '", unit.name, "' cannot init, invalid index provided")) end