This commit is contained in:
Mikayla Fischler 2025-08-19 22:14:19 -04:00
parent 4a1730ec47
commit 83e29abea7
2 changed files with 16 additions and 6 deletions

View File

@ -136,7 +136,7 @@ local function new_view(root)
svr_addr.register(ps, "comp_svr_addr", function (v) svr_addr.set_value(util.strval(v)) end) svr_addr.register(ps, "comp_svr_addr", function (v) svr_addr.set_value(util.strval(v)) end)
svr_fw.register(ps, "comp_svr_fw", function (v) svr_fw.set_value(util.strval(v)) end) svr_fw.register(ps, "comp_svr_fw", function (v) svr_fw.set_value(util.strval(v)) end)
local crd_div = Div{parent=m_div,y=11,height=9} local crd_div = Div{parent=m_div,y=11,height=7}
local crd_rect = Rectangle{parent=crd_div,height=7,width=21,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)} local crd_rect = Rectangle{parent=crd_div,height=7,width=21,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)}
TextBox{parent=crd_rect,text="Coordinator"} TextBox{parent=crd_rect,text="Coordinator"}
@ -208,22 +208,22 @@ local function new_view(root)
local type = ps.get(pfx .. "_type") local type = ps.get(pfx .. "_type")
if type == DEV_TYPE.PLC then if type == DEV_TYPE.PLC then
plc_elems[id] = Div{parent=plc_list,height=8} plc_elems[id] = Div{parent=plc_list,height=7}
local rect = Rectangle{parent=plc_elems[id],height=6,x=2,width=20,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)} local rect = Rectangle{parent=plc_elems[id],height=6,x=2,width=20,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)}
local title = TextBox{parent=rect,text="PLC (Unit ?)"} local title = TextBox{parent=rect,text="PLC (Unit ?)"}
title.register(ps, pfx .. "_unit", function (unit) title.set_value("PLC (Unit " .. unit .. ") @ " .. id) end) title.register(ps, pfx .. "_unit", function (unit) title.set_value("PLC (Unit " .. unit .. ")") end)
create_common_indicators(pfx, rect) create_common_indicators(pfx, rect)
elseif type == DEV_TYPE.RTU then elseif type == DEV_TYPE.RTU then
rtu_elems[id] = Div{parent=rtu_list,height=8} rtu_elems[id] = Div{parent=rtu_list,height=7}
local rect = Rectangle{parent=rtu_elems[id],height=6,x=2,width=20,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)} local rect = Rectangle{parent=rtu_elems[id],height=6,x=2,width=20,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)}
TextBox{parent=rect,text="RTU Gateway"} TextBox{parent=rect,text="RTU Gateway"}
create_common_indicators(pfx, rect) create_common_indicators(pfx, rect)
elseif type == DEV_TYPE.PKT then elseif type == DEV_TYPE.PKT then
pkt_elems[id] = Div{parent=pkt_list,height=8} pkt_elems[id] = Div{parent=pkt_list,height=7}
local rect = Rectangle{parent=pkt_elems[id],height=6,x=2,width=20,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)} local rect = Rectangle{parent=pkt_elems[id],height=6,x=2,width=20,border=border(1,colors.white,true),thin=true,fg_bg=cpair(colors.white,colors.gray)}
TextBox{parent=rect,text="Pocket Computer"} TextBox{parent=rect,text="Pocket Computer"}

View File

@ -2,6 +2,7 @@ local comms = require("scada-common.comms")
local log = require("scada-common.log") local log = require("scada-common.log")
local mqueue = require("scada-common.mqueue") local mqueue = require("scada-common.mqueue")
local util = require("scada-common.util") local util = require("scada-common.util")
local databus = require("supervisor.databus") local databus = require("supervisor.databus")
local pocket = {} local pocket = {}
@ -198,8 +199,17 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout,
-- add the PLCs if connected -- add the PLCs if connected
for i = 1, #facility.get_units() do for i = 1, #facility.get_units() do
local tag = "plc_" .. i local tag = "plc_" .. i
local addr = -1
for _, s in ipairs(sessions.plc) do
if s.reactor == i then
addr = s.s_addr
break
end
end
if get(tag .. "_conn") then if get(tag .. "_conn") then
table.insert(devices, { DEV_TYPE.CRD, get(tag .. "_addr"), get(tag .. "_fw"), get(tag .. "_rtt"), i }) table.insert(devices, { DEV_TYPE.PLC, addr, get(tag .. "_fw"), get(tag .. "_rtt"), i })
end end
end end