#248 fixed network light not going out on PLC/RTU when disconnected

This commit is contained in:
Mikayla Fischler 2023-06-05 17:47:43 -04:00
parent 360609df1f
commit 63147bfab5
7 changed files with 17 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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