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