mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#225 added computer IDs to PLC/RTU front panels, updated supervisor front panel to use computer ID terminology
This commit is contained in:
parent
63147bfab5
commit
b20d42ff38
@ -17,7 +17,7 @@ local coreio = require("pocket.coreio")
|
||||
local pocket = require("pocket.pocket")
|
||||
local renderer = require("pocket.renderer")
|
||||
|
||||
local POCKET_VERSION = "alpha-v0.3.7"
|
||||
local POCKET_VERSION = "alpha-v0.4.0"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
@ -70,6 +70,10 @@ local function init(panel)
|
||||
rt_cmrx.register(databus.ps, "routine__comms_rx", rt_cmrx.update)
|
||||
rt_sctl.register(databus.ps, "routine__spctl", rt_sctl.update)
|
||||
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local comp_id = util.sprintf("(%d)", os.getComputerID())
|
||||
TextBox{parent=system,x=9,y=5,width=6,height=1,text=comp_id,fg_bg=cpair(colors.lightGray,colors.ivory)}
|
||||
|
||||
--
|
||||
-- status & controls
|
||||
--
|
||||
|
@ -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.4.1"
|
||||
local R_PLC_VERSION = "v1.4.2"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
@ -67,6 +67,10 @@ local function init(panel, units)
|
||||
rt_main.register(databus.ps, "routine__main", rt_main.update)
|
||||
rt_comm.register(databus.ps, "routine__comms", rt_comm.update)
|
||||
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local comp_id = util.sprintf("(%d)", os.getComputerID())
|
||||
TextBox{parent=system,x=9,y=4,width=6,height=1,text=comp_id,fg_bg=cpair(colors.lightGray,colors.ivory)}
|
||||
|
||||
--
|
||||
-- about label
|
||||
--
|
||||
|
@ -28,7 +28,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.3.1"
|
||||
local RTU_VERSION = "v1.3.2"
|
||||
|
||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||
|
@ -31,11 +31,11 @@ end
|
||||
-- transmit PLC firmware version and session connection state
|
||||
---@param reactor_id integer reactor unit ID
|
||||
---@param fw string firmware version
|
||||
---@param channel integer PLC remote port
|
||||
function databus.tx_plc_connected(reactor_id, fw, channel)
|
||||
---@param s_addr integer PLC computer ID
|
||||
function databus.tx_plc_connected(reactor_id, fw, s_addr)
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_fw", fw)
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_conn", true)
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_chan", tostring(channel))
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_addr", tostring(s_addr))
|
||||
end
|
||||
|
||||
-- transmit PLC disconnected
|
||||
@ -43,7 +43,7 @@ end
|
||||
function databus.tx_plc_disconnected(reactor_id)
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_fw", " ------- ")
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_conn", false)
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_chan", " --- ")
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_addr", " --- ")
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_rtt", 0)
|
||||
databus.ps.publish("plc_" .. reactor_id .. "_rtt_color", colors.lightGray)
|
||||
end
|
||||
@ -66,10 +66,10 @@ end
|
||||
-- transmit RTU firmware version and session connection state
|
||||
---@param session_id integer RTU session
|
||||
---@param fw string firmware version
|
||||
---@param channel integer RTU remote port
|
||||
function databus.tx_rtu_connected(session_id, fw, channel)
|
||||
---@param s_addr integer RTU computer ID
|
||||
function databus.tx_rtu_connected(session_id, fw, s_addr)
|
||||
databus.ps.publish("rtu_" .. session_id .. "_fw", fw)
|
||||
databus.ps.publish("rtu_" .. session_id .. "_chan", tostring(channel))
|
||||
databus.ps.publish("rtu_" .. session_id .. "_addr", tostring(s_addr))
|
||||
pgi.create_rtu_entry(session_id)
|
||||
end
|
||||
|
||||
@ -103,18 +103,18 @@ end
|
||||
|
||||
-- transmit coordinator firmware version and session connection state
|
||||
---@param fw string firmware version
|
||||
---@param channel integer coordinator remote port
|
||||
function databus.tx_crd_connected(fw, channel)
|
||||
---@param s_addr integer coordinator computer ID
|
||||
function databus.tx_crd_connected(fw, s_addr)
|
||||
databus.ps.publish("crd_fw", fw)
|
||||
databus.ps.publish("crd_conn", true)
|
||||
databus.ps.publish("crd_chan", tostring(channel))
|
||||
databus.ps.publish("crd_addr", tostring(s_addr))
|
||||
end
|
||||
|
||||
-- transmit coordinator disconnected
|
||||
function databus.tx_crd_disconnected()
|
||||
databus.ps.publish("crd_fw", " ------- ")
|
||||
databus.ps.publish("crd_conn", false)
|
||||
databus.ps.publish("crd_chan", "---")
|
||||
databus.ps.publish("crd_addr", "---")
|
||||
databus.ps.publish("crd_rtt", 0)
|
||||
databus.ps.publish("crd_rtt_color", colors.lightGray)
|
||||
end
|
||||
@ -136,10 +136,10 @@ end
|
||||
-- transmit PKT firmware version and PDG session connection state
|
||||
---@param session_id integer PDG session
|
||||
---@param fw string firmware version
|
||||
---@param channel integer PDG remote port
|
||||
function databus.tx_pdg_connected(session_id, fw, channel)
|
||||
---@param s_addr integer PDG computer ID
|
||||
function databus.tx_pdg_connected(session_id, fw, s_addr)
|
||||
databus.ps.publish("pdg_" .. session_id .. "_fw", fw)
|
||||
databus.ps.publish("pdg_" .. session_id .. "_chan", tostring(channel))
|
||||
databus.ps.publish("pdg_" .. session_id .. "_addr", tostring(s_addr))
|
||||
pgi.create_pdg_entry(session_id)
|
||||
end
|
||||
|
||||
|
@ -28,9 +28,9 @@ local function init(parent, id)
|
||||
local ps_prefix = "pdg_" .. id .. "_"
|
||||
|
||||
TextBox{parent=entry,x=1,y=1,text="",width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray)}
|
||||
local pdg_chan = TextBox{parent=entry,x=1,y=2,text=" :00000",alignment=TEXT_ALIGN.CENTER,width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray),nav_active=cpair(colors.gray,colors.black)}
|
||||
local pdg_addr = TextBox{parent=entry,x=1,y=2,text="C #?",alignment=TEXT_ALIGN.CENTER,width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray),nav_active=cpair(colors.gray,colors.black)}
|
||||
TextBox{parent=entry,x=1,y=3,text="",width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray)}
|
||||
pdg_chan.register(databus.ps, ps_prefix .. "chan", function (channel) pdg_chan.set_value(util.sprintf(" :%05d", channel)) end)
|
||||
pdg_addr.register(databus.ps, ps_prefix .. "addr", function (addr) pdg_addr.set_value(util.sprintf("C #%d", addr)) end)
|
||||
|
||||
TextBox{parent=entry,x=10,y=2,text="FW:",width=3,height=1}
|
||||
local pdg_fw_v = TextBox{parent=entry,x=14,y=2,text=" ------- ",width=20,height=1,fg_bg=cpair(colors.lightGray,colors.white)}
|
||||
|
@ -28,9 +28,9 @@ local function init(parent, id)
|
||||
local ps_prefix = "rtu_" .. id .. "_"
|
||||
|
||||
TextBox{parent=entry,x=1,y=1,text="",width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray)}
|
||||
local rtu_chan = TextBox{parent=entry,x=1,y=2,text=" :00000",alignment=TEXT_ALIGN.CENTER,width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray),nav_active=cpair(colors.gray,colors.black)}
|
||||
local rtu_addr = TextBox{parent=entry,x=1,y=2,text="C #?",alignment=TEXT_ALIGN.CENTER,width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray),nav_active=cpair(colors.gray,colors.black)}
|
||||
TextBox{parent=entry,x=1,y=3,text="",width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray)}
|
||||
rtu_chan.register(databus.ps, ps_prefix .. "chan", function (channel) rtu_chan.set_value(util.sprintf(" :%05d", channel)) end)
|
||||
rtu_addr.register(databus.ps, ps_prefix .. "addr", function (addr) rtu_addr.set_value(util.sprintf("C #%d", addr)) end)
|
||||
|
||||
TextBox{parent=entry,x=10,y=2,text="UNITS:",width=7,height=1}
|
||||
local unit_count = DataIndicator{parent=entry,x=17,y=2,label="",unit="",format="%2d",value=0,width=2,fg_bg=cpair(colors.gray,colors.white)}
|
||||
|
@ -56,6 +56,10 @@ local function init(panel)
|
||||
|
||||
modem.register(databus.ps, "has_modem", modem.update)
|
||||
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local comp_id = util.sprintf("(%d)", os.getComputerID())
|
||||
TextBox{parent=system,x=9,y=4,width=6,height=1,text=comp_id,fg_bg=cpair(colors.lightGray,colors.ivory)}
|
||||
|
||||
--
|
||||
-- about footer
|
||||
--
|
||||
@ -84,11 +88,11 @@ local function init(panel)
|
||||
TextBox{parent=plc_entry,x=1,y=2,text="UNIT "..i,alignment=TEXT_ALIGN.CENTER,width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray)}
|
||||
TextBox{parent=plc_entry,x=1,y=3,text="",width=8,height=1,fg_bg=cpair(colors.black,colors.lightGray)}
|
||||
|
||||
local conn = LED{parent=plc_entry,x=10,y=2,label="CONN",colors=cpair(colors.green,colors.green_off)}
|
||||
local conn = LED{parent=plc_entry,x=10,y=2,label="LINK",colors=cpair(colors.green,colors.green_off)}
|
||||
conn.register(databus.ps, ps_prefix .. "conn", conn.update)
|
||||
|
||||
local plc_chan = TextBox{parent=plc_entry,x=17,y=2,text=" --- ",width=5,height=1,fg_bg=cpair(colors.gray,colors.white)}
|
||||
plc_chan.register(databus.ps, ps_prefix .. "chan", plc_chan.set_value)
|
||||
local plc_addr = TextBox{parent=plc_entry,x=17,y=2,text=" --- ",width=5,height=1,fg_bg=cpair(colors.gray,colors.white)}
|
||||
plc_addr.register(databus.ps, ps_prefix .. "addr", plc_addr.set_value)
|
||||
|
||||
TextBox{parent=plc_entry,x=23,y=2,text="FW:",width=3,height=1}
|
||||
local plc_fw_v = TextBox{parent=plc_entry,x=27,y=2,text=" ------- ",width=9,height=1,fg_bg=cpair(colors.lightGray,colors.white)}
|
||||
@ -117,9 +121,9 @@ local function init(panel)
|
||||
local crd_conn = LED{parent=crd_box,x=2,y=2,label="CONNECTION",colors=cpair(colors.green,colors.green_off)}
|
||||
crd_conn.register(databus.ps, "crd_conn", crd_conn.update)
|
||||
|
||||
TextBox{parent=crd_box,x=4,y=3,text="CHANNEL ",width=8,height=1,fg_bg=cpair(colors.gray,colors.white)}
|
||||
local crd_chan = TextBox{parent=crd_box,x=12,y=3,text="---",width=5,height=1,fg_bg=cpair(colors.gray,colors.white)}
|
||||
crd_chan.register(databus.ps, "crd_chan", crd_chan.set_value)
|
||||
TextBox{parent=crd_box,x=4,y=3,text="COMPUTER",width=8,height=1,fg_bg=cpair(colors.gray,colors.white)}
|
||||
local crd_addr = TextBox{parent=crd_box,x=13,y=3,text="---",width=5,height=1,fg_bg=cpair(colors.gray,colors.white)}
|
||||
crd_addr.register(databus.ps, "crd_addr", crd_addr.set_value)
|
||||
|
||||
TextBox{parent=crd_box,x=22,y=2,text="FW:",width=3,height=1}
|
||||
local crd_fw_v = TextBox{parent=crd_box,x=26,y=2,text=" ------- ",width=9,height=1,fg_bg=cpair(colors.lightGray,colors.white)}
|
||||
|
@ -251,7 +251,7 @@ end
|
||||
---@return pdg_session_struct|nil
|
||||
function svsessions.find_pdg_session(source_addr)
|
||||
-- check diagnostic sessions
|
||||
local session = _find_session(self.sessions.diag, source_addr)
|
||||
local session = _find_session(self.sessions.pdg, source_addr)
|
||||
---@cast session pdg_session_struct|nil
|
||||
return session
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v0.17.0"
|
||||
local SUPERVISOR_VERSION = "v0.17.1"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
Loading…
Reference in New Issue
Block a user