#574 possible fix for RTU formed checking

This commit is contained in:
Mikayla
2024-12-12 03:18:21 +00:00
parent 849caa2521
commit 019284de7b
4 changed files with 50 additions and 14 deletions

View File

@@ -242,7 +242,7 @@ function ppm.mount_all()
end
end
-- mount a particular device
-- mount a specified device
---@nodiscard
---@param iface string CC peripheral interface
---@return string|nil type, table|nil device
@@ -266,6 +266,33 @@ function ppm.mount(iface)
return pm_type, pm_dev
end
-- unmount and remount a specified device
---@nodiscard
---@param iface string CC peripheral interface
---@return string|nil type, table|nil device
function ppm.remount(iface)
local ifaces = peripheral.getNames()
local pm_dev = nil
local pm_type = nil
for i = 1, #ifaces do
if iface == ifaces[i] then
log.info(util.c("PPM: remount(", iface, ") -> is a ", pm_type))
ppm.unmount(ppm_sys.mounts[iface].dev)
ppm_sys.mounts[iface] = peri_init(iface)
pm_type = ppm_sys.mounts[iface].type
pm_dev = ppm_sys.mounts[iface].dev
log.info(util.c("PPM: remount(", iface, ") -> remounted a ", pm_type))
break
end
end
return pm_type, pm_dev
end
-- mount a virtual, placeholder device (specifically designed for RTU startup with missing devices)
---@nodiscard
---@return string type, table device

View File

@@ -24,7 +24,7 @@ local t_pack = table.pack
local util = {}
-- scada-common version
util.version = "1.4.6"
util.version = "1.4.7"
util.TICK_TIME_S = 0.05
util.TICK_TIME_MS = 50