allow suppressing of PPM errors

This commit is contained in:
Mikayla Fischler 2022-04-02 11:45:43 -04:00
parent a77946ce2c
commit 7c2d89e70f

View File

@ -5,7 +5,8 @@
-- --
local self = { local self = {
mounts = {} mounts = {},
mute = false
} }
-- wrap peripheral calls with lua protected call -- wrap peripheral calls with lua protected call
@ -24,13 +25,25 @@ local peri_init = function (device)
end end
else else
-- function failed -- function failed
log._error("PPM: protected " .. key .. "() -> " .. result) if not mute then
log._error("PPM: protected " .. key .. "() -> " .. result)
end
return nil return nil
end end
end end
end end
end end
-- silence error prints
function disable_reporting()
self.mute = true
end
-- allow error prints
function enable_reporting()
self.mute = false
end
-- mount all available peripherals (clears mounts first) -- mount all available peripherals (clears mounts first)
function mount_all() function mount_all()
local ifaces = peripheral.getNames() local ifaces = peripheral.getNames()