ppm patch to support multiple return value functions, changed lack of modem to emit fatal error
This commit is contained in:
parent
706bf4d3ba
commit
ff5b163c1d
@ -13,7 +13,7 @@ local config = require("reactor-plc.config")
|
|||||||
local plc = require("reactor-plc.plc")
|
local plc = require("reactor-plc.plc")
|
||||||
local threads = require("reactor-plc.threads")
|
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 print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
|
|||||||
@ -24,7 +24,7 @@ local imatrix_rtu = require("rtu.dev.imatrix_rtu")
|
|||||||
local turbine_rtu = require("rtu.dev.turbine_rtu")
|
local turbine_rtu = require("rtu.dev.turbine_rtu")
|
||||||
local turbinev_rtu = require("rtu.dev.turbinev_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
|
local rtu_t = types.rtu_t
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ local smem_sys = __shared_memory.rtu_sys
|
|||||||
-- get modem
|
-- get modem
|
||||||
if smem_dev.modem == nil then
|
if smem_dev.modem == nil then
|
||||||
println("boot> wireless modem not found")
|
println("boot> wireless modem not found")
|
||||||
log.warning("no wireless modem on startup")
|
log.fatal("no wireless modem on startup")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,10 @@ local peri_init = function (iface)
|
|||||||
for key, func in pairs(self.device) do
|
for key, func in pairs(self.device) do
|
||||||
self.fault_counts[key] = 0
|
self.fault_counts[key] = 0
|
||||||
self.device[key] = function (...)
|
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
|
if status then
|
||||||
-- auto fault clear
|
-- auto fault clear
|
||||||
@ -56,8 +59,10 @@ local peri_init = function (iface)
|
|||||||
|
|
||||||
self.fault_counts[key] = 0
|
self.fault_counts[key] = 0
|
||||||
|
|
||||||
return result
|
return table.unpack(return_table)
|
||||||
else
|
else
|
||||||
|
local result = return_table[1]
|
||||||
|
|
||||||
-- function failed
|
-- function failed
|
||||||
self.faulted = true
|
self.faulted = true
|
||||||
self.last_fault = result
|
self.last_fault = result
|
||||||
|
|||||||
@ -13,7 +13,7 @@ local svsessions = require("supervisor.session.svsessions")
|
|||||||
local config = require("supervisor.config")
|
local config = require("supervisor.config")
|
||||||
local supervisor = require("supervisor.supervisor")
|
local supervisor = require("supervisor.supervisor")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "alpha-v0.4.0"
|
local SUPERVISOR_VERSION = "beta-v0.4.1"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
@ -33,7 +33,7 @@ ppm.mount_all()
|
|||||||
local modem = ppm.get_wireless_modem()
|
local modem = ppm.get_wireless_modem()
|
||||||
if modem == nil then
|
if modem == nil then
|
||||||
println("boot> wireless modem not found")
|
println("boot> wireless modem not found")
|
||||||
log.warning("no wireless modem on startup")
|
log.fatal("no wireless modem on startup")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user