From 8cd51623628cc0b90eeed802f5eba3a343ded156 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sat, 30 Dec 2023 20:18:58 -0500 Subject: [PATCH] fixed PLCs not connecting, fixed facility tank mode checkbox not changing after import, and reordered info on tank mode vis about page --- supervisor/configure.lua | 8 +++++--- supervisor/session/svsessions.lua | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/supervisor/configure.lua b/supervisor/configure.lua index 190fd9b..bfe0ed7 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -307,7 +307,7 @@ local function config_view(display) TextBox{parent=svr_c_3,x=1,y=1,height=6,text="You have set one or more of your units to use dynamic tanks for emergency coolant. You have two paths for configuration. The first is to assign dynamic tanks to reactor units; one tank per reactor, only connected to that reactor. RTU configurations must also assign it as such."} TextBox{parent=svr_c_3,x=1,y=8,height=3,text="Alternatively, you can configure them as facility tanks to connect to multiple reactor units. These can intermingle with unit-specific tanks."} - local en_fac_tanks = CheckBox{parent=svr_c_3,x=1,y=12,label="Use Facility Dynamic Tanks",default=ini_cfg.FacilityTankMode~=0,box_fg_bg=cpair(colors.green,colors.black)} + local en_fac_tanks = CheckBox{parent=svr_c_3,x=1,y=12,label="Use Facility Dynamic Tanks",default=ini_cfg.FacilityTankMode>0,box_fg_bg=cpair(colors.green,colors.black)} local function submit_en_fac_tank() if en_fac_tanks.get_value() then @@ -559,8 +559,8 @@ local function config_view(display) PushButton{parent=svr_c_5,x=8,y=14,min_width=7,text="About",callback=function()svr_pane.set_value(6)end,fg_bg=cpair(colors.black,colors.lightBlue),active_fg_bg=btn_act_fg_bg} TextBox{parent=svr_c_6,height=3,text="This visualization tool shows the pipe connections required for a particular dynamic tank configuration you have selected."} - TextBox{parent=svr_c_6,y=5,height=3,text="Some modes may look the same if you are not using 4 total reactor units. The wiki has details. Modes that look the same will function the same."} - TextBox{parent=svr_c_6,y=9,height=4,text="Examples: A U2 tank should be configured on an RTU as a dynamic tank for unit 2. An F3 tank should be configured on an RTU as the #3 dynamic tank for the facility."} + TextBox{parent=svr_c_6,y=5,height=4,text="Examples: A U2 tank should be configured on an RTU as the dynamic tank for unit #2. An F3 tank should be configured on an RTU as the #3 dynamic tank for the facility."} + TextBox{parent=svr_c_6,y=10,height=3,text="Some modes may look the same if you are not using 4 total reactor units. The wiki has details. Modes that look the same will function the same.",fg_bg=g_lg_fg_bg} PushButton{parent=svr_c_6,x=1,y=14,text="\x1b Back",callback=function()svr_pane.set_value(5)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} @@ -793,6 +793,8 @@ local function config_view(display) try_set(tool_ctl.tank_elems[i].tank_opt, ini_cfg.FacilityTankDefs[i]) end + en_fac_tanks.set_value(ini_cfg.FacilityTankMode > 0) + tool_ctl.view_cfg.enable() if tool_ctl.importing_legacy then diff --git a/supervisor/session/svsessions.lua b/supervisor/session/svsessions.lua index 68d2587..e191db6 100644 --- a/supervisor/session/svsessions.lua +++ b/supervisor/session/svsessions.lua @@ -35,7 +35,6 @@ local self = { nic = nil, ---@type nic|nil fp_ok = false, config = nil, ---@type svr_config - num_reactors = 0, facility = nil, ---@type facility|nil sessions = { rtu = {}, plc = {}, crd = {}, pdg = {} }, next_ids = { rtu = 0, plc = 0, crd = 0, pdg = 0 } @@ -279,7 +278,7 @@ end ---@param version string ---@return integer|false session_id function svsessions.establish_plc_session(source_addr, for_reactor, version) - if svsessions.get_reactor_session(for_reactor) == nil and for_reactor >= 1 and for_reactor <= self.num_reactors then + if svsessions.get_reactor_session(for_reactor) == nil and for_reactor >= 1 and for_reactor <= self.config.UnitCount then ---@class plc_session_struct local plc_s = { s_type = "plc",