#559 discard modbus messages if busy
This commit is contained in:
parent
11fa9f625d
commit
1190fe2dd5
12
rtu/rtu.lua
12
rtu/rtu.lua
@ -481,16 +481,14 @@ function rtu.comms(version, nic, conn_watchdog)
|
||||
-- check validity then pass off to unit comms thread
|
||||
return_code, reply = unit.modbus_io.check_request(packet)
|
||||
if return_code then
|
||||
-- check if there are more than 3 active transactions
|
||||
-- still queue the packet, but this may indicate a problem
|
||||
-- check if there are more than 3 active transactions, which will be treated as busy
|
||||
if unit.pkt_queue.length() > 3 then
|
||||
reply = modbus.reply__srv_device_busy(packet)
|
||||
log.debug("queueing new request with " .. unit.pkt_queue.length() ..
|
||||
" transactions already in the queue" .. unit_dbg_tag)
|
||||
end
|
||||
|
||||
-- always queue the command even if busy
|
||||
log.warning("device busy, discarding new request" .. unit_dbg_tag)
|
||||
else
|
||||
-- queue the command if not busy
|
||||
unit.pkt_queue.push_packet(packet)
|
||||
end
|
||||
else
|
||||
log.warning("cannot perform requested MODBUS operation" .. unit_dbg_tag)
|
||||
end
|
||||
|
||||
@ -31,7 +31,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.10.21"
|
||||
local RTU_VERSION = "v1.11.0"
|
||||
|
||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||
local RTU_HW_STATE = databus.RTU_HW_STATE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user