#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

@@ -10,6 +10,16 @@ local pgi = require("supervisor.panel.pgi")
local databus = {} 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 PSIL
databus.ps = psil.create() databus.ps = psil.create()
@@ -28,12 +38,18 @@ end
---@param has_modem boolean ---@param has_modem boolean
function databus.tx_hw_wd_modem(has_modem) function databus.tx_hw_wd_modem(has_modem)
databus.ps.publish("has_wd_modem", has_modem) databus.ps.publish("has_wd_modem", has_modem)
_dbus.wd_modem = has_modem
eval_status()
end end
-- transmit hardware status for the wireless comms modem -- transmit hardware status for the wireless comms modem
---@param has_modem boolean ---@param has_modem boolean
function databus.tx_hw_wl_modem(has_modem) function databus.tx_hw_wl_modem(has_modem)
databus.ps.publish("has_wl_modem", has_modem) databus.ps.publish("has_wl_modem", has_modem)
_dbus.wl_modem = has_modem
eval_status()
end end
-- transmit PLC firmware version and session connection state -- 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 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} local heartbeat = LED{parent=system,label="HEARTBEAT",colors=ind_grn}
on.update(true)
system.line_break() system.line_break()
status.register(databus.ps, "status", status.update)
heartbeat.register(databus.ps, "heartbeat", heartbeat.update) heartbeat.register(databus.ps, "heartbeat", heartbeat.update)
if config.WirelessModem and config.WiredModem then 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 svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.8.0" local SUPERVISOR_VERSION = "v1.8.1"
local println = util.println local println = util.println
local println_ts = util.println_ts local println_ts = util.println_ts