catch terminations that are caught by PPM

This commit is contained in:
Mikayla Fischler
2022-04-18 10:31:24 -04:00
parent 91079eeb78
commit 6a5e0243be
3 changed files with 32 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ local self = {
mounts = {},
auto_cf = false,
faulted = false,
terminate = false,
mute = false
}
@@ -38,9 +39,15 @@ local peri_init = function (device)
else
-- function failed
self.faulted = true
if not mute then
log._error("PPM: protected " .. key .. "() -> " .. result)
end
if result == "Terminated" then
self.terminate = true
end
return ACCESS_FAULT
end
end
@@ -85,6 +92,13 @@ function clear_fault()
self.faulted = false
end
-- TERMINATION --
-- if a caught error was a termination request
function should_terminate()
return self.terminate
end
-- MOUNTING --
-- mount all available peripherals (clears mounts first)