#647 supervisor status light functionality

This commit is contained in:
Mikayla Fischler
2025-11-15 23:05:36 -05:00
parent 965fa0c7d1
commit 7f951a985b
3 changed files with 20 additions and 4 deletions

View File

@@ -6,10 +6,20 @@ local const = require("scada-common.constants")
local psil = require("scada-common.psil")
local util = require("scada-common.util")
local pgi = require("supervisor.panel.pgi")
local pgi = require("supervisor.panel.pgi")
local databus = {}
local _dbus = {
wd_modem = true,
wl_modem = true
}
-- evaluate and publish system health status
local function eval_status()
databus.ps.publish("status", _dbus.wd_modem and _dbus.wl_modem)
end
-- databus PSIL
databus.ps = psil.create()
@@ -28,12 +38,18 @@ end
---@param has_modem boolean
function databus.tx_hw_wd_modem(has_modem)
databus.ps.publish("has_wd_modem", has_modem)
_dbus.wd_modem = has_modem
eval_status()
end
-- transmit hardware status for the wireless comms modem
---@param has_modem boolean
function databus.tx_hw_wl_modem(has_modem)
databus.ps.publish("has_wl_modem", has_modem)
_dbus.wl_modem = has_modem
eval_status()
end
-- transmit PLC firmware version and session connection state

View File

@@ -58,11 +58,11 @@ local function init(panel, config)
local system = Div{parent=main_page,width=18,height=17,x=2,y=2}
local on = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
local status = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
on.update(true)
system.line_break()
status.register(databus.ps, "status", status.update)
heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
if config.WirelessModem and config.WiredModem then

View File

@@ -24,7 +24,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.8.0"
local SUPERVISOR_VERSION = "v1.8.1"
local println = util.println
local println_ts = util.println_ts