From ff5b163c1db9549e083636d47e2dbd3a9b4b7eda Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 29 May 2022 14:26:40 -0400 Subject: [PATCH] ppm patch to support multiple return value functions, changed lack of modem to emit fatal error --- reactor-plc/startup.lua | 2 +- rtu/startup.lua | 4 ++-- scada-common/ppm.lua | 9 +++++++-- supervisor/startup.lua | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 062db60..d6e23c0 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -13,7 +13,7 @@ local config = require("reactor-plc.config") local plc = require("reactor-plc.plc") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "alpha-v0.7.2" +local R_PLC_VERSION = "beta-v0.7.3" local print = util.print local println = util.println diff --git a/rtu/startup.lua b/rtu/startup.lua index 6f5730e..6700b86 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -24,7 +24,7 @@ local imatrix_rtu = require("rtu.dev.imatrix_rtu") local turbine_rtu = require("rtu.dev.turbine_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "alpha-v0.7.1" +local RTU_VERSION = "beta-v0.7.2" local rtu_t = types.rtu_t @@ -80,7 +80,7 @@ local smem_sys = __shared_memory.rtu_sys -- get modem if smem_dev.modem == nil then println("boot> wireless modem not found") - log.warning("no wireless modem on startup") + log.fatal("no wireless modem on startup") return end diff --git a/scada-common/ppm.lua b/scada-common/ppm.lua index d07e703..b42731b 100644 --- a/scada-common/ppm.lua +++ b/scada-common/ppm.lua @@ -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 diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 307b8e6..1dcf7a7 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -13,7 +13,7 @@ local svsessions = require("supervisor.session.svsessions") local config = require("supervisor.config") local supervisor = require("supervisor.supervisor") -local SUPERVISOR_VERSION = "alpha-v0.4.0" +local SUPERVISOR_VERSION = "beta-v0.4.1" local print = util.print local println = util.println @@ -33,7 +33,7 @@ ppm.mount_all() local modem = ppm.get_wireless_modem() if modem == nil then println("boot> wireless modem not found") - log.warning("no wireless modem on startup") + log.fatal("no wireless modem on startup") return end