#291 RTU comms thread no longer yields every packet
This commit is contained in:
parent
c0f45cfb8b
commit
681bb0963e
File diff suppressed because one or more lines are too long
@ -30,7 +30,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
|||||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||||
|
|
||||||
local RTU_VERSION = "v1.5.4"
|
local RTU_VERSION = "v1.5.5"
|
||||||
|
|
||||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||||
|
|||||||
@ -308,7 +308,9 @@ function threads.thread__comms(smem)
|
|||||||
|
|
||||||
-- thread loop
|
-- thread loop
|
||||||
while true do
|
while true do
|
||||||
-- check for messages in the message queue
|
local handle_start = util.time()
|
||||||
|
|
||||||
|
-- check for messages in the message queue while not shut down
|
||||||
while comms_queue.ready() and not rtu_state.shutdown do
|
while comms_queue.ready() and not rtu_state.shutdown do
|
||||||
local msg = comms_queue.pop()
|
local msg = comms_queue.pop()
|
||||||
|
|
||||||
@ -324,10 +326,16 @@ function threads.thread__comms(smem)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- quick yield
|
-- max 100ms spent processing queue
|
||||||
util.nop()
|
if util.time() - handle_start > 100 then
|
||||||
|
log.warning("comms thread exceeded 100ms queue process limit")
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- quick yield
|
||||||
|
util.nop()
|
||||||
|
|
||||||
-- check for termination request
|
-- check for termination request
|
||||||
if rtu_state.shutdown then
|
if rtu_state.shutdown then
|
||||||
rtu_comms.close(rtu_state)
|
rtu_comms.close(rtu_state)
|
||||||
@ -414,6 +422,12 @@ function threads.thread__unit_comms(smem, unit)
|
|||||||
util.nop()
|
util.nop()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- check for termination request
|
||||||
|
if rtu_state.shutdown then
|
||||||
|
log.info("rtu unit thread exiting -> " .. short_name)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
-- check if multiblock is still formed if this is a multiblock
|
-- check if multiblock is still formed if this is a multiblock
|
||||||
if unit.is_multiblock and (util.time_ms() - last_f_check > 250) then
|
if unit.is_multiblock and (util.time_ms() - last_f_check > 250) then
|
||||||
local is_formed = unit.device.isFormed()
|
local is_formed = unit.device.isFormed()
|
||||||
@ -507,12 +521,6 @@ function threads.thread__unit_comms(smem, unit)
|
|||||||
-- update hw status
|
-- update hw status
|
||||||
databus.tx_unit_hw_status(unit.uid, unit.hw_state)
|
databus.tx_unit_hw_status(unit.uid, unit.hw_state)
|
||||||
|
|
||||||
-- check for termination request
|
|
||||||
if rtu_state.shutdown then
|
|
||||||
log.info("rtu unit thread exiting -> " .. short_name)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
-- delay before next check
|
-- delay before next check
|
||||||
last_update = util.adaptive_delay(COMMS_SLEEP, last_update)
|
last_update = util.adaptive_delay(COMMS_SLEEP, last_update)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user