fixes to rtu modbus

This commit is contained in:
Mikayla Fischler 2022-11-11 23:49:45 -05:00
parent 8e28dbf2a6
commit f940c136bf
2 changed files with 17 additions and 17 deletions

View File

@ -56,11 +56,11 @@ function modbus.new(rtu_dev, use_parallel_read)
-- run parallel tasks if configured
if self.use_parallel then
parallel.waitForAll(table.unpack(tasks))
end
if access_fault then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
if access_fault or #readings ~= count then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
else
readings = MODBUS_EXCODE.ILLEGAL_DATA_ADDR
@ -105,11 +105,11 @@ function modbus.new(rtu_dev, use_parallel_read)
-- run parallel tasks if configured
if self.use_parallel then
parallel.waitForAll(table.unpack(tasks))
end
if access_fault then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
if access_fault or #readings ~= count then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
else
readings = MODBUS_EXCODE.ILLEGAL_DATA_ADDR
@ -154,11 +154,11 @@ function modbus.new(rtu_dev, use_parallel_read)
-- run parallel tasks if configured
if self.use_parallel then
parallel.waitForAll(table.unpack(tasks))
end
if access_fault then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
if access_fault or #readings ~= count then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
else
readings = MODBUS_EXCODE.ILLEGAL_DATA_ADDR
@ -203,11 +203,11 @@ function modbus.new(rtu_dev, use_parallel_read)
-- run parallel tasks if configured
if self.use_parallel then
parallel.waitForAll(table.unpack(tasks))
end
if access_fault then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
if access_fault or #readings ~= count then
return_ok = false
readings = MODBUS_EXCODE.SERVER_DEVICE_FAIL
end
else
readings = MODBUS_EXCODE.ILLEGAL_DATA_ADDR

View File

@ -24,7 +24,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 = "beta-v0.9.0"
local RTU_VERSION = "beta-v0.9.1"
local rtu_t = types.rtu_t