reactor PLC queue types refactor and properly report wireless modem connected when another is found
This commit is contained in:
@@ -118,7 +118,7 @@ function backplane.active_nic() return _bp.act_nic end
|
|||||||
---@param device table
|
---@param device table
|
||||||
---@param print_no_fp function
|
---@param print_no_fp function
|
||||||
function backplane.attach(iface, type, device, print_no_fp)
|
function backplane.attach(iface, type, device, print_no_fp)
|
||||||
local MQ__RPS_CMD = _bp.smem.q_cmds.MQ__RPS_CMD
|
local MQ__RPS_CMD = _bp.smem.q_types.MQ__RPS_CMD
|
||||||
|
|
||||||
local wl_nic, wd_nic = _bp.wl_nic, _bp.wd_nic
|
local wl_nic, wd_nic = _bp.wl_nic, _bp.wd_nic
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ end
|
|||||||
---@param device table
|
---@param device table
|
||||||
---@param print_no_fp function
|
---@param print_no_fp function
|
||||||
function backplane.detach(iface, type, device, print_no_fp)
|
function backplane.detach(iface, type, device, print_no_fp)
|
||||||
local MQ__RPS_CMD = _bp.smem.q_cmds.MQ__RPS_CMD
|
local MQ__RPS_CMD = _bp.smem.q_types.MQ__RPS_CMD
|
||||||
|
|
||||||
local wl_nic, wd_nic = _bp.wl_nic, _bp.wd_nic
|
local wl_nic, wd_nic = _bp.wl_nic, _bp.wd_nic
|
||||||
|
|
||||||
@@ -266,6 +266,8 @@ function backplane.detach(iface, type, device, print_no_fp)
|
|||||||
wl_nic.connect(modem)
|
wl_nic.connect(modem)
|
||||||
|
|
||||||
log.info("BKPLN: WIRELESS PHY_UP " .. m_iface)
|
log.info("BKPLN: WIRELESS PHY_UP " .. m_iface)
|
||||||
|
|
||||||
|
state.wl_modem = true
|
||||||
elseif wd_nic and wd_nic.is_connected() then
|
elseif wd_nic and wd_nic.is_connected() then
|
||||||
_bp.act_nic = wd_nic
|
_bp.act_nic = wd_nic
|
||||||
|
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ local function main()
|
|||||||
mq_comms_rx = mqueue.new()
|
mq_comms_rx = mqueue.new()
|
||||||
},
|
},
|
||||||
|
|
||||||
-- message queue commands
|
-- message queue message types
|
||||||
q_cmds = {
|
q_types = {
|
||||||
MQ__RPS_CMD = {
|
MQ__RPS_CMD = {
|
||||||
SCRAM = 1,
|
SCRAM = 1,
|
||||||
DEGRADED_SCRAM = 2,
|
DEGRADED_SCRAM = 2,
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ function threads.thread__main(smem)
|
|||||||
local plc_comms = smem.plc_sys.plc_comms
|
local plc_comms = smem.plc_sys.plc_comms
|
||||||
local conn_watchdog = smem.plc_sys.conn_watchdog
|
local conn_watchdog = smem.plc_sys.conn_watchdog
|
||||||
|
|
||||||
local MQ__RPS_CMD = smem.q_cmds.MQ__RPS_CMD
|
local MQ__RPS_CMD = smem.q_types.MQ__RPS_CMD
|
||||||
local MQ__COMM_CMD = smem.q_cmds.MQ__COMM_CMD
|
local MQ__COMM_CMD = smem.q_types.MQ__COMM_CMD
|
||||||
|
|
||||||
-- start clock
|
-- start clock
|
||||||
loop_clock.start()
|
loop_clock.start()
|
||||||
@@ -204,7 +204,7 @@ function threads.thread__rps(smem)
|
|||||||
|
|
||||||
local rps_queue = smem.q.mq_rps
|
local rps_queue = smem.q.mq_rps
|
||||||
|
|
||||||
local MQ__RPS_CMD = smem.q_cmds.MQ__RPS_CMD
|
local MQ__RPS_CMD = smem.q_types.MQ__RPS_CMD
|
||||||
|
|
||||||
local was_linked = false
|
local was_linked = false
|
||||||
local last_update = util.time()
|
local last_update = util.time()
|
||||||
@@ -339,7 +339,7 @@ function threads.thread__comms_tx(smem)
|
|||||||
local plc_state = smem.plc_state
|
local plc_state = smem.plc_state
|
||||||
local comms_queue = smem.q.mq_comms_tx
|
local comms_queue = smem.q.mq_comms_tx
|
||||||
|
|
||||||
local MQ__COMM_CMD = smem.q_cmds.MQ__COMM_CMD
|
local MQ__COMM_CMD = smem.q_types.MQ__COMM_CMD
|
||||||
|
|
||||||
local last_update = util.time()
|
local last_update = util.time()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user