diff --git a/rtu/config/check.lua b/rtu/config/check.lua index bc3f6d5..fbc7c4c 100644 --- a/rtu/config/check.lua +++ b/rtu/config/check.lua @@ -195,7 +195,7 @@ 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 diff --git a/rtu/config/peripherals.lua b/rtu/config/peripherals.lua index e214379..cbb3a06 100644 --- a/rtu/config/peripherals.lua +++ b/rtu/config/peripherals.lua @@ -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", "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,7 +165,7 @@ 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() @@ -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() diff --git a/rtu/config/system.lua b/rtu/config/system.lua index d29b1ec..27beef7 100644 --- a/rtu/config/system.lua +++ b/rtu/config/system.lua @@ -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 diff --git a/rtu/startup.lua b/rtu/startup.lua index d3812c6..d7cfe97 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -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.1" +local RTU_VERSION = "v1.12.2" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_HW_STATE = databus.RTU_HW_STATE @@ -472,7 +472,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 diff --git a/rtu/threads.lua b/rtu/threads.lua index e036a4e..ac875aa 100644 --- a/rtu/threads.lua +++ b/rtu/threads.lua @@ -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