changed modbus init function name, fixed bugs with RTU startup, improved PPM debug prints

This commit is contained in:
Mikayla Fischler 2022-04-18 00:10:47 -04:00
parent 6d6953d795
commit a6e1134dc3
3 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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