Merge branch 'devel' into 225-consolidate-network-channels

This commit is contained in:
Mikayla Fischler
2023-06-05 01:18:13 -04:00
95 changed files with 2338 additions and 847 deletions

View File

@@ -11,8 +11,6 @@ local DEVICE_TYPE = comms.DEVICE_TYPE
local ESTABLISH_ACK = comms.ESTABLISH_ACK
local SCADA_MGMT_TYPE = comms.SCADA_MGMT_TYPE
local println = util.println
-- supervisory controller communications
---@nodiscard
---@param _version string supervisor version
@@ -21,8 +19,13 @@ local println = util.println
---@param modem table modem device
---@param channels sv_channel_list network channels
---@param range integer trusted device connection range
---@param fp_ok boolean if the front panel UI is running
---@diagnostic disable-next-line: unused-local
function supervisor.comms(_version, num_reactors, cooling_conf, modem, channels, range)
function supervisor.comms(_version, num_reactors, cooling_conf, modem, channels, range, fp_ok)
-- print a log message to the terminal as long as the UI isn't running
local function println(message) if not fp_ok then util.println_ts(message) end end
-- channel list
local svr_channel = channels.SVR
local plc_channel = channels.PLC
local rtu_channel = channels.RTU
@@ -45,8 +48,8 @@ function supervisor.comms(_version, num_reactors, cooling_conf, modem, channels,
_conf_channels()
-- link modem to svsessions
svsessions.init(modem, num_reactors, cooling_conf)
-- pass modem, status, and config data to svsessions
svsessions.init(modem, fp_ok, num_reactors, cooling_conf)
-- send an establish request response
---@param packet scada_packet
@@ -325,7 +328,7 @@ function supervisor.comms(_version, num_reactors, cooling_conf, modem, channels,
end
elseif dev_type == DEVICE_TYPE.PKT then
-- this is an attempt to establish a new pocket diagnostic session
local s_id = svsessions.establish_diag_session(l_chan, r_chan, firmware_v)
local s_id = svsessions.establish_pdg_session(l_chan, r_chan, firmware_v)
println(util.c("PKT (", firmware_v, ") [:", r_chan, "] \xbb connected"))
log.info(util.c("SVCTL_ESTABLISH: pocket (", firmware_v, ") [:", r_chan, "] connected with session ID ", s_id))