mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
RTU/PPM bugfixes
This commit is contained in:
parent
f7c11febe5
commit
17d0213d58
@ -326,16 +326,6 @@ function comms_init(id, modem, local_port, server_port, reactor, iss)
|
|||||||
end
|
end
|
||||||
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 --
|
-- PUBLIC FUNCTIONS --
|
||||||
|
|
||||||
-- reconnect a newly connected modem
|
-- reconnect a newly connected modem
|
||||||
|
@ -10,7 +10,7 @@ os.loadAPI("scada-common/comms.lua")
|
|||||||
os.loadAPI("config.lua")
|
os.loadAPI("config.lua")
|
||||||
os.loadAPI("plc.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 print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
|
@ -17,7 +17,7 @@ os.loadAPI("dev/boiler_rtu.lua")
|
|||||||
os.loadAPI("dev/imatrix_rtu.lua")
|
os.loadAPI("dev/imatrix_rtu.lua")
|
||||||
os.loadAPI("dev/turbine_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 print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
@ -185,7 +185,7 @@ while true do
|
|||||||
|
|
||||||
for i = 1, #units do
|
for i = 1, #units do
|
||||||
-- find disconnected device
|
-- 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
|
-- we are going to let the PPM prevent crashes
|
||||||
-- return fault flags/codes to MODBUS queries
|
-- return fault flags/codes to MODBUS queries
|
||||||
local unit = units[i]
|
local unit = units[i]
|
||||||
|
@ -116,7 +116,7 @@ function mount_all()
|
|||||||
dev = pm_dev
|
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
|
end
|
||||||
|
|
||||||
if #ifaces == 0 then
|
if #ifaces == 0 then
|
||||||
@ -132,7 +132,7 @@ function mount(iface)
|
|||||||
|
|
||||||
for i = 1, #ifaces do
|
for i = 1, #ifaces do
|
||||||
if iface == ifaces[i] then
|
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)
|
type = peripheral.getType(iface)
|
||||||
pm_dev = peripheral.wrap(iface)
|
pm_dev = peripheral.wrap(iface)
|
||||||
@ -153,9 +153,13 @@ end
|
|||||||
function handle_unmount(iface)
|
function handle_unmount(iface)
|
||||||
-- what got disconnected?
|
-- what got disconnected?
|
||||||
local lost_dev = self.mounts[iface]
|
local lost_dev = self.mounts[iface]
|
||||||
local type = lost_dev.type
|
|
||||||
|
if lost_dev then
|
||||||
log._warning("PPM: lost device " .. type .. " mounted to " .. iface)
|
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
|
return lost_dev
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user