RTU/PPM bugfixes

This commit is contained in:
Mikayla Fischler 2022-04-22 10:58:18 -04:00
parent f7c11febe5
commit 17d0213d58
4 changed files with 12 additions and 18 deletions

View File

@ -326,16 +326,6 @@ function comms_init(id, modem, local_port, server_port, reactor, iss)
end
end
local _send_iss_status = function ()
local iss_status = {
id = self.id,
type = RPLC_TYPES.ISS_STATUS,
status = iss.status()
}
_send(iss_status)
end
-- PUBLIC FUNCTIONS --
-- reconnect a newly connected modem

View File

@ -10,7 +10,7 @@ os.loadAPI("scada-common/comms.lua")
os.loadAPI("config.lua")
os.loadAPI("plc.lua")
local R_PLC_VERSION = "alpha-v0.2.3"
local R_PLC_VERSION = "alpha-v0.2.4"
local print = util.print
local println = util.println

View File

@ -17,7 +17,7 @@ os.loadAPI("dev/boiler_rtu.lua")
os.loadAPI("dev/imatrix_rtu.lua")
os.loadAPI("dev/turbine_rtu.lua")
local RTU_VERSION = "alpha-v0.2.2"
local RTU_VERSION = "alpha-v0.2.3"
local print = util.print
local println = util.println
@ -185,7 +185,7 @@ while true do
for i = 1, #units do
-- find disconnected device
if units[i].device == device then
if units[i].device == device.dev then
-- we are going to let the PPM prevent crashes
-- return fault flags/codes to MODBUS queries
local unit = units[i]

View File

@ -116,7 +116,7 @@ function mount_all()
dev = pm_dev
}
log._debug("PPM: found a " .. self.mounts[ifaces[i]].type .. " (" .. ifaces[i] .. ")")
log._info("PPM: found a " .. self.mounts[ifaces[i]].type .. " (" .. ifaces[i] .. ")")
end
if #ifaces == 0 then
@ -132,7 +132,7 @@ function mount(iface)
for i = 1, #ifaces do
if iface == ifaces[i] then
log._debug("PPM: mount(" .. iface .. ") -> found a " .. peripheral.getType(iface))
log._info("PPM: mount(" .. iface .. ") -> found a " .. peripheral.getType(iface))
type = peripheral.getType(iface)
pm_dev = peripheral.wrap(iface)
@ -153,9 +153,13 @@ end
function handle_unmount(iface)
-- what got disconnected?
local lost_dev = self.mounts[iface]
local type = lost_dev.type
log._warning("PPM: lost device " .. type .. " mounted to " .. iface)
if lost_dev then
local type = lost_dev.type
log._warning("PPM: lost device " .. type .. " mounted to " .. iface)
else
log._error("PPM: lost device unknown to the PPM mounted to " .. iface)
end
return lost_dev
end