diff --git a/reactor-plc/panel/front_panel.lua b/reactor-plc/panel/front_panel.lua index 8e28a75..a8675a0 100644 --- a/reactor-plc/panel/front_panel.lua +++ b/reactor-plc/panel/front_panel.lua @@ -2,6 +2,7 @@ -- Main SCADA Coordinator GUI -- +local types = require("scada-common.types") local util = require("scada-common.util") local config = require("reactor-plc.config") @@ -49,7 +50,7 @@ local function init(panel) local reactor = LEDPair{parent=system,label="REACTOR",off=colors.red,c1=colors.yellow,c2=colors.green} local modem = LED{parent=system,label="MODEM",colors=cpair(colors.green,colors.green_off)} local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,colors.gray}} - network.update(5) + network.update(types.PANEL_LINK_STATE.DISCONNECTED) system.line_break() reactor.register(databus.ps, "reactor_dev_state", reactor.update) diff --git a/reactor-plc/plc.lua b/reactor-plc/plc.lua index a4f66dc..0d13091 100644 --- a/reactor-plc/plc.lua +++ b/reactor-plc/plc.lua @@ -672,6 +672,7 @@ function plc.comms(id, version, modem, plc_channel, svr_channel, range, reactor, self.linked = false self.r_seq_num = nil self.status_cache = nil + databus.tx_link_state(types.PANEL_LINK_STATE.DISCONNECTED) end -- close the connection to the server diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 682e618..b5a2e3b 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc") local renderer = require("reactor-plc.renderer") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "v1.4.0" +local R_PLC_VERSION = "v1.4.1" local println = util.println local println_ts = util.println_ts diff --git a/rtu/panel/front_panel.lua b/rtu/panel/front_panel.lua index 606abbb..09270e9 100644 --- a/rtu/panel/front_panel.lua +++ b/rtu/panel/front_panel.lua @@ -2,6 +2,7 @@ -- Main SCADA Coordinator GUI -- +local types = require("scada-common.types") local util = require("scada-common.util") local databus = require("rtu.databus") @@ -53,7 +54,7 @@ local function init(panel, units) local modem = LED{parent=system,label="MODEM",colors=cpair(colors.green,colors.green_off)} local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,colors.gray}} - network.update(5) + network.update(types.PANEL_LINK_STATE.DISCONNECTED) system.line_break() modem.register(databus.ps, "has_modem", modem.update) diff --git a/rtu/rtu.lua b/rtu/rtu.lua index c89dabb..5d2e2c8 100644 --- a/rtu/rtu.lua +++ b/rtu/rtu.lua @@ -257,6 +257,7 @@ function rtu.comms(version, modem, rtu_channel, svr_channel, range, conn_watchdo rtu_state.linked = false self.sv_addr = comms.BROADCAST self.r_seq_num = nil + databus.tx_link_state(types.PANEL_LINK_STATE.DISCONNECTED) end -- close the connection to the server diff --git a/rtu/startup.lua b/rtu/startup.lua index 020c2aa..d37be78 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -28,7 +28,7 @@ local sna_rtu = require("rtu.dev.sna_rtu") local sps_rtu = require("rtu.dev.sps_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "v1.2.8" +local RTU_VERSION = "v1.3.1" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE diff --git a/scada-common/types.lua b/scada-common/types.lua index 8df01c1..21429b5 100644 --- a/scada-common/types.lua +++ b/scada-common/types.lua @@ -74,6 +74,15 @@ function types.new_zero_coordinate() return { x = 0, y = 0, z = 0 } end -- ENUMERATION TYPES -- --#region +---@enum PANEL_LINK_STATE +types.PANEL_LINK_STATE = { + LINKED = 1, + DENIED = 2, + COLLISION = 3, + BAD_VERSION = 4, + DISCONNECTED = 5 +} + ---@enum RTU_UNIT_TYPE types.RTU_UNIT_TYPE = { VIRTUAL = 0, -- virtual device