mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
allow suppressing of PPM errors
This commit is contained in:
parent
a77946ce2c
commit
7c2d89e70f
@ -5,7 +5,8 @@
|
||||
--
|
||||
|
||||
local self = {
|
||||
mounts = {}
|
||||
mounts = {},
|
||||
mute = false
|
||||
}
|
||||
|
||||
-- wrap peripheral calls with lua protected call
|
||||
@ -24,13 +25,25 @@ local peri_init = function (device)
|
||||
end
|
||||
else
|
||||
-- function failed
|
||||
log._error("PPM: protected " .. key .. "() -> " .. result)
|
||||
if not mute then
|
||||
log._error("PPM: protected " .. key .. "() -> " .. result)
|
||||
end
|
||||
return nil
|
||||
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)
|
||||
function mount_all()
|
||||
local ifaces = peripheral.getNames()
|
||||
|
Loading…
Reference in New Issue
Block a user