mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
changed modbus init function name, fixed bugs with RTU startup, improved PPM debug prints
This commit is contained in:
parent
6d6953d795
commit
a6e1134dc3
@ -72,9 +72,9 @@ for reactor_idx = 1, #rtu_redstone do
|
||||
local config = io_table[i]
|
||||
|
||||
-- verify configuration
|
||||
if is_valid_channel(config.channel) and is_valid_side(config.side) then
|
||||
if rsio.is_valid_channel(config.channel) and rsio.is_valid_side(config.side) then
|
||||
if config.bundled_color then
|
||||
valid = is_color(config.bundled_color)
|
||||
valid = rsio.is_color(config.bundled_color)
|
||||
else
|
||||
valid = true
|
||||
end
|
||||
@ -115,7 +115,7 @@ for reactor_idx = 1, #rtu_redstone do
|
||||
reactor = rtu_redstone[reactor_idx].for_reactor,
|
||||
device = capabilities, -- use device field for redstone channels
|
||||
rtu = rs_rtu,
|
||||
modbus_io = modbus_init(rs_rtu)
|
||||
modbus_io = modbus.new(rs_rtu)
|
||||
})
|
||||
end
|
||||
|
||||
@ -158,7 +158,7 @@ for i = 1, #rtu_devices do
|
||||
reactor = rtu_devices[i].for_reactor,
|
||||
device = device,
|
||||
rtu = rtu_iface,
|
||||
modbus_io = modbus_init(rtu_iface)
|
||||
modbus_io = modbus.new(rtu_iface)
|
||||
})
|
||||
|
||||
log._debug("init> initialized RTU unit #" .. #units .. ": " .. rtu_devices[i].name .. " (" .. rtu_type .. ") [" ..
|
||||
@ -211,7 +211,7 @@ while true do
|
||||
unit.rtu = imatrix_rtu(device)
|
||||
end
|
||||
|
||||
unit.modbus_io = modbus_init(unit.rtu)
|
||||
unit.modbus_io = modbus.new(unit.rtu)
|
||||
|
||||
println_ts("reconnected the " .. unit.type .. " on interface " .. unit.name)
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ local MODBUS_EXCODE = {
|
||||
}
|
||||
|
||||
-- new modbus comms handler object
|
||||
function modbus_init(rtu_dev)
|
||||
function new(rtu_dev)
|
||||
local self = {
|
||||
rtu = rtu_dev
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ function mount_all()
|
||||
dev = pm_dev
|
||||
}
|
||||
|
||||
log._debug("PPM: found a " .. self.mounts[ifaces[i]].type)
|
||||
log._debug("PPM: found a " .. self.mounts[ifaces[i]].type .. " (" .. ifaces[i] .. ")")
|
||||
end
|
||||
|
||||
if #ifaces == 0 then
|
||||
|
Loading…
Reference in New Issue
Block a user