From f7c11febe526659d4322b2b8c6b72671b33b86b2 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 22 Apr 2022 10:21:15 -0400 Subject: [PATCH] check if interface exists before trying to get its device or type --- reactor-plc/startup.lua | 2 +- rtu/startup.lua | 2 +- scada-common/ppm.lua | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 1737f3f..b57845c 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -10,7 +10,7 @@ os.loadAPI("scada-common/comms.lua") os.loadAPI("config.lua") os.loadAPI("plc.lua") -local R_PLC_VERSION = "alpha-v0.2.2" +local R_PLC_VERSION = "alpha-v0.2.3" local print = util.print local println = util.println diff --git a/rtu/startup.lua b/rtu/startup.lua index bb7e3e1..0074625 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -17,7 +17,7 @@ os.loadAPI("dev/boiler_rtu.lua") os.loadAPI("dev/imatrix_rtu.lua") os.loadAPI("dev/turbine_rtu.lua") -local RTU_VERSION = "alpha-v0.2.1" +local RTU_VERSION = "alpha-v0.2.2" local print = util.print local println = util.println diff --git a/scada-common/ppm.lua b/scada-common/ppm.lua index fd92b23..f751342 100644 --- a/scada-common/ppm.lua +++ b/scada-common/ppm.lua @@ -174,12 +174,16 @@ end -- get a mounted peripheral by side/interface function get_periph(iface) - return self.mounts[iface].dev + if self.mounts[iface] then + return self.mounts[iface].dev + else return nil end end -- get a mounted peripheral type by side/interface function get_type(iface) - return self.mounts[iface].type + if self.mounts[iface] then + return self.mounts[iface].type + else return nil end end -- get all mounted peripherals by type