From 7c22c172d5f3c4ed30b5eddee71aeda7dfa897b7 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 11:43:32 -0500 Subject: [PATCH 1/9] #607 deny reactor PLC with index out of range --- supervisor/startup.lua | 2 +- supervisor/supervisor.lua | 32 ++++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/supervisor/startup.lua b/supervisor/startup.lua index f54144b..61a6c78 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v1.6.3" +local SUPERVISOR_VERSION = "v1.6.4" local println = util.println local println_ts = util.println_ts diff --git a/supervisor/supervisor.lua b/supervisor/supervisor.lua index 47ee6d2..87b6aec 100644 --- a/supervisor/supervisor.lua +++ b/supervisor/supervisor.lua @@ -260,20 +260,32 @@ function supervisor.comms(_version, nic, fp_ok, facility) -- PLC linking request if packet.length == 4 and type(packet.data[4]) == "number" then local reactor_id = packet.data[4] - local plc_id = svsessions.establish_plc_session(src_addr, i_seq_num, reactor_id, firmware_v) - if plc_id == false then - -- reactor already has a PLC assigned - if last_ack ~= ESTABLISH_ACK.COLLISION then - log.warning(util.c("PLC_ESTABLISH: assignment collision with reactor ", reactor_id)) + -- check ID validity + if reactor_id < 1 or reactor_id > config.UnitCount then + -- reactor index out of range + if last_ack ~= ESTABLISH_ACK.DENY then + log.warning(util.c("PLC_ESTABLISH: assignment ", reactor_id, " outside of configured unit count ", config.UnitCount)) end - _send_establish(packet.scada_frame, ESTABLISH_ACK.COLLISION) + _send_establish(packet.scada_frame, ESTABLISH_ACK.DENY) else - -- got an ID; assigned to a reactor successfully - println(util.c("PLC (", firmware_v, ") [@", src_addr, "] \xbb reactor ", reactor_id, " connected")) - log.info(util.c("PLC_ESTABLISH: PLC (", firmware_v, ") [@", src_addr, "] reactor unit ", reactor_id, " PLC connected with session ID ", plc_id)) - _send_establish(packet.scada_frame, ESTABLISH_ACK.ALLOW) + -- try to establish the session + local plc_id = svsessions.establish_plc_session(src_addr, i_seq_num, reactor_id, firmware_v) + + if plc_id == false then + -- reactor already has a PLC assigned + if last_ack ~= ESTABLISH_ACK.COLLISION then + log.warning(util.c("PLC_ESTABLISH: assignment collision with reactor ", reactor_id)) + end + + _send_establish(packet.scada_frame, ESTABLISH_ACK.COLLISION) + else + -- got an ID; assigned to a reactor successfully + println(util.c("PLC (", firmware_v, ") [@", src_addr, "] \xbb reactor ", reactor_id, " connected")) + log.info(util.c("PLC_ESTABLISH: PLC (", firmware_v, ") [@", src_addr, "] reactor unit ", reactor_id, " PLC connected with session ID ", plc_id)) + _send_establish(packet.scada_frame, ESTABLISH_ACK.ALLOW) + end end else log.debug("PLC_ESTABLISH: packet length mismatch/bad parameter type") From e0d1eb34455f3aa93339d8ac8e20f56ff4d4d3fd Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 11:44:30 -0500 Subject: [PATCH 2/9] #608 fixed front panel network lights --- coordinator/startup.lua | 2 +- coordinator/ui/layout/front_panel.lua | 2 +- reactor-plc/panel/front_panel.lua | 2 +- reactor-plc/startup.lua | 2 +- rtu/panel/front_panel.lua | 2 +- rtu/startup.lua | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index e91228a..7343145 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer") local sounder = require("coordinator.sounder") local threads = require("coordinator.threads") -local COORDINATOR_VERSION = "v1.6.6" +local COORDINATOR_VERSION = "v1.6.7" local CHUNK_LOAD_DELAY_S = 30.0 diff --git a/coordinator/ui/layout/front_panel.lua b/coordinator/ui/layout/front_panel.lua index 46d506b..b190468 100644 --- a/coordinator/ui/layout/front_panel.lua +++ b/coordinator/ui/layout/front_panel.lua @@ -61,7 +61,7 @@ local function init(panel, num_units) local modem = LED{parent=system,label="MODEM",colors=led_grn} if not style.colorblind then - local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.fp_ind_bkg}} + local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.yellow,colors.orange,style.fp_ind_bkg}} network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(ps, "link_state", network.update) else diff --git a/reactor-plc/panel/front_panel.lua b/reactor-plc/panel/front_panel.lua index 8bb6a0f..ba6c27b 100644 --- a/reactor-plc/panel/front_panel.lua +++ b/reactor-plc/panel/front_panel.lua @@ -60,7 +60,7 @@ local function init(panel) local modem = LED{parent=system,label="MODEM",colors=ind_grn} if not style.colorblind then - local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.ind_bkg}} + local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.yellow,colors.orange,style.ind_bkg}} network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(databus.ps, "link_state", network.update) else diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 0ba81d8..f86657a 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.8.15" +local R_PLC_VERSION = "v1.8.16" local println = util.println local println_ts = util.println_ts diff --git a/rtu/panel/front_panel.lua b/rtu/panel/front_panel.lua index 6fc40e5..b70fe62 100644 --- a/rtu/panel/front_panel.lua +++ b/rtu/panel/front_panel.lua @@ -53,7 +53,7 @@ local function init(panel, units) local modem = LED{parent=system,label="MODEM",colors=ind_grn} if not style.colorblind then - local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.ind_bkg}} + local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.yellow,colors.orange,style.ind_bkg}} network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(databus.ps, "link_state", network.update) else diff --git a/rtu/startup.lua b/rtu/startup.lua index c957ac9..d40eefd 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.11.0" +local RTU_VERSION = "v1.11.1" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_HW_STATE = databus.RTU_HW_STATE From 9163fb14c4642945218de076e878595070a723d8 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 11:45:26 -0500 Subject: [PATCH 3/9] RTU gateway version increment --- rtu/startup.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtu/startup.lua b/rtu/startup.lua index d40eefd..3df4694 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.11.1" +local RTU_VERSION = "v1.11.2" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_HW_STATE = databus.RTU_HW_STATE From 21eae4932fe0bc3cccbbed921a76df31743a56c3 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 11:54:45 -0500 Subject: [PATCH 4/9] #607 updated deny message --- supervisor/startup.lua | 2 +- supervisor/supervisor.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 61a6c78..c235e09 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v1.6.4" +local SUPERVISOR_VERSION = "v1.6.5" local println = util.println local println_ts = util.println_ts diff --git a/supervisor/supervisor.lua b/supervisor/supervisor.lua index 87b6aec..e0a3701 100644 --- a/supervisor/supervisor.lua +++ b/supervisor/supervisor.lua @@ -265,7 +265,7 @@ function supervisor.comms(_version, nic, fp_ok, facility) if reactor_id < 1 or reactor_id > config.UnitCount then -- reactor index out of range if last_ack ~= ESTABLISH_ACK.DENY then - log.warning(util.c("PLC_ESTABLISH: assignment ", reactor_id, " outside of configured unit count ", config.UnitCount)) + log.warning(util.c("PLC_ESTABLISH: denied assignment ", reactor_id, " outside of configured unit count ", config.UnitCount)) end _send_establish(packet.scada_frame, ESTABLISH_ACK.DENY) From 18d093e72d102f1bd968a0e6a0a750293473829c Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 12:34:06 -0500 Subject: [PATCH 5/9] #526 reactor PLC front panel scale to term size --- reactor-plc/panel/front_panel.lua | 25 ++++++++++++++----------- reactor-plc/startup.lua | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/reactor-plc/panel/front_panel.lua b/reactor-plc/panel/front_panel.lua index ba6c27b..ab20365 100644 --- a/reactor-plc/panel/front_panel.lua +++ b/reactor-plc/panel/front_panel.lua @@ -40,6 +40,8 @@ local function init(panel) local disabled_fg = style.fp.disabled_fg + local term_w, term_h = term.getSize() + local header = TextBox{parent=panel,y=1,text="FISSION REACTOR PLC - UNIT ?",alignment=ALIGN.CENTER,fg_bg=style.theme.header} header.register(databus.ps, "unit_id", function (id) header.set_value(util.c("FISSION REACTOR PLC - UNIT ", id)) end) @@ -121,7 +123,7 @@ local function init(panel) -- status & controls -- - local status = Div{parent=panel,width=19,height=18,x=17,y=3} + local status = Div{parent=panel,width=term_w-32,height=18,x=17,y=3} local active = LED{parent=status,x=2,width=12,label="RCT ACTIVE",colors=ind_grn} @@ -131,14 +133,15 @@ local function init(panel) emer_cool.register(databus.ps, "emer_cool", emer_cool.update) end - local status_trip_rct = Rectangle{parent=status,width=20,height=3,x=1,border=border(1,s_hi_box.bkg,true),even_inner=true} - local status_trip = Div{parent=status_trip_rct,width=18,height=1,fg_bg=s_hi_box} + local status_trip_rct = Rectangle{parent=status,height=3,x=1,border=border(1,s_hi_box.bkg,true),even_inner=true} + local status_trip = Div{parent=status_trip_rct,height=1,fg_bg=s_hi_box} local scram = LED{parent=status_trip,width=10,label="RPS TRIP",colors=ind_red,flash=true,period=flasher.PERIOD.BLINK_250_MS} - local controls_rct = Rectangle{parent=status,width=17,height=3,x=1,border=border(1,s_hi_box.bkg,true),even_inner=true} - local controls = Div{parent=controls_rct,width=15,height=1,fg_bg=s_hi_box} - PushButton{parent=controls,x=1,y=1,min_width=7,text="SCRAM",callback=databus.rps_scram,fg_bg=cpair(colors.black,colors.red),active_fg_bg=cpair(colors.black,colors.red_off)} - PushButton{parent=controls,x=9,y=1,min_width=7,text="RESET",callback=databus.rps_reset,fg_bg=cpair(colors.black,colors.yellow),active_fg_bg=cpair(colors.black,colors.yellow_off)} + local controls_rct = Rectangle{parent=status,width=status.get_width()-2,height=3,x=1,border=border(1,s_hi_box.bkg,true),even_inner=true} + local controls = Div{parent=controls_rct,width=controls_rct.get_width()-2,height=1,fg_bg=s_hi_box} + local button_padding = math.floor((controls.get_width() - 14) / 3) + PushButton{parent=controls,x=button_padding+1,y=1,min_width=7,text="SCRAM",callback=databus.rps_scram,fg_bg=cpair(colors.black,colors.red),active_fg_bg=cpair(colors.black,colors.red_off)} + PushButton{parent=controls,x=(2*button_padding)+9,y=1,min_width=7,text="RESET",callback=databus.rps_reset,fg_bg=cpair(colors.black,colors.yellow),active_fg_bg=cpair(colors.black,colors.yellow_off)} active.register(databus.ps, "reactor_active", active.update) scram.register(databus.ps, "rps_scram", scram.update) @@ -147,9 +150,9 @@ local function init(panel) -- about footer -- - local about = Div{parent=panel,width=15,height=3,x=1,y=18,fg_bg=disabled_fg} - local fw_v = TextBox{parent=about,x=1,y=1,text="FW: v00.00.00"} - local comms_v = TextBox{parent=about,x=1,y=2,text="NT: v00.00.00"} + local about = Div{parent=panel,width=15,height=2,x=1,y=term_h-1,fg_bg=disabled_fg} + local fw_v = TextBox{parent=about,text="FW: v00.00.00"} + local comms_v = TextBox{parent=about,text="NT: v00.00.00"} fw_v.register(databus.ps, "version", function (version) fw_v.set_value(util.c("FW: ", version)) end) comms_v.register(databus.ps, "comms_version", function (version) comms_v.set_value(util.c("NT: v", version)) end) @@ -158,7 +161,7 @@ local function init(panel) -- rps list -- - local rps = Rectangle{parent=panel,width=16,height=16,x=36,y=3,border=border(1,s_hi_box.bkg),thin=true,fg_bg=s_hi_box} + local rps = Rectangle{parent=panel,width=16,height=16,x=term_w-15,y=3,border=border(1,s_hi_box.bkg),thin=true,fg_bg=s_hi_box} local rps_man = LED{parent=rps,label="MANUAL",colors=ind_red} local rps_auto = LED{parent=rps,label="AUTOMATIC",colors=ind_red} local rps_tmo = LED{parent=rps,label="TIMEOUT",colors=ind_red} diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index f86657a..6431d3d 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.8.16" +local R_PLC_VERSION = "v1.8.17" local println = util.println local println_ts = util.println_ts From 20b71bead13abfb335f95f59bdc887f78e8fb350 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 12:51:10 -0500 Subject: [PATCH 6/9] #526 RTU gateway front panel scale to term size --- rtu/panel/front_panel.lua | 24 +++++++++++++----------- rtu/startup.lua | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/rtu/panel/front_panel.lua b/rtu/panel/front_panel.lua index b70fe62..7a0fa96 100644 --- a/rtu/panel/front_panel.lua +++ b/rtu/panel/front_panel.lua @@ -35,13 +35,15 @@ local UNIT_TYPE_LABELS = { "UNKNOWN", "REDSTONE", "BOILER", "TURBINE", "DYNAMIC local function init(panel, units) local disabled_fg = style.fp.disabled_fg + local term_w, term_h = term.getSize() + TextBox{parent=panel,y=1,text="RTU GATEWAY",alignment=ALIGN.CENTER,fg_bg=style.theme.header} -- -- system indicators -- - local system = Div{parent=panel,width=14,height=18,x=2,y=3} + local system = Div{parent=panel,width=14,height=term_h-5,x=2,y=3} local on = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)} local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn} @@ -100,17 +102,17 @@ local function init(panel, units) local comp_id = util.sprintf("(%d)", os.getComputerID()) TextBox{parent=system,x=9,y=4,width=6,text=comp_id,fg_bg=disabled_fg} - TextBox{parent=system,x=1,y=14,text="SPEAKERS",width=8,fg_bg=style.fp.text_fg} - local speaker_count = DataIndicator{parent=system,x=10,y=14,label="",format="%3d",value=0,width=3,fg_bg=style.theme.field_box} + TextBox{parent=system,y=term_h-5,text="SPEAKERS",width=8,fg_bg=style.fp.text_fg} + local speaker_count = DataIndicator{parent=system,x=10,y=term_h-5,label="",format="%3d",value=0,width=3,fg_bg=style.theme.field_box} speaker_count.register(databus.ps, "speaker_count", speaker_count.update) -- -- about label -- - local about = Div{parent=panel,width=15,height=3,x=1,y=18,fg_bg=disabled_fg} - local fw_v = TextBox{parent=about,x=1,y=1,text="FW: v00.00.00"} - local comms_v = TextBox{parent=about,x=1,y=2,text="NT: v00.00.00"} + local about = Div{parent=panel,width=15,height=2,x=1,y=term_h-1,fg_bg=disabled_fg} + local fw_v = TextBox{parent=about,text="FW: v00.00.00"} + local comms_v = TextBox{parent=about,text="NT: v00.00.00"} fw_v.register(databus.ps, "version", function (version) fw_v.set_value(util.c("FW: ", version)) end) comms_v.register(databus.ps, "comms_version", function (version) comms_v.set_value(util.c("NT: v", version)) end) @@ -119,10 +121,10 @@ local function init(panel, units) -- unit status list -- - local threads = Div{parent=panel,width=8,height=18,x=17,y=3} + local threads = Div{parent=panel,width=8,height=term_h-3,x=17,y=3} - -- display up to 16 units - local list_length = math.min(#units, 16) + -- display as many units as we can with 1 line of padding above and below + local list_length = math.min(#units, term_h - 3) -- show routine statuses for i = 1, list_length do @@ -131,7 +133,7 @@ local function init(panel, units) rt_unit.register(databus.ps, "routine__unit_" .. i, rt_unit.update) end - local unit_hw_statuses = Div{parent=panel,height=18,x=25,y=3} + local unit_hw_statuses = Div{parent=panel,height=term_h-3,x=25,y=3} -- show hardware statuses for i = 1, list_length do @@ -150,7 +152,7 @@ local function init(panel, units) -- assignment (unit # or facility) local for_unit = util.trinary(unit.reactor == 0, "\x1a FACIL ", "\x1a UNIT " .. unit.reactor) - TextBox{parent=unit_hw_statuses,y=i,x=19,text=for_unit,fg_bg=disabled_fg} + TextBox{parent=unit_hw_statuses,y=i,x=term_w-32,text=for_unit,fg_bg=disabled_fg} end end diff --git a/rtu/startup.lua b/rtu/startup.lua index 3df4694..7d49b92 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.11.2" +local RTU_VERSION = "v1.11.3" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_HW_STATE = databus.RTU_HW_STATE From e37e3ba69611386f366a4d64eb95aee7df8b9037 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 13:20:23 -0500 Subject: [PATCH 7/9] #526 supervisor front panel scale to term size --- supervisor/panel/components/pdg_entry.lua | 8 +++-- supervisor/panel/components/rtu_entry.lua | 12 ++++--- supervisor/panel/front_panel.lua | 42 ++++++++++++----------- supervisor/startup.lua | 2 +- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/supervisor/panel/components/pdg_entry.lua b/supervisor/panel/components/pdg_entry.lua index 368f4bc..c9597c2 100644 --- a/supervisor/panel/components/pdg_entry.lua +++ b/supervisor/panel/components/pdg_entry.lua @@ -25,6 +25,8 @@ local function init(parent, id) local label_fg = style.fp.label_fg + local term_w, _ = term.getSize() + -- root div local root = Div{parent=parent,x=2,y=2,height=4,width=parent.get_width()-2} local entry = Div{parent=root,x=2,y=1,height=3,fg_bg=style.theme.highlight_box_bright} @@ -40,9 +42,9 @@ local function init(parent, id) local pdg_fw_v = TextBox{parent=entry,x=14,y=2,text=" ------- ",width=20,fg_bg=label_fg} pdg_fw_v.register(databus.ps, ps_prefix .. "fw", pdg_fw_v.set_value) - TextBox{parent=entry,x=35,y=2,text="RTT:",width=4} - local pdg_rtt = DataIndicator{parent=entry,x=40,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} - TextBox{parent=entry,x=46,y=2,text="ms",width=4,fg_bg=label_fg} + TextBox{parent=entry,x=term_w-16,y=2,text="RTT:",width=4} + local pdg_rtt = DataIndicator{parent=entry,x=term_w-11,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} + TextBox{parent=entry,x=term_w-5,y=2,text="ms",width=4,fg_bg=label_fg} pdg_rtt.register(databus.ps, ps_prefix .. "rtt", pdg_rtt.update) pdg_rtt.register(databus.ps, ps_prefix .. "rtt_color", pdg_rtt.recolor) diff --git a/supervisor/panel/components/rtu_entry.lua b/supervisor/panel/components/rtu_entry.lua index 2de0c0f..8038213 100644 --- a/supervisor/panel/components/rtu_entry.lua +++ b/supervisor/panel/components/rtu_entry.lua @@ -25,6 +25,8 @@ local function init(parent, id) local label_fg = style.fp.label_fg + local term_w, _ = term.getSize() + -- root div local root = Div{parent=parent,x=2,y=2,height=4,width=parent.get_width()-2} local entry = Div{parent=root,x=2,y=1,height=3,fg_bg=style.theme.highlight_box_bright} @@ -40,13 +42,13 @@ local function init(parent, id) local unit_count = DataIndicator{parent=entry,x=17,y=2,label="",unit="",format="%2d",value=0,width=2,fg_bg=style.fp.label_d_fg} unit_count.register(databus.ps, ps_prefix .. "units", unit_count.set_value) - TextBox{parent=entry,x=21,y=2,text="FW:",width=3} - local rtu_fw_v = TextBox{parent=entry,x=25,y=2,text=" ------- ",width=9,fg_bg=label_fg} + TextBox{parent=entry,x=term_w-30,y=2,text="FW:",width=3} + local rtu_fw_v = TextBox{parent=entry,x=term_w-26,y=2,text=" ------- ",width=9,fg_bg=label_fg} rtu_fw_v.register(databus.ps, ps_prefix .. "fw", rtu_fw_v.set_value) - TextBox{parent=entry,x=36,y=2,text="RTT:",width=4} - local rtu_rtt = DataIndicator{parent=entry,x=40,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} - TextBox{parent=entry,x=46,y=2,text="ms",width=4,fg_bg=label_fg} + TextBox{parent=entry,x=term_w-15,y=2,text="RTT:",width=4} + local rtu_rtt = DataIndicator{parent=entry,x=term_w-11,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} + TextBox{parent=entry,x=term_w-5,y=2,text="ms",width=4,fg_bg=label_fg} rtu_rtt.register(databus.ps, ps_prefix .. "rtt", rtu_rtt.update) rtu_rtt.register(databus.ps, ps_prefix .. "rtt_color", rtu_rtt.recolor) diff --git a/supervisor/panel/front_panel.lua b/supervisor/panel/front_panel.lua index e31d8bb..786fadf 100644 --- a/supervisor/panel/front_panel.lua +++ b/supervisor/panel/front_panel.lua @@ -41,6 +41,8 @@ local function init(panel) local label_fg = style.fp.label_fg local label_d_fg = style.fp.label_d_fg + local term_w, term_h = term.getSize() + TextBox{parent=panel,y=1,text="SCADA SUPERVISOR",alignment=ALIGN.CENTER,fg_bg=style.theme.header} local page_div = Div{parent=panel,x=1,y=3} @@ -73,9 +75,9 @@ local function init(panel) -- about footer -- - local about = Div{parent=main_page,width=15,height=3,x=1,y=16,fg_bg=style.fp.disabled_fg} - local fw_v = TextBox{parent=about,x=1,y=1,text="FW: v00.00.00"} - local comms_v = TextBox{parent=about,x=1,y=2,text="NT: v00.00.00"} + local about = Div{parent=main_page,width=15,height=2,y=term_h-3,fg_bg=style.fp.disabled_fg} + local fw_v = TextBox{parent=about,text="FW: v00.00.00"} + local comms_v = TextBox{parent=about,text="NT: v00.00.00"} fw_v.register(databus.ps, "version", function (version) fw_v.set_value(util.c("FW: ", version)) end) comms_v.register(databus.ps, "comms_version", function (version) comms_v.set_value(util.c("NT: v", version)) end) @@ -87,7 +89,7 @@ local function init(panel) -- plc sessions page local plc_page = Div{parent=page_div,x=1,y=1,hidden=true} - local plc_list = Div{parent=plc_page,x=2,y=2,width=49} + local plc_list = Div{parent=plc_page,x=2,y=2,width=term_w-2} for i = 1, supervisor.config.UnitCount do local ps_prefix = "plc_" .. i .. "_" @@ -103,13 +105,13 @@ local function init(panel) local plc_addr = TextBox{parent=plc_entry,x=17,y=2,text=" --- ",width=5,fg_bg=label_d_fg} plc_addr.register(databus.ps, ps_prefix .. "addr", plc_addr.set_value) - TextBox{parent=plc_entry,x=23,y=2,text="FW:",width=3} - local plc_fw_v = TextBox{parent=plc_entry,x=27,y=2,text=" ------- ",width=9,fg_bg=label_fg} + TextBox{parent=plc_entry,x=term_w-28,y=2,text="FW:",width=3} + local plc_fw_v = TextBox{parent=plc_entry,x=term_w-24,y=2,text=" ------- ",width=9,fg_bg=label_fg} plc_fw_v.register(databus.ps, ps_prefix .. "fw", plc_fw_v.set_value) - TextBox{parent=plc_entry,x=37,y=2,text="RTT:",width=4} - local plc_rtt = DataIndicator{parent=plc_entry,x=42,y=2,label="",unit="",format="%4d",value=0,width=4,fg_bg=label_fg} - TextBox{parent=plc_entry,x=47,y=2,text="ms",width=4,fg_bg=label_fg} + TextBox{parent=plc_entry,x=term_w-14,y=2,text="RTT:",width=4} + local plc_rtt = DataIndicator{parent=plc_entry,x=term_w-9,y=2,label="",unit="",format="%4d",value=0,width=4,fg_bg=label_fg} + TextBox{parent=plc_entry,x=term_w-4,y=2,text="ms",width=4,fg_bg=label_fg} plc_rtt.register(databus.ps, ps_prefix .. "rtt", plc_rtt.update) plc_rtt.register(databus.ps, ps_prefix .. "rtt_color", plc_rtt.recolor) @@ -119,13 +121,13 @@ local function init(panel) -- rtu sessions page local rtu_page = Div{parent=page_div,x=1,y=1,hidden=true} - local rtu_list = ListBox{parent=rtu_page,x=1,y=1,height=17,width=51,scroll_height=1000,fg_bg=cpair(colors.black,colors.ivory),nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} + local rtu_list = ListBox{parent=rtu_page,y=1,height=term_h-2,width=term_w,scroll_height=1000,fg_bg=cpair(colors.black,colors.ivory),nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} local _ = Div{parent=rtu_list,height=1} -- padding -- coordinator session page local crd_page = Div{parent=page_div,x=1,y=1,hidden=true} - local crd_box = Div{parent=crd_page,x=2,y=2,width=49,height=4,fg_bg=s_hi_bright} + local crd_box = Div{parent=crd_page,x=2,y=2,width=term_w-2,height=4,fg_bg=s_hi_bright} local crd_conn = LED{parent=crd_box,x=2,y=2,label="CONNECTION",colors=cpair(colors.green_hc,colors.green_off)} crd_conn.register(databus.ps, "crd_conn", crd_conn.update) @@ -138,27 +140,27 @@ local function init(panel) local crd_fw_v = TextBox{parent=crd_box,x=26,y=2,text=" ------- ",width=9,fg_bg=label_fg} crd_fw_v.register(databus.ps, "crd_fw", crd_fw_v.set_value) - TextBox{parent=crd_box,x=36,y=2,text="RTT:",width=4} - local crd_rtt = DataIndicator{parent=crd_box,x=41,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} - TextBox{parent=crd_box,x=47,y=2,text="ms",width=4,fg_bg=label_fg} + TextBox{parent=crd_box,x=term_w-15,y=2,text="RTT:",width=4} + local crd_rtt = DataIndicator{parent=crd_box,x=term_w-10,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} + TextBox{parent=crd_box,x=term_w-4,y=2,text="ms",width=4,fg_bg=label_fg} crd_rtt.register(databus.ps, "crd_rtt", crd_rtt.update) crd_rtt.register(databus.ps, "crd_rtt_color", crd_rtt.recolor) -- pocket sessions page - local pkt_page = Div{parent=page_div,x=1,y=1,hidden=true} - local pdg_list = ListBox{parent=pkt_page,x=1,y=1,height=17,width=51,scroll_height=1000,fg_bg=style.fp.text_fg,nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} + local pkt_page = Div{parent=page_div,y=1,hidden=true} + local pdg_list = ListBox{parent=pkt_page,y=1,height=term_h-2,width=term_w,scroll_height=1000,fg_bg=style.fp.text_fg,nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} local _ = Div{parent=pdg_list,height=1} -- padding -- RTU device ID check/diagnostics page - local chk_page = Div{parent=page_div,x=1,y=1,hidden=true} - local chk_list = ListBox{parent=chk_page,x=1,y=1,height=17,width=51,scroll_height=1000,fg_bg=style.fp.text_fg,nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} + local chk_page = Div{parent=page_div,y=1,hidden=true} + local chk_list = ListBox{parent=chk_page,y=1,height=term_h-2,width=term_w,scroll_height=1000,fg_bg=style.fp.text_fg,nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} local _ = Div{parent=chk_list,height=1} -- padding -- info page - local info_page = Div{parent=page_div,x=1,y=1,hidden=true} + local info_page = Div{parent=page_div,y=1,hidden=true} local info = Div{parent=info_page,height=6,x=2,y=2} TextBox{parent=info,text="SVR \x1a Supervisor Status"} @@ -168,7 +170,7 @@ local function init(panel) TextBox{parent=info,text="PKT \x1a Pocket Connections"} TextBox{parent=info,text="DEV \x1a RTU Device/Configuration Alerts"} - local notes = Div{parent=info_page,width=49,height=8,x=2,y=9,fg_bg=style.fp.disabled_fg} + local notes = Div{parent=info_page,width=term_w-2,height=8,x=2,y=9,fg_bg=style.fp.disabled_fg} TextBox{parent=notes,text="The DEV tab will show missing devices and devices that connected with incorrect information. Missing entries will indicate how the configuration should be, duplicate entries will indicate what is a duplicate, and out-of-range entries will indicate the invalid entry. An out-of-range example is a #2 turbine when you should only have 1 turbine for that unit."} diff --git a/supervisor/startup.lua b/supervisor/startup.lua index c235e09..d4af5c2 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v1.6.5" +local SUPERVISOR_VERSION = "v1.6.6" local println = util.println local println_ts = util.println_ts From 234652b8866a8bc603972e2c4d18af43ebe060db Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 13:21:00 -0500 Subject: [PATCH 8/9] #526 cleanup --- reactor-plc/panel/front_panel.lua | 2 +- reactor-plc/startup.lua | 2 +- rtu/panel/front_panel.lua | 2 +- rtu/startup.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactor-plc/panel/front_panel.lua b/reactor-plc/panel/front_panel.lua index ab20365..7a346df 100644 --- a/reactor-plc/panel/front_panel.lua +++ b/reactor-plc/panel/front_panel.lua @@ -150,7 +150,7 @@ local function init(panel) -- about footer -- - local about = Div{parent=panel,width=15,height=2,x=1,y=term_h-1,fg_bg=disabled_fg} + local about = Div{parent=panel,width=15,height=2,y=term_h-1,fg_bg=disabled_fg} local fw_v = TextBox{parent=about,text="FW: v00.00.00"} local comms_v = TextBox{parent=about,text="NT: v00.00.00"} diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 6431d3d..acfed61 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.8.17" +local R_PLC_VERSION = "v1.8.18" local println = util.println local println_ts = util.println_ts diff --git a/rtu/panel/front_panel.lua b/rtu/panel/front_panel.lua index 7a0fa96..51adf30 100644 --- a/rtu/panel/front_panel.lua +++ b/rtu/panel/front_panel.lua @@ -110,7 +110,7 @@ local function init(panel, units) -- about label -- - local about = Div{parent=panel,width=15,height=2,x=1,y=term_h-1,fg_bg=disabled_fg} + local about = Div{parent=panel,width=15,height=2,y=term_h-1,fg_bg=disabled_fg} local fw_v = TextBox{parent=about,text="FW: v00.00.00"} local comms_v = TextBox{parent=about,text="NT: v00.00.00"} diff --git a/rtu/startup.lua b/rtu/startup.lua index 7d49b92..5fb02f4 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.11.3" +local RTU_VERSION = "v1.11.4" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_HW_STATE = databus.RTU_HW_STATE From 99ea59a86b561c2c4d19fcf2a85dc005597fa68b Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 16 Feb 2025 13:32:08 -0500 Subject: [PATCH 9/9] #526 coordinator front panel scale to term size --- coordinator/renderer.lua | 2 +- coordinator/startup.lua | 2 +- coordinator/ui/components/pkt_entry.lua | 8 +++++--- coordinator/ui/layout/front_panel.lua | 10 ++++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/coordinator/renderer.lua b/coordinator/renderer.lua index cfa5013..d3ca0cd 100644 --- a/coordinator/renderer.lua +++ b/coordinator/renderer.lua @@ -137,7 +137,7 @@ function renderer.try_start_fp() if not engine.fp_ready then -- show front panel view on terminal status, msg = pcall(function () - engine.ui.front_panel = DisplayBox{window=term.native(),fg_bg=style.fp.root} + engine.ui.front_panel = DisplayBox{window=term.current(),fg_bg=style.fp.root} panel_view(engine.ui.front_panel, #engine.monitors.unit_displays) end) diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 7343145..4bb3412 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer") local sounder = require("coordinator.sounder") local threads = require("coordinator.threads") -local COORDINATOR_VERSION = "v1.6.7" +local COORDINATOR_VERSION = "v1.6.8" local CHUNK_LOAD_DELAY_S = 30.0 diff --git a/coordinator/ui/components/pkt_entry.lua b/coordinator/ui/components/pkt_entry.lua index 78084f9..a377d0e 100644 --- a/coordinator/ui/components/pkt_entry.lua +++ b/coordinator/ui/components/pkt_entry.lua @@ -28,6 +28,8 @@ local function init(parent, id) local ps = iocontrol.get_db().fp.ps + local term_w, _ = term.getSize() + -- root div local root = Div{parent=parent,x=2,y=2,height=4,width=parent.get_width()-2} local entry = Div{parent=root,x=2,y=1,height=3,fg_bg=s_hi_bright} @@ -43,9 +45,9 @@ local function init(parent, id) local pkt_fw_v = TextBox{parent=entry,x=14,y=2,text=" ------- ",width=20,fg_bg=label_fg} pkt_fw_v.register(ps, ps_prefix .. "fw", pkt_fw_v.set_value) - TextBox{parent=entry,x=35,y=2,text="RTT:",width=4} - local pkt_rtt = DataIndicator{parent=entry,x=40,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} - TextBox{parent=entry,x=46,y=2,text="ms",width=4,fg_bg=label_fg} + TextBox{parent=entry,x=term_w-16,y=2,text="RTT:",width=4} + local pkt_rtt = DataIndicator{parent=entry,x=term_w-11,y=2,label="",unit="",format="%5d",value=0,width=5,fg_bg=label_fg} + TextBox{parent=entry,x=term_w-5,y=2,text="ms",width=4,fg_bg=label_fg} pkt_rtt.register(ps, ps_prefix .. "rtt", pkt_rtt.update) pkt_rtt.register(ps, ps_prefix .. "rtt_color", pkt_rtt.recolor) diff --git a/coordinator/ui/layout/front_panel.lua b/coordinator/ui/layout/front_panel.lua index b190468..1b32501 100644 --- a/coordinator/ui/layout/front_panel.lua +++ b/coordinator/ui/layout/front_panel.lua @@ -39,6 +39,8 @@ local led_grn = style.led_grn local function init(panel, num_units) local ps = iocontrol.get_db().fp.ps + local term_w, term_h = term.getSize() + TextBox{parent=panel,y=1,text="SCADA COORDINATOR",alignment=ALIGN.CENTER,fg_bg=style.fp_theme.header} local page_div = Div{parent=panel,x=1,y=3} @@ -131,9 +133,9 @@ local function init(panel, num_units) -- about footer -- - local about = Div{parent=main_page,width=15,height=3,x=1,y=16,fg_bg=style.fp.disabled_fg} - local fw_v = TextBox{parent=about,x=1,y=1,text="FW: v00.00.00"} - local comms_v = TextBox{parent=about,x=1,y=2,text="NT: v00.00.00"} + local about = Div{parent=main_page,width=15,height=2,y=term_h-3,fg_bg=style.fp.disabled_fg} + local fw_v = TextBox{parent=about,text="FW: v00.00.00"} + local comms_v = TextBox{parent=about,text="NT: v00.00.00"} fw_v.register(ps, "version", function (version) fw_v.set_value(util.c("FW: ", version)) end) comms_v.register(ps, "comms_version", function (version) comms_v.set_value(util.c("NT: v", version)) end) @@ -145,7 +147,7 @@ local function init(panel, num_units) -- API page local api_page = Div{parent=page_div,x=1,y=1,hidden=true} - local api_list = ListBox{parent=api_page,x=1,y=1,height=17,width=51,scroll_height=1000,fg_bg=style.fp.text_fg,nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} + local api_list = ListBox{parent=api_page,y=1,height=term_h-2,width=term_w,scroll_height=1000,fg_bg=style.fp.text_fg,nav_fg_bg=cpair(colors.gray,colors.lightGray),nav_active=cpair(colors.black,colors.gray)} local _ = Div{parent=api_list,height=1} -- padding -- assemble page panes