ppm patch to support multiple return value functions, changed lack of modem to emit fatal error

This commit is contained in:
Mikayla Fischler
2022-05-29 14:26:40 -04:00
parent 706bf4d3ba
commit ff5b163c1d
4 changed files with 12 additions and 7 deletions

View File

@@ -47,7 +47,10 @@ local peri_init = function (iface)
for key, func in pairs(self.device) do
self.fault_counts[key] = 0
self.device[key] = function (...)
local status, result = pcall(func, ...)
local return_table = table.pack(pcall(func, ...))
local status = return_table[1]
table.remove(return_table, 1)
if status then
-- auto fault clear
@@ -56,8 +59,10 @@ local peri_init = function (iface)
self.fault_counts[key] = 0
return result
return table.unpack(return_table)
else
local result = return_table[1]
-- function failed
self.faulted = true
self.last_fault = result