From e1ed9a8e5e2c3ff55c934efefee68d6719b6f317 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Wed, 29 Nov 2023 22:25:34 -0500 Subject: [PATCH 01/16] fixed error messages not fitting and say input side when configuring inputs on RTU configurator --- rtu/configure.lua | 22 +++++++----- rtu/startup.lua | 2 +- scada-common/rsio.lua | 81 ++++++++++++++++++++++++------------------- scada-common/util.lua | 2 +- 4 files changed, 61 insertions(+), 46 deletions(-) diff --git a/rtu/configure.lua b/rtu/configure.lua index 3c8a621..6d93181 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -161,6 +161,7 @@ local tool_ctl = { rs_cfg_selection = nil, ---@type graphics_element rs_cfg_unit_l = nil, ---@type graphics_element rs_cfg_unit = nil, ---@type graphics_element + rs_cfg_side_l = nil, ---@type graphics_element rs_cfg_color = nil, ---@type graphics_element rs_cfg_shortcut = nil ---@type graphics_element } @@ -850,7 +851,7 @@ local function config_view(display) tool_ctl.p_desc = TextBox{parent=peri_c_4,x=1,y=7,height=6,text="",fg_bg=g_lg_fg_bg} tool_ctl.p_desc_ext = TextBox{parent=peri_c_4,x=1,y=6,height=7,text="",fg_bg=g_lg_fg_bg} - tool_ctl.p_err = TextBox{parent=peri_c_4,x=8,y=14,height=1,width=35,text="",fg_bg=cpair(colors.red,colors.lightGray),hidden=true} + tool_ctl.p_err = TextBox{parent=peri_c_4,x=8,y=14,height=1,width=32,text="",fg_bg=cpair(colors.red,colors.lightGray),hidden=true} tool_ctl.p_err.hide(true) local function back_from_peri_opts() @@ -879,7 +880,7 @@ local function config_view(display) if (peri_type == "dynamicValve" or peri_type == "environmentDetector") and for_facility then -- skip elseif not (util.is_int(u) and u > 0 and u < 5) then - tool_ctl.p_err.set_value("Unit ID must be within 1 through 4.") + tool_ctl.p_err.set_value("Unit ID must be within 1 to 4.") tool_ctl.p_err.show() return else unit = u end @@ -899,7 +900,7 @@ local function config_view(display) else index = idx end elseif peri_type == "dynamicValve" and for_facility then if not (util.is_int(idx) and idx > 0 and idx < 5) then - tool_ctl.p_err.set_value("Index must be within 1 through 4.") + tool_ctl.p_err.set_value("Index must be within 1 to 4.") tool_ctl.p_err.show() return else index = idx end @@ -991,7 +992,7 @@ local function config_view(display) local new_rs_port = IO.F_SCRAM local function new_rs(port) - if (rsio.get_io_mode(port) == rsio.IO_DIR.IN) then + if (rsio.get_io_dir(port) == rsio.IO_DIR.IN) then for i = 1, #tmp_cfg.Redstone do if tmp_cfg.Redstone[i].port == port then rs_pane.set_value(6) @@ -1007,9 +1008,11 @@ local function config_view(display) if port == -1 then tool_ctl.rs_cfg_color.hide(true) tool_ctl.rs_cfg_shortcut.show() + tool_ctl.rs_cfg_side_l.set_value("Output Side") text = "You selected the ALL_WASTE shortcut." else tool_ctl.rs_cfg_shortcut.hide(true) + tool_ctl.rs_cfg_side_l.set_value(util.trinary(rsio.get_io_dir(port) == rsio.IO_DIR.IN, "Input Side", "Output Side")) tool_ctl.rs_cfg_color.show() text = "You selected " .. rsio.to_string(port) .. " (for " if PORT_DSGN[port] == 1 then @@ -1035,8 +1038,8 @@ local function config_view(display) TextBox{parent=all_w_macro,x=22,y=1,height=1,text="Create all 4 waste entries",fg_bg=cpair(colors.gray,colors.white)} for i = 1, rsio.NUM_PORTS do local name = rsio.to_string(i) - local io_dir = util.trinary(rsio.get_io_mode(i) == rsio.IO_DIR.IN, "[in]", "[out]") - local btn_color = util.trinary(rsio.get_io_mode(i) == rsio.IO_DIR.IN, colors.yellow, colors.lightBlue) + local io_dir = util.trinary(rsio.get_io_dir(i) == rsio.IO_DIR.IN, "[in]", "[out]") + local btn_color = util.trinary(rsio.get_io_dir(i) == rsio.IO_DIR.IN, colors.yellow, colors.lightBlue) local entry = Div{parent=rs_ports,height=1} PushButton{parent=entry,x=1,y=1,min_width=14,alignment=LEFT,height=1,text=">"..name,callback=function()new_rs(i)end,fg_bg=cpair(colors.black,btn_color),active_fg_bg=cpair(colors.white,colors.black)} TextBox{parent=entry,x=16,y=1,width=5,height=1,text=io_dir,fg_bg=cpair(colors.lightGray,colors.white)} @@ -1050,7 +1053,7 @@ local function config_view(display) tool_ctl.rs_cfg_unit_l = TextBox{parent=rs_c_3,x=27,y=3,width=7,height=1,text="Unit ID"} tool_ctl.rs_cfg_unit = NumberField{parent=rs_c_3,x=27,y=4,width=10,max_digits=2,min=1,max=4,fg_bg=bw_fg_bg} - TextBox{parent=rs_c_3,x=1,y=3,width=11,height=1,text="Output Side"} + tool_ctl.rs_cfg_side_l = TextBox{parent=rs_c_3,x=1,y=3,width=11,height=1,text="Output Side"} local side = Radio2D{parent=rs_c_3,x=1,y=4,rows=2,columns=3,default=1,options=side_options,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.red} local function set_bundled(bundled) @@ -1064,7 +1067,7 @@ local function config_view(display) tool_ctl.rs_cfg_color = Radio2D{parent=rs_c_3,x=1,y=9,rows=4,columns=4,default=1,options=color_options,radio_colors=cpair(colors.lightGray,colors.black),color_map=color_options_map,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg} tool_ctl.rs_cfg_color.disable() - local rs_err = TextBox{parent=rs_c_3,x=8,y=14,height=1,width=35,text="Unit ID must be within 1 through 4.",fg_bg=cpair(colors.red,colors.lightGray),hidden=true} + local rs_err = TextBox{parent=rs_c_3,x=8,y=14,height=1,width=30,text="Unit ID must be within 1 to 4.",fg_bg=cpair(colors.red,colors.lightGray),hidden=true} rs_err.hide(true) local function back_from_rs_opts() @@ -1233,7 +1236,7 @@ local function config_view(display) table.insert(tmp_cfg.Redstone, def) local name = rsio.to_string(def.port) - local io_dir = util.trinary(rsio.get_io_mode(def.port) == rsio.IO_DIR.IN, "\x1a", "\x1b") + local io_dir = util.trinary(rsio.get_io_dir(def.port) == rsio.IO_DIR.IN, "\x1a", "\x1b") local conn = def.side local unit = "facility" @@ -1407,6 +1410,7 @@ local function config_view(display) end tool_ctl.rs_cfg_selection.set_value(text) + tool_ctl.rs_cfg_side_l.set_value(util.trinary(rsio.get_io_dir(idx) == rsio.IO_DIR.IN, "Input Side", "Output Side")) side.set_value(side_to_idx(def.side)) bundled.set_value(def.color ~= nil) tool_ctl.rs_cfg_color.set_value(value) diff --git a/rtu/startup.lua b/rtu/startup.lua index 10c2169..0630241 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.7.4" +local RTU_VERSION = "v1.7.5" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE diff --git a/scada-common/rsio.lua b/scada-common/rsio.lua index 4585bfd..fcdc56b 100644 --- a/scada-common/rsio.lua +++ b/scada-common/rsio.lua @@ -127,7 +127,37 @@ local PORT_NAMES = { "U_EMER_COOL" } +local MODES = { + IO_MODE.DIGITAL_IN, -- F_SCRAM + IO_MODE.DIGITAL_IN, -- F_ACK + IO_MODE.DIGITAL_IN, -- R_SCRAM + IO_MODE.DIGITAL_IN, -- R_RESET + IO_MODE.DIGITAL_IN, -- R_ENABLE + IO_MODE.DIGITAL_IN, -- U_ACK + IO_MODE.DIGITAL_OUT, -- F_ALARM + IO_MODE.DIGITAL_OUT, -- F_ALARM_ANY + IO_MODE.DIGITAL_OUT, -- WASTE_PU + IO_MODE.DIGITAL_OUT, -- WASTE_PO + IO_MODE.DIGITAL_OUT, -- WASTE_POPL + IO_MODE.DIGITAL_OUT, -- WASTE_AM + IO_MODE.DIGITAL_OUT, -- R_ACTIVE + IO_MODE.DIGITAL_OUT, -- R_AUTO_CTRL + IO_MODE.DIGITAL_OUT, -- R_SCRAMMED + IO_MODE.DIGITAL_OUT, -- R_AUTO_SCRAM + IO_MODE.DIGITAL_OUT, -- R_HIGH_DMG + IO_MODE.DIGITAL_OUT, -- R_HIGH_TEMP + IO_MODE.DIGITAL_OUT, -- R_LOW_COOLANT + IO_MODE.DIGITAL_OUT, -- R_EXCESS_HC + IO_MODE.DIGITAL_OUT, -- R_EXCESS_WS + IO_MODE.DIGITAL_OUT, -- R_INSUFF_FUEL + IO_MODE.DIGITAL_OUT, -- R_PLC_FAULT + IO_MODE.DIGITAL_OUT, -- R_PLC_TIMEOUT + IO_MODE.DIGITAL_OUT, -- U_ALARM + IO_MODE.DIGITAL_OUT -- U_EMER_COOL +} + assert(rsio.NUM_PORTS == #PORT_NAMES, "port names length incorrect") +assert(rsio.NUM_PORTS == #MODES, "modes length incorrect") -- port to string ---@nodiscard @@ -209,45 +239,26 @@ local RS_DIO_MAP = { { _in = _I_ACTIVE_LOW, _out = _O_ACTIVE_LOW, mode = IO_DIR.OUT } } +assert(rsio.NUM_PORTS == #RS_DIO_MAP, "RS_DIO_MAP length incorrect") + +-- get the I/O direction of a port +---@nodiscard +---@param port IO_PORT +---@return IO_DIR +function rsio.get_io_dir(port) + if util.is_int(port) and port > 0 and port <= rsio.NUM_PORTS then + return RS_DIO_MAP[port].mode + else return IO_DIR.IN end +end + -- get the mode of a port ---@nodiscard ---@param port IO_PORT ---@return IO_MODE function rsio.get_io_mode(port) - local modes = { - IO_MODE.DIGITAL_IN, -- F_SCRAM - IO_MODE.DIGITAL_IN, -- F_ACK - IO_MODE.DIGITAL_IN, -- R_SCRAM - IO_MODE.DIGITAL_IN, -- R_RESET - IO_MODE.DIGITAL_IN, -- R_ENABLE - IO_MODE.DIGITAL_IN, -- U_ACK - IO_MODE.DIGITAL_OUT, -- F_ALARM - IO_MODE.DIGITAL_OUT, -- F_ALARM_ANY - IO_MODE.DIGITAL_OUT, -- WASTE_PU - IO_MODE.DIGITAL_OUT, -- WASTE_PO - IO_MODE.DIGITAL_OUT, -- WASTE_POPL - IO_MODE.DIGITAL_OUT, -- WASTE_AM - IO_MODE.DIGITAL_OUT, -- R_ACTIVE - IO_MODE.DIGITAL_OUT, -- R_AUTO_CTRL - IO_MODE.DIGITAL_OUT, -- R_SCRAMMED - IO_MODE.DIGITAL_OUT, -- R_AUTO_SCRAM - IO_MODE.DIGITAL_OUT, -- R_HIGH_DMG - IO_MODE.DIGITAL_OUT, -- R_HIGH_TEMP - IO_MODE.DIGITAL_OUT, -- R_LOW_COOLANT - IO_MODE.DIGITAL_OUT, -- R_EXCESS_HC - IO_MODE.DIGITAL_OUT, -- R_EXCESS_WS - IO_MODE.DIGITAL_OUT, -- R_INSUFF_FUEL - IO_MODE.DIGITAL_OUT, -- R_PLC_FAULT - IO_MODE.DIGITAL_OUT, -- R_PLC_TIMEOUT - IO_MODE.DIGITAL_OUT, -- U_ALARM - IO_MODE.DIGITAL_OUT -- U_EMER_COOL - } - - if util.is_int(port) and port > 0 and port <= #modes then - return modes[port] - else - return IO_MODE.ANALOG_IN - end + if util.is_int(port) and port > 0 and port <= rsio.NUM_PORTS then + return MODES[port] + else return IO_MODE.ANALOG_IN end end --#endregion @@ -261,7 +272,7 @@ local RS_SIDES = rs.getSides() ---@param port IO_PORT ---@return boolean valid function rsio.is_valid_port(port) - return util.is_int(port) and (port > 0) and (port <= IO_PORT.U_EMER_COOL) + return util.is_int(port) and port > 0 and port <= rsio.NUM_PORTS end -- check if a side is valid diff --git a/scada-common/util.lua b/scada-common/util.lua index d386bd3..da80782 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -22,7 +22,7 @@ local t_pack = table.pack local util = {} -- scada-common version -util.version = "1.1.10" +util.version = "1.1.11" util.TICK_TIME_S = 0.05 util.TICK_TIME_MS = 50 From fa0185c9a4c6dad2c70dc615c0d6065859714f15 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Wed, 13 Dec 2023 12:20:12 -0500 Subject: [PATCH 02/16] fixed checkbox width --- graphics/core.lua | 2 +- graphics/elements/controls/checkbox.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/core.lua b/graphics/core.lua index 437f66f..63c706f 100644 --- a/graphics/core.lua +++ b/graphics/core.lua @@ -7,7 +7,7 @@ local flasher = require("graphics.flasher") local core = {} -core.version = "2.0.7" +core.version = "2.0.8" core.flasher = flasher core.events = events diff --git a/graphics/elements/controls/checkbox.lua b/graphics/elements/controls/checkbox.lua index 08e8bc5..d63ca69 100644 --- a/graphics/elements/controls/checkbox.lua +++ b/graphics/elements/controls/checkbox.lua @@ -24,7 +24,7 @@ local function checkbox(args) args.can_focus = true args.height = 1 - args.width = 3 + string.len(args.label) + args.width = 2 + string.len(args.label) -- create new graphics element base object local e = element.new(args) From 5c88890ed4462e414d74c5e935fb028a45efbc8e Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Thu, 14 Dec 2023 20:51:54 -0500 Subject: [PATCH 03/16] removed redundant min_width values --- reactor-plc/configure.lua | 38 ++++++++++++------------- reactor-plc/startup.lua | 2 +- rtu/configure.lua | 58 +++++++++++++++++++-------------------- rtu/startup.lua | 2 +- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/reactor-plc/configure.lua b/reactor-plc/configure.lua index c4c9c27..9f4784a 100644 --- a/reactor-plc/configure.lua +++ b/reactor-plc/configure.lua @@ -232,8 +232,8 @@ local function config_view(display) plc_pane.set_value(2) end - PushButton{parent=plc_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=plc_c_1,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_networked,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_1,x=44,y=14,text="Next \x1a",callback=submit_networked,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=plc_c_2,x=1,y=1,height=1,text="Please enter the reactor unit ID for this PLC."} TextBox{parent=plc_c_2,x=1,y=3,height=3,text="If this is a networked PLC, currently only IDs 1 through 4 are acceptable.",fg_bg=g_lg_fg_bg} @@ -252,10 +252,10 @@ local function config_view(display) else u_id_err.show() end end - PushButton{parent=plc_c_2,x=1,y=14,min_width=6,text="\x1b Back",callback=function()plc_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=plc_c_2,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_id,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_2,x=1,y=14,text="\x1b Back",callback=function()plc_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_2,x=44,y=14,text="Next \x1a",callback=submit_id,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - TextBox{parent=plc_c_3,x=1,y=1,height=4,text="When networked, the supervisor takes care of emergency coolant via RTUs. However, you can configure independent emergency coolant via the PLC. "} + TextBox{parent=plc_c_3,x=1,y=1,height=4,text="When networked, the supervisor takes care of emergency coolant via RTUs. However, you can configure independent emergency coolant via the PLC."} TextBox{parent=plc_c_3,x=1,y=6,height=5,text="This independent control can be used with or without a supervisor. To configure, you would next select the interface of the redstone output connected to one or more mekanism pipes.",fg_bg=g_lg_fg_bg} local en_em_cool = CheckBox{parent=plc_c_3,x=1,y=11,label="Enable PLC Emergency Coolant Control",default=ini_cfg.EmerCoolEnable,box_fg_bg=cpair(colors.orange,colors.black)} @@ -269,8 +269,8 @@ local function config_view(display) if tmp_cfg.EmerCoolEnable then plc_pane.set_value(4) else next_from_plc() end end - PushButton{parent=plc_c_3,x=1,y=14,min_width=6,text="\x1b Back",callback=function()plc_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=plc_c_3,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_en_emcool,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_3,x=1,y=14,text="\x1b Back",callback=function()plc_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_3,x=44,y=14,text="Next \x1a",callback=submit_en_emcool,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=plc_c_4,x=1,y=1,height=1,text="Emergency Coolant Redstone Output Side"} local side = Radio2D{parent=plc_c_4,x=1,y=2,rows=2,columns=3,default=side_to_idx(ini_cfg.EmerCoolSide),options=side_options,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.orange} @@ -286,8 +286,8 @@ local function config_view(display) next_from_plc() end - PushButton{parent=plc_c_4,x=1,y=14,min_width=6,text="\x1b Back",callback=function()plc_pane.set_value(3)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=plc_c_4,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_emcool,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_4,x=1,y=14,text="\x1b Back",callback=function()plc_pane.set_value(3)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=plc_c_4,x=44,y=14,text="Next \x1a",callback=submit_emcool,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} -- NET CONFIG @@ -328,8 +328,8 @@ local function config_view(display) end end - PushButton{parent=net_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=net_c_1,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_channels,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_1,x=44,y=14,text="Next \x1a",callback=submit_channels,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=net_c_2,x=1,y=1,height=1,text="Connection Timeout"} local timeout = NumberField{parent=net_c_2,x=1,y=2,width=7,default=ini_cfg.ConnTimeout,min=2,max=25,fg_bg=bw_fg_bg} @@ -359,8 +359,8 @@ local function config_view(display) end end - PushButton{parent=net_c_2,x=1,y=14,min_width=6,text="\x1b Back",callback=function()net_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=net_c_2,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_ct_tr,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_2,x=1,y=14,text="\x1b Back",callback=function()net_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_2,x=44,y=14,text="Next \x1a",callback=submit_ct_tr,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=net_c_3,x=1,y=1,height=2,text="Optionally, set the facility authentication key below. Do NOT use one of your passwords."} TextBox{parent=net_c_3,x=1,y=4,height=6,text="This enables verifying that messages are authentic, so it is intended for security on multiplayer servers. All devices on the same network MUST use the same key if any device has a key. This does result in some extra compution (can slow things down).",fg_bg=g_lg_fg_bg} @@ -386,8 +386,8 @@ local function config_view(display) else key_err.show() end end - PushButton{parent=net_c_3,x=1,y=14,min_width=6,text="\x1b Back",callback=function()net_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=net_c_3,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_auth,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_3,x=1,y=14,text="\x1b Back",callback=function()net_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_3,x=44,y=14,text="Next \x1a",callback=submit_auth,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} -- LOG CONFIG @@ -426,8 +426,8 @@ local function config_view(display) if tmp_cfg.Networked then main_pane.set_value(3) else main_pane.set_value(2) end end - PushButton{parent=log_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=back_from_log,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=log_c_1,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_log,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=log_c_1,x=1,y=14,text="\x1b Back",callback=back_from_log,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=log_c_1,x=44,y=14,text="Next \x1a",callback=submit_log,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} -- SUMMARY OF CHANGES @@ -494,7 +494,7 @@ local function config_view(display) end end - PushButton{parent=sum_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=back_from_settings,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=sum_c_1,x=1,y=14,text="\x1b Back",callback=back_from_settings,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} tool_ctl.show_key_btn = PushButton{parent=sum_c_1,x=8,y=14,min_width=17,text="Unhide Auth Key",callback=function()tool_ctl.show_auth_key()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg,dis_fg_bg=cpair(colors.lightGray,colors.white)} tool_ctl.settings_apply = PushButton{parent=sum_c_1,x=43,y=14,min_width=7,text="Apply",callback=save_and_continue,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg} @@ -541,7 +541,7 @@ local function config_view(display) end end - PushButton{parent=cl,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=cl,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} -- set tool functions now that we have the elements diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 2a051e9..d2970df 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc") local renderer = require("reactor-plc.renderer") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "v1.6.5" +local R_PLC_VERSION = "v1.6.6" local println = util.println local println_ts = util.println_ts diff --git a/rtu/configure.lua b/rtu/configure.lua index 6d93181..9efc0d5 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -345,8 +345,8 @@ local function config_view(display) else s_vol_err.show() end end - PushButton{parent=spkr_c,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=spkr_c,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_vol,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=spkr_c,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=spkr_c,x=44,y=14,text="Next \x1a",callback=submit_vol,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion @@ -389,8 +389,8 @@ local function config_view(display) end end - PushButton{parent=net_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=net_c_1,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_channels,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_1,x=44,y=14,text="Next \x1a",callback=submit_channels,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=net_c_2,x=1,y=1,height=1,text="Connection Timeout"} local timeout = NumberField{parent=net_c_2,x=1,y=2,width=7,default=ini_cfg.ConnTimeout,min=2,max=25,fg_bg=bw_fg_bg} @@ -420,8 +420,8 @@ local function config_view(display) end end - PushButton{parent=net_c_2,x=1,y=14,min_width=6,text="\x1b Back",callback=function()net_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=net_c_2,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_ct_tr,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_2,x=1,y=14,text="\x1b Back",callback=function()net_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_2,x=44,y=14,text="Next \x1a",callback=submit_ct_tr,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=net_c_3,x=1,y=1,height=2,text="Optionally, set the facility authentication key below. Do NOT use one of your passwords."} TextBox{parent=net_c_3,x=1,y=4,height=6,text="This enables verifying that messages are authentic, so it is intended for security on multiplayer servers. All devices on the same network MUST use the same key if any device has a key. This does result in some extra compution (can slow things down).",fg_bg=g_lg_fg_bg} @@ -447,8 +447,8 @@ local function config_view(display) else key_err.show() end end - PushButton{parent=net_c_3,x=1,y=14,min_width=6,text="\x1b Back",callback=function()net_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=net_c_3,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_auth,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_3,x=1,y=14,text="\x1b Back",callback=function()net_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=net_c_3,x=44,y=14,text="Next \x1a",callback=submit_auth,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion @@ -486,8 +486,8 @@ local function config_view(display) else path_err.show() end end - PushButton{parent=log_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(3)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=log_c_1,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_log,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=log_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(3)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=log_c_1,x=44,y=14,text="Next \x1a",callback=submit_log,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion @@ -568,7 +568,7 @@ local function config_view(display) else sum_pane.set_value(6) end end - PushButton{parent=sum_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=back_from_settings,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=sum_c_1,x=1,y=14,text="\x1b Back",callback=back_from_settings,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} tool_ctl.show_key_btn = PushButton{parent=sum_c_1,x=8,y=14,min_width=17,text="Unhide Auth Key",callback=function()tool_ctl.show_auth_key()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg,dis_fg_bg=cpair(colors.lightGray,colors.white)} tool_ctl.settings_apply = PushButton{parent=sum_c_1,x=43,y=14,min_width=7,text="Apply",callback=function()save_and_continue(true)end,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg} tool_ctl.settings_confirm = PushButton{parent=sum_c_1,x=41,y=14,min_width=9,text="Confirm",callback=function()sum_pane.set_value(2)end,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg} @@ -577,13 +577,13 @@ local function config_view(display) TextBox{parent=sum_c_2,x=1,y=1,height=1,text="The following peripherals will be imported:"} local peri_import_list = ListBox{parent=sum_c_2,x=1,y=3,height=10,width=51,scroll_height=1000,fg_bg=bw_fg_bg,nav_fg_bg=g_lg_fg_bg,nav_active=cpair(colors.black,colors.gray)} - PushButton{parent=sum_c_2,x=1,y=14,min_width=6,text="\x1b Back",callback=function()sum_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=sum_c_2,x=1,y=14,text="\x1b Back",callback=function()sum_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=sum_c_2,x=41,y=14,min_width=9,text="Confirm",callback=function()sum_pane.set_value(3)end,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg} TextBox{parent=sum_c_3,x=1,y=1,height=1,text="The following redstone entries will be imported:"} local rs_import_list = ListBox{parent=sum_c_3,x=1,y=3,height=10,width=51,scroll_height=1000,fg_bg=bw_fg_bg,nav_fg_bg=g_lg_fg_bg,nav_active=cpair(colors.black,colors.gray)} - PushButton{parent=sum_c_3,x=1,y=14,min_width=6,text="\x1b Back",callback=function()sum_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=sum_c_3,x=1,y=14,text="\x1b Back",callback=function()sum_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=sum_c_3,x=43,y=14,min_width=7,text="Apply",callback=save_and_continue,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg} TextBox{parent=sum_c_4,x=1,y=1,height=1,text="Settings saved!"} @@ -606,7 +606,7 @@ local function config_view(display) TextBox{parent=sum_c_7,x=1,y=1,height=8,text="Warning!\n\nSome of the devices in your old config file aren't currently connected. If the device isn't connected, the options can't be properly validated. Please either connect your devices and try again or complete the import without validation on those entry's settings."} TextBox{parent=sum_c_7,x=1,y=10,height=3,text="Afterwards, either (a) edit then save entries for currently disconnected devices to properly configure or (b) delete those entries."} - PushButton{parent=sum_c_7,x=1,y=14,min_width=6,text="\x1b Back",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=sum_c_7,x=1,y=14,text="\x1b Back",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=sum_c_7,x=41,y=14,min_width=9,text="Confirm",callback=function()sum_pane.set_value(1)end,fg_bg=cpair(colors.black,colors.orange),active_fg_bg=btn_act_fg_bg} --#endregion @@ -628,7 +628,7 @@ local function config_view(display) end end - PushButton{parent=cl,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=cl,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion @@ -665,7 +665,7 @@ local function config_view(display) end end - PushButton{parent=peri_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_1,x=8,y=14,min_width=16,text="Revert Changes",callback=peri_revert,fg_bg=cpair(colors.black,colors.yellow),active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_1,x=35,y=14,min_width=7,text="Add +",callback=function()peri_pane.set_value(2)end,fg_bg=cpair(colors.black,colors.blue),active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_1,x=43,y=14,min_width=7,text="Apply",callback=peri_apply,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg} @@ -674,13 +674,13 @@ local function config_view(display) tool_ctl.ppm_devs = ListBox{parent=peri_c_2,x=1,y=3,height=10,width=51,scroll_height=1000,fg_bg=bw_fg_bg,nav_fg_bg=g_lg_fg_bg,nav_active=cpair(colors.black,colors.gray)} - PushButton{parent=peri_c_2,x=1,y=14,min_width=6,text="\x1b Back",callback=function()peri_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_2,x=1,y=14,text="\x1b Back",callback=function()peri_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_2,x=8,y=14,min_width=10,text="Manual +",callback=function()peri_pane.set_value(3)end,fg_bg=cpair(colors.black,colors.orange),active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_2,x=26,y=14,min_width=24,text="I don't see my device!",callback=function()peri_pane.set_value(7)end,fg_bg=cpair(colors.black,colors.yellow),active_fg_bg=btn_act_fg_bg} TextBox{parent=peri_c_7,x=1,y=1,height=10,text="Make sure your device is either touching the RTU or connected via wired modems. There should be a wired modem on a side of the RTU then one on the device, connected by a cable. The modem on the device needs to be right clicked to connect it (which will turn its border red), at which point the peripheral name will be shown in the chat."} TextBox{parent=peri_c_7,x=1,y=9,height=4,text="If it still does not show, it may not be compatible. Currently only Boilers, Turbines, Dynamic Tanks, SNAs, SPSs, Induction Matricies, and Environment Detectors are supported."} - PushButton{parent=peri_c_7,x=1,y=14,min_width=6,text="\x1b Back",callback=function()peri_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_7,x=1,y=14,text="\x1b Back",callback=function()peri_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} local new_peri_attrs = { "", "" } local function new_peri(name, type) @@ -823,8 +823,8 @@ local function config_view(display) else man_p_err.show() end end - PushButton{parent=peri_c_3,x=1,y=14,min_width=6,text="\x1b Back",callback=function()peri_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - PushButton{parent=peri_c_3,x=44,y=14,min_width=6,text="Next \x1a",callback=submit_manual_peri,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_3,x=1,y=14,text="\x1b Back",callback=function()peri_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_3,x=44,y=14,text="Next \x1a",callback=submit_manual_peri,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} tool_ctl.p_name_msg = TextBox{parent=peri_c_4,x=1,y=1,height=2,text=""} tool_ctl.p_prompt = TextBox{parent=peri_c_4,x=1,y=4,height=2,text=""} @@ -932,15 +932,15 @@ local function config_view(display) tool_ctl.p_idx.set_value(1) end - PushButton{parent=peri_c_4,x=1,y=14,min_width=6,text="\x1b Back",callback=back_from_peri_opts,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_4,x=1,y=14,text="\x1b Back",callback=back_from_peri_opts,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_4,x=41,y=14,min_width=9,text="Confirm",callback=save_peri_entry,fg_bg=cpair(colors.black,colors.blue),active_fg_bg=btn_act_fg_bg} TextBox{parent=peri_c_5,x=1,y=1,height=1,text="Settings saved!"} - PushButton{parent=peri_c_5,x=1,y=14,min_width=6,text="\x1b Back",callback=function()peri_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_5,x=1,y=14,text="\x1b Back",callback=function()peri_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_5,x=44,y=14,min_width=6,text="Home",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=peri_c_6,x=1,y=1,height=5,text="Failed to save the settings file.\n\nThere may not be enough space for the modification or server file permissions may be denying writes."} - PushButton{parent=peri_c_6,x=1,y=14,min_width=6,text="\x1b Back",callback=function()peri_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=peri_c_6,x=1,y=14,text="\x1b Back",callback=function()peri_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=peri_c_6,x=44,y=14,min_width=6,text="Home",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion @@ -978,13 +978,13 @@ local function config_view(display) end end - PushButton{parent=rs_c_1,x=1,y=14,min_width=6,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=rs_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=rs_c_1,x=8,y=14,min_width=16,text="Revert Changes",callback=rs_revert,fg_bg=cpair(colors.black,colors.yellow),active_fg_bg=btn_act_fg_bg} PushButton{parent=rs_c_1,x=35,y=14,min_width=7,text="New +",callback=function()rs_pane.set_value(2)end,fg_bg=cpair(colors.black,colors.blue),active_fg_bg=btn_act_fg_bg} PushButton{parent=rs_c_1,x=43,y=14,min_width=7,text="Apply",callback=rs_apply,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg} TextBox{parent=rs_c_6,x=1,y=1,height=5,text="You already configured this input. There can only be one entry for each input.\n\nPlease select a different port."} - PushButton{parent=rs_c_6,x=1,y=14,min_width=6,text="\x1b Back",callback=function()rs_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=rs_c_6,x=1,y=14,text="\x1b Back",callback=function()rs_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=rs_c_2,x=1,y=1,height=1,text="Select one of the below ports to use."} @@ -1046,7 +1046,7 @@ local function config_view(display) TextBox{parent=entry,x=22,y=1,height=1,text=PORT_DESC[i],fg_bg=cpair(colors.gray,colors.white)} end - PushButton{parent=rs_c_2,x=1,y=14,min_width=6,text="\x1b Back",callback=function()rs_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=rs_c_2,x=1,y=14,text="\x1b Back",callback=function()rs_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} tool_ctl.rs_cfg_selection = TextBox{parent=rs_c_3,x=1,y=1,height=1,text=""} @@ -1119,15 +1119,15 @@ local function config_view(display) else rs_err.show() end end - PushButton{parent=rs_c_3,x=1,y=14,min_width=6,text="\x1b Back",callback=back_from_rs_opts,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=rs_c_3,x=1,y=14,text="\x1b Back",callback=back_from_rs_opts,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=rs_c_3,x=41,y=14,min_width=9,text="Confirm",callback=save_rs_entry,fg_bg=cpair(colors.black,colors.blue),active_fg_bg=btn_act_fg_bg} TextBox{parent=rs_c_4,x=1,y=1,height=1,text="Settings saved!"} - PushButton{parent=rs_c_4,x=1,y=14,min_width=6,text="\x1b Back",callback=function()rs_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=rs_c_4,x=1,y=14,text="\x1b Back",callback=function()rs_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=rs_c_4,x=44,y=14,min_width=6,text="Home",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} TextBox{parent=rs_c_5,x=1,y=1,height=5,text="Failed to save the settings file.\n\nThere may not be enough space for the modification or server file permissions may be denying writes."} - PushButton{parent=rs_c_5,x=1,y=14,min_width=6,text="\x1b Back",callback=function()rs_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} + PushButton{parent=rs_c_5,x=1,y=14,text="\x1b Back",callback=function()rs_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} PushButton{parent=rs_c_5,x=44,y=14,min_width=6,text="Home",callback=function()tool_ctl.go_home()end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} --#endregion diff --git a/rtu/startup.lua b/rtu/startup.lua index 0630241..c877cac 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.7.5" +local RTU_VERSION = "v1.7.6" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE From 55ccdd63d49f6eaa42777eabbbc76ed126257c76 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 12:55:00 -0500 Subject: [PATCH 04/16] don't mention config.lua on update for apps that don't have it --- ccmsi.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ccmsi.lua b/ccmsi.lua index 19ccebc..fd46d67 100644 --- a/ccmsi.lua +++ b/ccmsi.lua @@ -18,7 +18,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. local function println(message) print(tostring(message)) end local function print(message) term.write(tostring(message)) end -local CCMSI_VERSION = "v1.11c" +local CCMSI_VERSION = "v1.11d" local install_dir = "/.install-cache" local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/" @@ -347,7 +347,9 @@ elseif mode == "install" or mode == "update" then if mode == "install" then println("Installing " .. app .. " files...") elseif mode == "update" then - println("Updating " .. app .. " files... (keeping old config.lua)") + if app == "coordinator" or app == "pocket" then + println("Updating " .. app .. " files... (keeping old config.lua)") + else println("Updating " .. app .. " files...") end end white() From f23b7e2c2f4f88759602fbd3589ba7f0c29bcc94 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 12:56:08 -0500 Subject: [PATCH 05/16] fixed out of bounds coordinates crashing GUI for form fields --- graphics/core.lua | 2 +- graphics/elements/form/number_field.lua | 2 +- graphics/elements/form/text_field.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/graphics/core.lua b/graphics/core.lua index 63c706f..b38d786 100644 --- a/graphics/core.lua +++ b/graphics/core.lua @@ -7,7 +7,7 @@ local flasher = require("graphics.flasher") local core = {} -core.version = "2.0.8" +core.version = "2.0.9" core.flasher = flasher core.events = events diff --git a/graphics/elements/form/number_field.lua b/graphics/elements/form/number_field.lua index 7e1afd8..ddc09be 100644 --- a/graphics/elements/form/number_field.lua +++ b/graphics/elements/form/number_field.lua @@ -50,7 +50,7 @@ local function number_field(args) if core.events.was_clicked(event.type) then e.take_focus() - if event.type == MOUSE_CLICK.UP then + if event.type == MOUSE_CLICK.UP and e.in_frame_bounds(event.current.x, event.current.y) then ifield.move_cursor(event.current.x) end elseif event.type == MOUSE_CLICK.DOUBLE_CLICK then diff --git a/graphics/elements/form/text_field.lua b/graphics/elements/form/text_field.lua index aee910d..843ec24 100644 --- a/graphics/elements/form/text_field.lua +++ b/graphics/elements/form/text_field.lua @@ -45,7 +45,7 @@ local function text_field(args) if core.events.was_clicked(event.type) then e.take_focus() - if event.type == MOUSE_CLICK.UP then + if event.type == MOUSE_CLICK.UP and e.in_frame_bounds(event.current.x, event.current.y) then ifield.move_cursor(event.current.x) end elseif event.type == MOUSE_CLICK.DOUBLE_CLICK then From 37659d687e09eb450a20f6f500a2385991ad352f Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 17:22:29 -0500 Subject: [PATCH 06/16] #388 fixed peripherals list not updating on add/delete of config entry --- rtu/configure.lua | 2 ++ rtu/startup.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rtu/configure.lua b/rtu/configure.lua index 9efc0d5..dbcfec4 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -928,6 +928,7 @@ local function config_view(display) peri_pane.set_value(1) tool_ctl.gen_peri_summary(tmp_cfg) + tool_ctl.update_peri_list() tool_ctl.p_idx.set_value(1) end @@ -1345,6 +1346,7 @@ local function config_view(display) local function delete_peri_entry(idx) table.remove(tmp_cfg.Peripherals, idx) tool_ctl.gen_peri_summary(tmp_cfg) + tool_ctl.update_peri_list() end -- generate the peripherals summary list diff --git a/rtu/startup.lua b/rtu/startup.lua index c877cac..ccd69b0 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.7.6" +local RTU_VERSION = "v1.7.7" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE From 5d3fd6d939125317e3648718878f5dc7e60b9361 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 17:46:18 -0500 Subject: [PATCH 07/16] #390 fixed not being able to edit entries after using ALL_WASTE shortcut --- rtu/configure.lua | 2 ++ rtu/startup.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rtu/configure.lua b/rtu/configure.lua index dbcfec4..1940bcb 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -1389,6 +1389,8 @@ local function config_view(display) local function edit_rs_entry(idx) local def = tmp_cfg.Redstone[idx] ---@type rtu_rs_definition + tool_ctl.rs_cfg_shortcut.hide(true) + tool_ctl.rs_cfg_color.show() tool_ctl.rs_cfg_editing = idx local text = "Editing " .. rsio.to_string(def.port) .. " (for " diff --git a/rtu/startup.lua b/rtu/startup.lua index ccd69b0..63a9165 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.7.7" +local RTU_VERSION = "v1.7.8" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE From f86892390507de6d3ed9e8ee632cfe798212a844 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 18:04:09 -0500 Subject: [PATCH 08/16] #392 fixed typo preventing water level low indicator from working --- coordinator/startup.lua | 2 +- coordinator/ui/components/unit_detail.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 7811904..3df5ba2 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -22,7 +22,7 @@ local sounder = require("coordinator.sounder") local apisessions = require("coordinator.session.apisessions") -local COORDINATOR_VERSION = "v1.0.17" +local COORDINATOR_VERSION = "v1.0.18" local println = util.println local println_ts = util.println_ts diff --git a/coordinator/ui/components/unit_detail.lua b/coordinator/ui/components/unit_detail.lua index 64d5e5b..52b633a 100644 --- a/coordinator/ui/components/unit_detail.lua +++ b/coordinator/ui/components/unit_detail.lua @@ -257,7 +257,7 @@ local function init(parent, id) if unit.num_boilers > 0 then TextBox{parent=rcs_tags,x=1,text="B1",width=2,height=1,fg_bg=bw_fg_bg} local b1_wll = IndicatorLight{parent=rcs_annunc,label="Water Level Low",colors=ind_red} - b1_wll.register(b_ps[1], "WasterLevelLow", b1_wll.update) + b1_wll.register(b_ps[1], "WaterLevelLow", b1_wll.update) TextBox{parent=rcs_tags,text="B1",width=2,height=1,fg_bg=bw_fg_bg} local b1_hr = IndicatorLight{parent=rcs_annunc,label="Heating Rate Low",colors=ind_yel} @@ -273,7 +273,7 @@ local function init(parent, id) TextBox{parent=rcs_tags,text="B2",width=2,height=1,fg_bg=bw_fg_bg} local b2_wll = IndicatorLight{parent=rcs_annunc,label="Water Level Low",colors=ind_red} - b2_wll.register(b_ps[2], "WasterLevelLow", b2_wll.update) + b2_wll.register(b_ps[2], "WaterLevelLow", b2_wll.update) TextBox{parent=rcs_tags,text="B2",width=2,height=1,fg_bg=bw_fg_bg} local b2_hr = IndicatorLight{parent=rcs_annunc,label="Heating Rate Low",colors=ind_yel} From 9e6751f47fd6b7ce0e888e7ef4149e917cb2e003 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 19:32:01 -0500 Subject: [PATCH 09/16] #391 fixed editing of redstone entries --- rtu/configure.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/rtu/configure.lua b/rtu/configure.lua index 1940bcb..823d2f3 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -125,6 +125,7 @@ local tool_ctl = { importing_any_dc = false, peri_cfg_editing = false, ---@type string|false peri_cfg_manual = false, + rs_cfg_port = IO.F_SCRAM, ---@type IO_PORT rs_cfg_editing = false, ---@type integer|false view_gw_cfg = nil, ---@type graphics_element @@ -991,7 +992,6 @@ local function config_view(display) local rs_ports = ListBox{parent=rs_c_2,x=1,y=3,height=10,width=51,scroll_height=200,fg_bg=bw_fg_bg,nav_fg_bg=g_lg_fg_bg,nav_active=cpair(colors.black,colors.gray)} - local new_rs_port = IO.F_SCRAM local function new_rs(port) if (rsio.get_io_dir(port) == rsio.IO_DIR.IN) then for i = 1, #tmp_cfg.Redstone do @@ -1028,7 +1028,7 @@ local function config_view(display) end tool_ctl.rs_cfg_selection.set_value(text) - new_rs_port = port + tool_ctl.rs_cfg_port = port rs_pane.set_value(3) end @@ -1077,16 +1077,17 @@ local function config_view(display) end local function save_rs_entry() + local port = tool_ctl.rs_cfg_port local u = tonumber(tool_ctl.rs_cfg_unit.get_value()) - if PORT_DSGN[new_rs_port] == 0 or (util.is_int(u) and u > 0 and u < 5) then + if PORT_DSGN[port] == 0 or (util.is_int(u) and u > 0 and u < 5) then rs_err.hide(true) - if new_rs_port >= 0 then + if port >= 0 then ---@type rtu_rs_definition local def = { - unit = util.trinary(PORT_DSGN[new_rs_port] == 1, u, nil), - port = new_rs_port, + unit = util.trinary(PORT_DSGN[port] == 1, u, nil), + port = port, side = side_options_map[side.get_value()], color = util.trinary(bundled.get_value(), color_options_map[tool_ctl.rs_cfg_color.get_value()], nil) } @@ -1097,7 +1098,7 @@ local function config_view(display) def.port = tmp_cfg.Redstone[tool_ctl.rs_cfg_editing].port tmp_cfg.Redstone[tool_ctl.rs_cfg_editing] = def end - elseif new_rs_port == -1 then + elseif port == -1 then local default_sides = { "left", "back", "right", "front" } local default_colors = { colors.red, colors.orange, colors.yellow, colors.lime } for i = 0, 3 do @@ -1391,6 +1392,8 @@ local function config_view(display) tool_ctl.rs_cfg_shortcut.hide(true) tool_ctl.rs_cfg_color.show() + + tool_ctl.rs_cfg_port = def.port tool_ctl.rs_cfg_editing = idx local text = "Editing " .. rsio.to_string(def.port) .. " (for " From 466e442353432510816af1d37b8e7ee30e408c6f Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 19:39:00 -0500 Subject: [PATCH 10/16] #389 added width to RTU front panel entry name box --- rtu/panel/front_panel.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtu/panel/front_panel.lua b/rtu/panel/front_panel.lua index acf45d6..206ea21 100644 --- a/rtu/panel/front_panel.lua +++ b/rtu/panel/front_panel.lua @@ -110,7 +110,7 @@ local function init(panel, units) -- unit name identifier (type + index) local function get_name(t) return util.c(UNIT_TYPE_LABELS[t + 1], " ", util.trinary(util.is_int(unit.index), unit.index, "")) end - local name_box = TextBox{parent=unit_hw_statuses,y=i,x=3,text=get_name(unit.type),height=1} + local name_box = TextBox{parent=unit_hw_statuses,y=i,x=3,text=get_name(unit.type),width=15,height=1} name_box.register(databus.ps, "unit_type_" .. i, function (t) name_box.set_value(get_name(t)) end) From 1b20218445ba3f37ff304977ef6d4dd8ad19702d Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 20:10:11 -0500 Subject: [PATCH 11/16] #194 #382 ccmsi no longer deletes drive mounts and now prompts to delete unknown files/folders in root --- ccmsi.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ccmsi.lua b/ccmsi.lua index fd46d67..7498f49 100644 --- a/ccmsi.lua +++ b/ccmsi.lua @@ -18,7 +18,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. local function println(message) print(tostring(message)) end local function print(message) term.write(tostring(message)) end -local CCMSI_VERSION = "v1.11d" +local CCMSI_VERSION = "v1.12" local install_dir = "/.install-cache" local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/" @@ -168,28 +168,29 @@ end -- go through app/common directories to delete unused files local function clean(manifest) - local root_ext = false local tree = gen_tree(manifest) table.insert(tree, "install_manifest.json") table.insert(tree, "ccmsi.lua") table.insert(tree, "log.txt") ---@fixme fix after migration to settings files? - lgray() - local ls = fs.list("/") for _, val in pairs(ls) do - if fs.isDir(val) then - if tree[val] ~= nil then _clean_dir("/" .. val, tree[val]) end - if #fs.list(val) == 0 then fs.delete(val);println("deleted " .. val) end + if fs.isDriveRoot(val) then + yellow();println("skipped mount '" .. val .. "'") + elseif fs.isDir(val) then + if tree[val] ~= nil then + lgray();_clean_dir("/" .. val, tree[val]) + else + white();if ask_y_n("delete the unused directory '" .. val .. "'") then lgray();_clean_dir("/" .. val, tree[val]) end + end + if #fs.list(val) == 0 then fs.delete(val);lgray();println("deleted empty directory '" .. val .. "'") end elseif not _in_array(val, tree) and (string.find(val, ".settings") == nil) then - root_ext = true - yellow();println(val .. " not used") + white();if ask_y_n("delete the unused file '" .. val .. "'") then fs.delete(val);lgray();println("deleted " .. val) end end end white() - if root_ext then println("Files in root directory won't be automatically deleted.") end end -- get and validate command line options @@ -347,7 +348,7 @@ elseif mode == "install" or mode == "update" then if mode == "install" then println("Installing " .. app .. " files...") elseif mode == "update" then - if app == "coordinator" or app == "pocket" then + if app == "supervisor" or app == "coordinator" or app == "pocket" then println("Updating " .. app .. " files... (keeping old config.lua)") else println("Updating " .. app .. " files...") end end From bc66ea6ecb789432118a12dbea55eba4e3620c50 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 20:28:26 -0500 Subject: [PATCH 12/16] #381 fixed plc main thread crash on modem connect after boot with no modem --- reactor-plc/startup.lua | 2 +- reactor-plc/threads.lua | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index d2970df..c33a780 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc") local renderer = require("reactor-plc.renderer") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "v1.6.6" +local R_PLC_VERSION = "v1.6.7" local println = util.println local println_ts = util.println_ts diff --git a/reactor-plc/threads.lua b/reactor-plc/threads.lua index 6699ea3..85e2a86 100644 --- a/reactor-plc/threads.lua +++ b/reactor-plc/threads.lua @@ -173,7 +173,8 @@ function threads.thread__main(smem, init) plc_state.degraded = true elseif networked and type == "modem" then -- we only care if this is our wireless modem - if nic.is_modem(device) then + -- note, check init_ok first since nic will be nil if it is false + if plc_state.init_ok and nic.is_modem(device) then nic.disconnect() println_ts("comms modem disconnected!") @@ -193,7 +194,7 @@ function threads.thread__main(smem, init) end end else - log.warning("non-comms modem disconnected") + log.warning("a modem was disconnected") end end end @@ -235,7 +236,8 @@ function threads.thread__main(smem, init) rps.reset() end elseif networked and type == "modem" then - if device.isWireless() and not nic.is_connected() then + -- note, check init_ok first since nic will be nil if it is false + if device.isWireless() and not (plc_state.init_ok and nic.is_connected()) then -- reconnected modem plc_dev.modem = device plc_state.no_modem = false From 56802601363154384bd4f7b611d52c22273c573c Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 20:43:08 -0500 Subject: [PATCH 13/16] use existing is_valid_port rather than repeating the code --- scada-common/rsio.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scada-common/rsio.lua b/scada-common/rsio.lua index fcdc56b..6d1e688 100644 --- a/scada-common/rsio.lua +++ b/scada-common/rsio.lua @@ -246,8 +246,7 @@ assert(rsio.NUM_PORTS == #RS_DIO_MAP, "RS_DIO_MAP length incorrect") ---@param port IO_PORT ---@return IO_DIR function rsio.get_io_dir(port) - if util.is_int(port) and port > 0 and port <= rsio.NUM_PORTS then - return RS_DIO_MAP[port].mode + if rsio.is_valid_port(port) then return RS_DIO_MAP[port].mode else return IO_DIR.IN end end @@ -256,8 +255,7 @@ end ---@param port IO_PORT ---@return IO_MODE function rsio.get_io_mode(port) - if util.is_int(port) and port > 0 and port <= rsio.NUM_PORTS then - return MODES[port] + if rsio.is_valid_port(port) then return MODES[port] else return IO_MODE.ANALOG_IN end end From b6a3305f23b71872effd27f33be2b1ebc33bfbd6 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 20:43:40 -0500 Subject: [PATCH 14/16] minor minification --- ccmsi.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ccmsi.lua b/ccmsi.lua index 7498f49..c13dee8 100644 --- a/ccmsi.lua +++ b/ccmsi.lua @@ -179,11 +179,8 @@ local function clean(manifest) if fs.isDriveRoot(val) then yellow();println("skipped mount '" .. val .. "'") elseif fs.isDir(val) then - if tree[val] ~= nil then - lgray();_clean_dir("/" .. val, tree[val]) - else - white();if ask_y_n("delete the unused directory '" .. val .. "'") then lgray();_clean_dir("/" .. val, tree[val]) end - end + if tree[val] ~= nil then lgray();_clean_dir("/" .. val, tree[val]) + else white();if ask_y_n("delete the unused directory '" .. val .. "'") then lgray();_clean_dir("/" .. val) end end if #fs.list(val) == 0 then fs.delete(val);lgray();println("deleted empty directory '" .. val .. "'") end elseif not _in_array(val, tree) and (string.find(val, ".settings") == nil) then white();if ask_y_n("delete the unused file '" .. val .. "'") then fs.delete(val);lgray();println("deleted " .. val) end From 4421cbc0c5888fa1213bc544e09f53cd8d1e80e9 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 20:47:17 -0500 Subject: [PATCH 15/16] fixed input/output side text being sometimes wrong on rtu configurator redstone editing --- rtu/configure.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtu/configure.lua b/rtu/configure.lua index 823d2f3..a77ab32 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -1417,7 +1417,7 @@ local function config_view(display) end tool_ctl.rs_cfg_selection.set_value(text) - tool_ctl.rs_cfg_side_l.set_value(util.trinary(rsio.get_io_dir(idx) == rsio.IO_DIR.IN, "Input Side", "Output Side")) + tool_ctl.rs_cfg_side_l.set_value(util.trinary(rsio.get_io_dir(def.port) == rsio.IO_DIR.IN, "Input Side", "Output Side")) side.set_value(side_to_idx(def.side)) bundled.set_value(def.color ~= nil) tool_ctl.rs_cfg_color.set_value(value) From c870b749a4cbd1204bca9cb2df917fc500137b97 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 20:48:02 -0500 Subject: [PATCH 16/16] cleanup --- ccmsi.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccmsi.lua b/ccmsi.lua index c13dee8..7edf026 100644 --- a/ccmsi.lua +++ b/ccmsi.lua @@ -180,7 +180,7 @@ local function clean(manifest) yellow();println("skipped mount '" .. val .. "'") elseif fs.isDir(val) then if tree[val] ~= nil then lgray();_clean_dir("/" .. val, tree[val]) - else white();if ask_y_n("delete the unused directory '" .. val .. "'") then lgray();_clean_dir("/" .. val) end end + else white(); if ask_y_n("delete the unused directory '" .. val .. "'") then lgray();_clean_dir("/" .. val) end end if #fs.list(val) == 0 then fs.delete(val);lgray();println("deleted empty directory '" .. val .. "'") end elseif not _in_array(val, tree) and (string.find(val, ".settings") == nil) then white();if ask_y_n("delete the unused file '" .. val .. "'") then fs.delete(val);lgray();println("deleted " .. val) end