diff --git a/coordinator/ui/components/unit_flow.lua b/coordinator/ui/components/unit_flow.lua index 27e4d0d..f0813f7 100644 --- a/coordinator/ui/components/unit_flow.lua +++ b/coordinator/ui/components/unit_flow.lua @@ -2,8 +2,11 @@ -- Basic Unit Flow Overview -- +local types = require("scada-common.types") local util = require("scada-common.util") +local iocontrol = require("coordinator.iocontrol") + local style = require("coordinator.ui.style") local core = require("graphics.core") @@ -19,6 +22,8 @@ local DataIndicator = require("graphics.elements.indicators.DataIndicator") local IndicatorLight = require("graphics.elements.indicators.IndicatorLight") local TriIndicatorLight = require("graphics.elements.indicators.TriIndicatorLight") +local COOLANT_TYPE = types.COOLANT_TYPE + local ALIGN = core.ALIGN local sprintf = util.sprintf @@ -35,8 +40,8 @@ local lg_gray = style.lg_gray ---@param x integer top left x ---@param y integer top left y ---@param wide boolean whether to render wide version ----@param unit ioctl_unit unit database entry -local function make(parent, x, y, wide, unit) +---@param unit_id integer unit index +local function make(parent, x, y, wide, unit_id) local s_field = style.theme.field_box local text_c = style.text_colors @@ -48,6 +53,13 @@ local function make(parent, x, y, wide, unit) local height = 16 + local facility = iocontrol.get_db().facility + local unit = iocontrol.get_db().units[unit_id] + + local tank_defs = facility.tank_defs + local tank_conns = facility.tank_conns + local tank_types = facility.tank_fluid_types + local v_start = 1 + ((unit.unit_id - 1) * 5) local prv_start = 1 + ((unit.unit_id - 1) * 3) local v_fields = { "pu", "po", "pl", "am" } @@ -80,21 +92,22 @@ local function make(parent, x, y, wide, unit) local rc_pipes = {} - local emc_x = 42 -- emergency coolant connection x point - if unit.num_boilers > 0 then table.insert(rc_pipes, pipe(0, 1, _wide(28, 19), 1, colors.lightBlue, true)) table.insert(rc_pipes, pipe(0, 3, _wide(28, 19), 3, colors.orange, true)) table.insert(rc_pipes, pipe(_wide(46 ,39), 1, _wide(72,58), 1, colors.blue, true)) table.insert(rc_pipes, pipe(_wide(46,39), 3, _wide(72,58), 3, colors.white, true)) else - emc_x = 3 table.insert(rc_pipes, pipe(0, 1, _wide(72,58), 1, colors.blue, true)) table.insert(rc_pipes, pipe(0, 3, _wide(72,58), 3, colors.white, true)) end if unit.has_tank then - table.insert(rc_pipes, pipe(emc_x, 1, emc_x, 0, colors.blue, true, true)) + local is_water = tank_types[tank_conns[unit_id]] == COOLANT_TYPE.WATER + -- emergency coolant connection x point + local emc_x = util.trinary(is_water and (unit.num_boilers > 0), 42, 3) + + table.insert(rc_pipes, pipe(emc_x, 1, emc_x, 0, util.trinary(is_water, colors.blue, colors.lightBlue), true, true)) end local prv_yo = math.max(3 - unit.num_turbines, 0) diff --git a/coordinator/ui/layout/flow_view.lua b/coordinator/ui/layout/flow_view.lua index 8a552a2..bf90a9c 100644 --- a/coordinator/ui/layout/flow_view.lua +++ b/coordinator/ui/layout/flow_view.lua @@ -67,7 +67,7 @@ local function init(main) -- get the coolant color ---@param idx integer tank index - local function c_clr(idx) return util.trinary(tank_types[tank_conns[idx]] == COOLANT_TYPE.WATER, colors.blue, colors.cyan) end + local function c_clr(idx) return util.trinary(tank_types[tank_conns[idx]] == COOLANT_TYPE.WATER, colors.blue, colors.lightBlue) end -- determinte facility tank start/end from the definitions list ---@param start_idx integer start index of table iteration @@ -128,9 +128,9 @@ local function init(main) table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true)) elseif i > first_fdef then if i == last_fdef then - table.insert(emcool_pipes, pipe(0, y - 14, 0, y, color, true)) + table.insert(emcool_pipes, pipe(0, y - 14, 0, y, c_clr(first_fdef), true)) elseif i < last_fdef then - table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, color, true)) + table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, c_clr(first_fdef), true)) end end end @@ -268,7 +268,7 @@ local function init(main) for i = 1, facility.num_units do local y_offset = y_ofs(i) - unit_flow(main, flow_x, 5 + y_offset, #emcool_pipes == 0, units[i]) + unit_flow(main, flow_x, 5 + y_offset, #emcool_pipes == 0, i) table.insert(po_pipes, pipe(0, 3 + y_offset, 4, 0, colors.cyan, true, true)) util.nop() end @@ -323,8 +323,10 @@ local function init(main) local tank_pcnt = DataIndicator{parent=tank_box,x=10,y=3,label="",format="%5.2f",value=100,unit="%",lu_colors=lu_col,width=8,fg_bg=text_col} local tank_amnt = DataIndicator{parent=tank_box,x=2,label="",format="%13d",value=0,commas=true,unit="mB",lu_colors=lu_col,width=16,fg_bg=s_field} - TextBox{parent=tank_box,x=2,y=6,text=util.trinary(tank_types[i]==COOLANT_TYPE.WATER,"Water","Sodium").." Level",width=11,fg_bg=style.label} - local level = HorizontalBar{parent=tank_box,x=2,y=7,bar_fg_bg=cpair(util.trinary(tank_types[i]==COOLANT_TYPE.WATER,colors.blue,colors.cyan),colors.gray),height=1,width=16} + local is_water = tank_types[i] == COOLANT_TYPE.WATER + + TextBox{parent=tank_box,x=2,y=6,text=util.trinary(is_water,"Water","Sodium").." Level",width=12,fg_bg=style.label} + local level = HorizontalBar{parent=tank_box,x=2,y=7,bar_fg_bg=cpair(util.trinary(is_water,colors.blue,colors.lightBlue),colors.gray),height=1,width=16} TextBox{parent=tank_box,x=2,y=9,text="In/Out Mode",width=11,fg_bg=style.label} local can_fill = IndicatorLight{parent=tank_box,x=2,y=10,label="FILL",colors=style.ind_wht} diff --git a/scada-common/types.lua b/scada-common/types.lua index 92402b8..0d562a6 100644 --- a/scada-common/types.lua +++ b/scada-common/types.lua @@ -420,8 +420,8 @@ types.AUTO_GROUP_NAMES = { ---@enum COOLANT_TYPE types.COOLANT_TYPE = { - WATER = 0, - SODIUM = 1 + WATER = 1, + SODIUM = 2 } ---@enum WASTE_MODE diff --git a/scada-common/util.lua b/scada-common/util.lua index 3023a49..96c1ec8 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -24,7 +24,7 @@ local t_pack = table.pack local util = {} -- scada-common version -util.version = "1.4.7" +util.version = "1.4.8" util.TICK_TIME_S = 0.05 util.TICK_TIME_MS = 50 diff --git a/supervisor/config/facility.lua b/supervisor/config/facility.lua index b8b4a18..7e64f97 100644 --- a/supervisor/config/facility.lua +++ b/supervisor/config/facility.lua @@ -29,6 +29,138 @@ local self = { local facility = {} +-- generate the tank list and tank connections tables +---@param mode integer facility tank mode +---@param defs table facility tank definitions +---@return table tank_list +---@return table tank_conns +local function generate_tank_list_and_conns(mode, defs) + local tank_mode = mode + local tank_defs = defs + local tank_list = { table.unpack(tank_defs) } + local tank_conns = { table.unpack(tank_defs) } + + local function calc_fdef(start_idx, end_idx) + local first = 4 + for i = start_idx, end_idx do + if tank_defs[i] == 2 then + if i < first then first = i end + end + end + return first + end + + -- set units using their own tanks as connected to their respective unit tank + for i = 1, #tank_defs do + if tank_defs[i] == 1 then tank_conns[i] = i end + end + + if tank_mode == 1 then + -- (1) 1 total facility tank (A A A A) + local first_fdef = calc_fdef(1, #tank_defs) + for i = 1, #tank_defs do + if (i >= first_fdef) and (tank_defs[i] == 2) then + tank_conns[i] = first_fdef + + if i > first_fdef then tank_list[i] = 0 end + end + end + elseif tank_mode == 2 then + -- (2) 2 total facility tanks (A A A B) + local first_fdef = calc_fdef(1, math.min(3, #tank_defs)) + for i = 1, #tank_defs do + if (i >= first_fdef) and (tank_defs[i] == 2) then + if i == 4 then + tank_conns[i] = 4 + else + tank_conns[i] = first_fdef + + if i > first_fdef then tank_list[i] = 0 end + end + end + end + elseif tank_mode == 3 then + -- (3) 2 total facility tanks (A A B B) + for _, a in pairs({ 1, 3 }) do + local b = a + 1 + + if tank_defs[a] == 2 then + tank_conns[a] = a + elseif tank_defs[b] == 2 then + tank_conns[b] = b + end + + if (tank_defs[a] == 2) and (tank_defs[b] == 2) then + tank_list[b] = 0 + tank_conns[b] = a + end + end + elseif tank_mode == 4 then + -- (4) 2 total facility tanks (A B B B) + local first_fdef = calc_fdef(2, #tank_defs) + for i = 1, #tank_defs do + if tank_defs[i] == 2 then + if i == 1 then + tank_conns[i] = 1 + elseif i >= first_fdef then + tank_conns[i] = first_fdef + + if i > first_fdef then tank_list[i] = 0 end + end + end + end + elseif tank_mode == 5 then + -- (5) 3 total facility tanks (A A B C) + local first_fdef = calc_fdef(1, math.min(2, #tank_defs)) + for i = 1, #tank_defs do + if (i >= first_fdef) and (tank_defs[i] == 2) then + if i == 3 or i == 4 then + tank_conns[i] = i + elseif i >= first_fdef then + tank_conns[i] = first_fdef + + if i > first_fdef then tank_list[i] = 0 end + end + end + end + elseif tank_mode == 6 then + -- (6) 3 total facility tanks (A B B C) + local first_fdef = calc_fdef(2, math.min(3, #tank_defs)) + for i = 1, #tank_defs do + if tank_defs[i] == 2 then + if i == 1 or i == 4 then + tank_conns[i] = i + elseif i >= first_fdef then + tank_conns[i] = first_fdef + + if i > first_fdef then tank_list[i] = 0 end + end + end + end + elseif tank_mode == 7 then + -- (7) 3 total facility tanks (A B C C) + local first_fdef = calc_fdef(3, #tank_defs) + for i = 1, #tank_defs do + if tank_defs[i] == 2 then + if i == 1 or i == 2 then + tank_conns[i] = i + elseif i >= first_fdef then + tank_conns[i] = first_fdef + + if i > first_fdef then tank_list[i] = 0 end + end + end + end + elseif tank_mode == 8 then + -- (8) 4 total facility tanks (A B C D) + for i = 1, #tank_defs do + if tank_defs[i] == 2 then tank_conns[i] = i end + end + end + + return tank_list, tank_conns +end + -- create the facility configuration view ---@param tool_ctl _svr_cfg_tool_ctl ---@param main_pane MultiPane @@ -178,10 +310,12 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) -- on facility tank mode 0, setup tank defs to match unit tank option for i = 1, tmp_cfg.UnitCount do - tmp_cfg.FacilityTankDefs[i] = util.trinary(tmp_cfg.CoolingConfig[i].TankConnection, 1, 0) + tmp_cfg.FacilityTankDefs[i] = tri(tmp_cfg.CoolingConfig[i].TankConnection, 1, 0) end - tmp_cfg.FacilityTankList = { table.unpack(tmp_cfg.FacilityTankDefs) } + tmp_cfg.FacilityTankList, tmp_cfg.FacilityTankConns = generate_tank_list_and_conns(tmp_cfg.FacilityTankMode, tmp_cfg.FacilityTankDefs) + + self.draw_fluid_ops() fac_pane.set_value(7) end @@ -429,132 +563,7 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) local function next_from_tank_mode() -- determine tank list and connections - - local tank_mode = tmp_cfg.FacilityTankMode - local tank_defs = tmp_cfg.FacilityTankDefs - local tank_list = { table.unpack(tank_defs) } - local tank_conns = { table.unpack(tank_defs) } - - local function calc_fdef(start_idx, end_idx) - local first = 4 - for i = start_idx, end_idx do - if tank_defs[i] == 2 then - if i < first then first = i end - end - end - return first - end - - -- set units using their own tanks as connected to their respective unit tank - for i = 1, #tank_defs do - if tank_defs[i] == 1 then tank_conns[i] = i end - end - - if tank_mode == 1 then - -- (1) 1 total facility tank (A A A A) - local first_fdef = calc_fdef(1, #tank_defs) - for i = 1, #tank_defs do - if (i >= first_fdef) and (tank_defs[i] == 2) then - tank_conns[i] = first_fdef - - if i > first_fdef then tank_list[i] = 0 end - end - end - elseif tank_mode == 2 then - -- (2) 2 total facility tanks (A A A B) - local first_fdef = calc_fdef(1, math.min(3, #tank_defs)) - for i = 1, #tank_defs do - if (i >= first_fdef) and (tank_defs[i] == 2) then - if i == 4 then - tank_conns[i] = 4 - else - tank_conns[i] = first_fdef - - if i > first_fdef then tank_list[i] = 0 end - end - end - end - elseif tank_mode == 3 then - -- (3) 2 total facility tanks (A A B B) - for _, a in pairs({ 1, 3 }) do - local b = a + 1 - - if tank_defs[a] == 2 then - tank_conns[a] = a - elseif tank_defs[b] == 2 then - tank_conns[b] = b - end - - if (tank_defs[a] == 2) and (tank_defs[b] == 2) then - tank_list[b] = 0 - tank_conns[b] = a - end - end - elseif tank_mode == 4 then - -- (4) 2 total facility tanks (A B B B) - local first_fdef = calc_fdef(2, #tank_defs) - for i = 1, #tank_defs do - if tank_defs[i] == 2 then - if i == 1 then - tank_conns[i] = 1 - elseif i >= first_fdef then - tank_conns[i] = first_fdef - - if i > first_fdef then tank_list[i] = 0 end - end - end - end - elseif tank_mode == 5 then - -- (5) 3 total facility tanks (A A B C) - local first_fdef = calc_fdef(1, math.min(2, #tank_defs)) - for i = 1, #tank_defs do - if (i >= first_fdef) and (tank_defs[i] == 2) then - if i == 3 or i == 4 then - tank_conns[i] = i - elseif i >= first_fdef then - tank_conns[i] = first_fdef - - if i > first_fdef then tank_list[i] = 0 end - end - end - end - elseif tank_mode == 6 then - -- (6) 3 total facility tanks (A B B C) - local first_fdef = calc_fdef(2, math.min(3, #tank_defs)) - for i = 1, #tank_defs do - if tank_defs[i] == 2 then - if i == 1 or i == 4 then - tank_conns[i] = i - elseif i >= first_fdef then - tank_conns[i] = first_fdef - - if i > first_fdef then tank_list[i] = 0 end - end - end - end - elseif tank_mode == 7 then - -- (7) 3 total facility tanks (A B C C) - local first_fdef = calc_fdef(3, #tank_defs) - for i = 1, #tank_defs do - if tank_defs[i] == 2 then - if i == 1 or i == 2 then - tank_conns[i] = i - elseif i >= first_fdef then - tank_conns[i] = first_fdef - - if i > first_fdef then tank_list[i] = 0 end - end - end - end - elseif tank_mode == 8 then - -- (8) 4 total facility tanks (A B C D) - for i = 1, #tank_defs do - if tank_defs[i] == 2 then tank_conns[i] = i end - end - end - - tmp_cfg.FacilityTankList = tank_list - tmp_cfg.FacilityTankConns = tank_conns + tmp_cfg.FacilityTankList, tmp_cfg.FacilityTankConns = generate_tank_list_and_conns(tmp_cfg.FacilityTankMode, tmp_cfg.FacilityTankDefs) self.draw_fluid_ops() @@ -578,7 +587,7 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) --#endregion --#region Dynamic Tank Fluid Types - TextBox{parent=fac_c_7,height=3,text="Specify the type of coolant each tank will contain. This only affects visualizations, not operation. You cannot set Sodium if one or more of the connected reactors is water cooled."} + TextBox{parent=fac_c_7,height=3,text="Specify the type of coolant each tank will contain, for display use only. Water is the only option if one or more of the connected units is water cooled."} local tank_fluid_list = Div{parent=fac_c_7,x=1,y=5,height=8} @@ -591,15 +600,17 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) local next_f = 1 for i = 1, #tank_list do + local type = tmp_cfg.TankFluidTypes[i] + self.tank_fluid_opts[i] = nil if tank_list[i] == 1 then local row = Div{parent=tank_fluid_list,height=2} TextBox{parent=row,width=11,text="Unit Tank "..i} - TextBox{parent=row,text="Connected to: Unit "..i} + TextBox{parent=row,text="Connected to: Unit "..i,fg_bg=cpair(colors.gray,colors.lightGray)} - local tank_fluid = Radio2D{parent=row,x=15,y=1,rows=1,columns=2,default=ini_cfg.TankFluidTypes[i],options={"Water","Sodium"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg} + local tank_fluid = Radio2D{parent=row,x=34,y=1,rows=1,columns=2,default=type,options={"Water","Sodium"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg} if tmp_cfg.CoolingConfig[i].BoilerCount == 0 then tank_fluid.set_value(1) @@ -612,19 +623,19 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) TextBox{parent=row,width=15,text="Facility Tank "..next_f} - local conns = "Connected to: " + local conns = "" local any_bwr = false for u = 1, #tank_conns do if tank_conns[u] == i then - conns = conns .. "Unit " .. u .. " " + conns = conns .. tri(conns == "", "", ", ") .. "Unit " .. u any_bwr = any_bwr or (tmp_cfg.CoolingConfig[u].BoilerCount == 0) end end - TextBox{parent=row,text=conns} + TextBox{parent=row,text="Connected to: "..conns,fg_bg=cpair(colors.gray,colors.lightGray)} - local tank_fluid = Radio2D{parent=row,x=15,y=1,rows=1,columns=2,default=ini_cfg.TankFluidTypes[i],options={"Water","Sodium"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg} + local tank_fluid = Radio2D{parent=row,x=34,y=1,rows=1,columns=2,default=type,options={"Water","Sodium"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg} if any_bwr then tank_fluid.set_value(1) @@ -638,6 +649,10 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) end end + local function back_from_fluids() + fac_pane.set_value(tri(tmp_cfg.FacilityTankMode == 0, 3, 5)) + end + local function submit_tank_fluids() tmp_cfg.TankFluidTypes = {} @@ -652,7 +667,7 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) fac_pane.set_value(8) end - PushButton{parent=fac_c_7,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(5)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=fac_c_7,x=1,y=14,text="\x1b Back",callback=back_from_fluids,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=fac_c_7,x=44,y=14,text="Next \x1a",callback=submit_tank_fluids,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion @@ -672,8 +687,8 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) main_pane.set_value(3) end - PushButton{parent=fac_c_7,x=1,y=14,text="\x1b Back",callback=back_from_idling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=fac_c_7,x=44,y=14,text="Next \x1a",callback=submit_idling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=fac_c_8,x=1,y=14,text="\x1b Back",callback=back_from_idling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=fac_c_8,x=44,y=14,text="Next \x1a",callback=submit_idling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion diff --git a/supervisor/config/system.lua b/supervisor/config/system.lua index 9e0b0c7..cb5bacd 100644 --- a/supervisor/config/system.lua +++ b/supervisor/config/system.lua @@ -557,6 +557,7 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, fac_pane, style, exit local val_max_w = (inner_width - label_w) + 1 local raw = cfg[f[1]] local val = util.strval(raw) + local skip = false if f[1] == "AuthKey" then val = string.rep("*", string.len(val)) elseif f[1] == "LogMode" then val = tri(raw == log.MODE.APPEND, "append", "replace") @@ -593,29 +594,49 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, fac_pane, style, exit end if val == "" then val = "no facility tanks" end + elseif f[1] == "FacilityTankList" or f[1] == "FacilityTankConns" then + -- hide + skip = true + elseif f[1] == "TankFluidTypes" and type(cfg.TankFluidTypes) == "table" and type(cfg.FacilityTankDefs) == "table" then + val = "" + + for idx = 1, #cfg.FacilityTankDefs do + local t_mode = "not connected to a tank" + if cfg.FacilityTankDefs[idx] == 1 then + t_mode = "connected to its unit tank" + elseif cfg.FacilityTankDefs[idx] == 2 then + t_mode = "connected to a facility tank" + end + + val = val .. tri(idx == 1, "", "\n") .. util.sprintf(" \x07 unit %d - %s", idx, t_mode) + end + + if val == "" then val = "no emergency coolant tanks" end end - if val == "nil" then val = "" end + if not skip then + if val == "nil" then val = "" end - local c = tri(alternate, g_lg_fg_bg, cpair(colors.gray,colors.white)) - alternate = not alternate + local c = tri(alternate, g_lg_fg_bg, cpair(colors.gray,colors.white)) + alternate = not alternate - if string.len(val) > val_max_w then - local lines = util.strwrap(val, inner_width) - height = #lines + 1 + if string.len(val) > val_max_w then + local lines = util.strwrap(val, inner_width) + height = #lines + 1 + end + + local line = Div{parent=setting_list,height=height,fg_bg=c} + TextBox{parent=line,text=f[2],width=string.len(f[2]),fg_bg=cpair(colors.black,line.get_fg_bg().bkg)} + + local textbox + if height > 1 then + textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1} + else + textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT} + end + + if f[1] == "AuthKey" then self.auth_key_textbox = textbox end end - - local line = Div{parent=setting_list,height=height,fg_bg=c} - TextBox{parent=line,text=f[2],width=string.len(f[2]),fg_bg=cpair(colors.black,line.get_fg_bg().bkg)} - - local textbox - if height > 1 then - textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1} - else - textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT} - end - - if f[1] == "AuthKey" then self.auth_key_textbox = textbox end end end diff --git a/supervisor/configure.lua b/supervisor/configure.lua index f4e71f2..73acd96 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -114,6 +114,9 @@ local fields = { { "CoolingConfig", "Cooling Configuration", {} }, { "FacilityTankMode", "Facility Tank Mode", 0 }, { "FacilityTankDefs", "Facility Tank Definitions", {} }, + { "FacilityTankList", "Facility Tank List", {} }, -- hidden + { "FacilityTankConns", "Facility Tank Connections", {} }, -- hidden + { "TankFluidTypes", "Tank Fluid Types", {} }, { "ExtChargeIdling", "Extended Charge Idling", false }, { "SVR_Channel", "SVR Channel", 16240 }, { "PLC_Channel", "PLC Channel", 16241 }, @@ -180,7 +183,7 @@ local function config_view(display) TextBox{parent=main_page,x=2,y=2,height=2,text="Welcome to the Supervisor configurator! Please select one of the following options."} if tool_ctl.ask_config then - TextBox{parent=main_page,x=2,y=y_start,height=4,width=49,text="Notice: This device is not configured for this version of the supervisor. If you previously had a valid config, you may want to check the Change Log to see what changed.",fg_bg=cpair(colors.red,colors.lightGray)} + TextBox{parent=main_page,x=2,y=y_start,height=4,width=49,text="Notice: This device is not configured for this version of the supervisor. If you previously had a valid config, it's not lost. You may want to check the Change Log to see what changed.",fg_bg=cpair(colors.red,colors.lightGray)} y_start = y_start + 5 end diff --git a/supervisor/supervisor.lua b/supervisor/supervisor.lua index afc2bb5..fe7b011 100644 --- a/supervisor/supervisor.lua +++ b/supervisor/supervisor.lua @@ -27,6 +27,8 @@ function supervisor.load_config() config.CoolingConfig = settings.get("CoolingConfig") config.FacilityTankMode = settings.get("FacilityTankMode") config.FacilityTankDefs = settings.get("FacilityTankDefs") + config.FacilityTankList = settings.get("FacilityTankList") + config.FacilityTankConns = settings.get("FacilityTankConns") config.TankFluidTypes = settings.get("TankFluidTypes") config.ExtChargeIdling = settings.get("ExtChargeIdling") @@ -59,6 +61,8 @@ function supervisor.load_config() cfv.assert_type_table(config.CoolingConfig) cfv.assert_type_int(config.FacilityTankMode) cfv.assert_type_table(config.FacilityTankDefs) + cfv.assert_type_table(config.FacilityTankList) + cfv.assert_type_table(config.FacilityTankConns) cfv.assert_type_table(config.TankFluidTypes) cfv.assert_range(config.FacilityTankMode, 0, 8)