mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
fixed supervisor clock not starting
This commit is contained in:
parent
78ddd4d782
commit
214f2d9028
@ -35,7 +35,7 @@ local self = {
|
|||||||
---@param sessions table
|
---@param sessions table
|
||||||
local function _iterate(sessions)
|
local function _iterate(sessions)
|
||||||
for i = 1, #sessions do
|
for i = 1, #sessions do
|
||||||
local session = sessions[i] ---@type plc_session_struct
|
local session = sessions[i] ---@type plc_session_struct|rtu_session_struct
|
||||||
if session.open then
|
if session.open then
|
||||||
local ok = session.instance.iterate()
|
local ok = session.instance.iterate()
|
||||||
if ok then
|
if ok then
|
||||||
|
@ -13,7 +13,7 @@ local svsessions = require("supervisor.session.svsessions")
|
|||||||
local config = require("supervisor.config")
|
local config = require("supervisor.config")
|
||||||
local supervisor = require("supervisor.supervisor")
|
local supervisor = require("supervisor.supervisor")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "alpha-v0.3.10"
|
local SUPERVISOR_VERSION = "alpha-v0.4.0"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
@ -44,6 +44,9 @@ local superv_comms = supervisor.comms(SUPERVISOR_VERSION, config.NUM_REACTORS, m
|
|||||||
local MAIN_CLOCK = 0.15
|
local MAIN_CLOCK = 0.15
|
||||||
local loop_clock = util.new_clock(MAIN_CLOCK)
|
local loop_clock = util.new_clock(MAIN_CLOCK)
|
||||||
|
|
||||||
|
-- start clock
|
||||||
|
loop_clock.start()
|
||||||
|
|
||||||
-- event loop
|
-- event loop
|
||||||
while true do
|
while true do
|
||||||
---@diagnostic disable-next-line: undefined-field
|
---@diagnostic disable-next-line: undefined-field
|
||||||
|
@ -191,7 +191,7 @@ supervisor.comms = function (version, num_reactors, modem, dev_listen, coord_lis
|
|||||||
_send_plc_linking(next_seq_id, r_port, { RPLC_LINKING.COLLISION })
|
_send_plc_linking(next_seq_id, r_port, { RPLC_LINKING.COLLISION })
|
||||||
else
|
else
|
||||||
-- got an ID; assigned to a reactor successfully
|
-- got an ID; assigned to a reactor successfully
|
||||||
println("connected to reactor " .. packet.data[1] .. " PLC (" .. packet.data[2] .. ") [port " .. r_port .. "]")
|
println("connected to reactor " .. packet.data[1] .. " PLC (" .. packet.data[2] .. ") [:" .. r_port .. "]")
|
||||||
log.debug("PLC_LNK: allowed for device at " .. r_port)
|
log.debug("PLC_LNK: allowed for device at " .. r_port)
|
||||||
_send_plc_linking(next_seq_id, r_port, { RPLC_LINKING.ALLOW })
|
_send_plc_linking(next_seq_id, r_port, { RPLC_LINKING.ALLOW })
|
||||||
end
|
end
|
||||||
@ -215,7 +215,7 @@ supervisor.comms = function (version, num_reactors, modem, dev_listen, coord_lis
|
|||||||
elseif packet.type == SCADA_MGMT_TYPES.RTU_ADVERT then
|
elseif packet.type == SCADA_MGMT_TYPES.RTU_ADVERT then
|
||||||
if packet.length >= 1 then
|
if packet.length >= 1 then
|
||||||
-- this is an RTU advertisement for a new session
|
-- this is an RTU advertisement for a new session
|
||||||
println("connected to RTU (" .. packet.data[1] .. ") [port " .. r_port .. "]")
|
println("connected to RTU (" .. packet.data[1] .. ") [:" .. r_port .. "]")
|
||||||
|
|
||||||
svsessions.establish_rtu_session(l_port, r_port, packet.data)
|
svsessions.establish_rtu_session(l_port, r_port, packet.data)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user