#574 possible fix for RTU formed checking
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user