#634 supervisor backplane logging changes

This commit is contained in:
Mikayla 2025-10-26 20:03:42 +00:00
parent f0251efec6
commit 869b342db2
2 changed files with 19 additions and 18 deletions

View File

@ -12,6 +12,8 @@ local databus = require("supervisor.databus")
local LISTEN_MODE = types.LISTEN_MODE local LISTEN_MODE = types.LISTEN_MODE
local println = util.println
---@class supervisor_backplane ---@class supervisor_backplane
local backplane = {} local backplane = {}
@ -28,9 +30,8 @@ backplane.nics = _bp.nic_map
-- initialize the system peripheral backplane -- initialize the system peripheral backplane
---@param config svr_config ---@param config svr_config
---@param println function
---@return boolean success ---@return boolean success
function backplane.init(config, println) function backplane.init(config)
-- setup the wired modem, if configured -- setup the wired modem, if configured
if type(config.WiredModem) == "string" then if type(config.WiredModem) == "string" then
_bp.lan_iface = config.WiredModem _bp.lan_iface = config.WiredModem
@ -38,7 +39,7 @@ function backplane.init(config, println)
local modem = ppm.get_modem(_bp.lan_iface) local modem = ppm.get_modem(_bp.lan_iface)
if not (modem and _bp.lan_iface) then if not (modem and _bp.lan_iface) then
println("startup> wired comms modem not found") println("startup> wired comms modem not found")
log.fatal("no wired comms modem on startup") log.fatal("BKPLN: no wired comms modem on startup")
return false return false
end end
@ -60,7 +61,7 @@ function backplane.init(config, println)
local modem, iface = ppm.get_wireless_modem() local modem, iface = ppm.get_wireless_modem()
if not (modem and iface) then if not (modem and iface) then
println("startup> wireless comms modem not found") println("startup> wireless comms modem not found")
log.fatal("no wireless comms modem on startup") log.fatal("BKPLN: no wireless comms modem on startup")
return false return false
end end
@ -80,7 +81,7 @@ function backplane.init(config, println)
if not ((type(config.WiredModem) == "string" or config.WirelessModem)) then if not ((type(config.WiredModem) == "string" or config.WirelessModem)) then
println("startup> no modems configured") println("startup> no modems configured")
log.fatal("no modems configured") log.fatal("BKPLN: no modems configured")
return false return false
end end
@ -91,8 +92,8 @@ end
---@param iface string ---@param iface string
---@param type string ---@param type string
---@param device table ---@param device table
---@param println function ---@param print_no_fp function
function backplane.attach(iface, type, device, println) function backplane.attach(iface, type, device, print_no_fp)
if type == "modem" then if type == "modem" then
---@cast device Modem ---@cast device Modem
@ -108,7 +109,7 @@ function backplane.attach(iface, type, device, println)
_bp.wd_nic.connect(device) _bp.wd_nic.connect(device)
log.info("BKPLN: WIRED PHY_UP " .. iface) log.info("BKPLN: WIRED PHY_UP " .. iface)
println("wired comms modem reconnected") print_no_fp("wired comms modem reconnected")
databus.tx_hw_wd_modem(true) databus.tx_hw_wd_modem(true)
elseif is_wl then elseif is_wl then
@ -117,15 +118,15 @@ function backplane.attach(iface, type, device, println)
_bp.nic_map[iface] = _bp.wl_nic _bp.nic_map[iface] = _bp.wl_nic
log.info("BKPLN: WIRELESS PHY_UP " .. iface) log.info("BKPLN: WIRELESS PHY_UP " .. iface)
println("wireless comms modem reconnected") print_no_fp("wireless comms modem reconnected")
databus.tx_hw_wl_modem(true) databus.tx_hw_wl_modem(true)
elseif _bp.wl_nic and m_is_wl then elseif _bp.wl_nic and m_is_wl then
-- the wireless NIC already has a modem -- the wireless NIC already has a modem
println("standby wireless modem connected") print_no_fp("standby wireless modem connected")
log.info("BKPLN: standby wireless modem connected") log.info("BKPLN: standby wireless modem connected")
else else
println("unassigned modem connected") print_no_fp("unassigned modem connected")
log.warning("BKPLN: unassigned modem connected") log.warning("BKPLN: unassigned modem connected")
end end
end end
@ -135,8 +136,8 @@ end
---@param iface string ---@param iface string
---@param type string ---@param type string
---@param device table ---@param device table
---@param println function ---@param print_no_fp function
function backplane.detach(iface, type, device, println) function backplane.detach(iface, type, device, print_no_fp)
if type == "modem" then if type == "modem" then
---@cast device Modem ---@cast device Modem
@ -152,7 +153,7 @@ function backplane.detach(iface, type, device, println)
_bp.wd_nic.disconnect() _bp.wd_nic.disconnect()
log.info("BKPLN: WIRED PHY_DOWN " .. iface) log.info("BKPLN: WIRED PHY_DOWN " .. iface)
println("wired modem disconnected") print_no_fp("wired modem disconnected")
log.warning("BKPLN: wired comms modem disconnected") log.warning("BKPLN: wired comms modem disconnected")
databus.tx_hw_wd_modem(false) databus.tx_hw_wd_modem(false)
@ -160,7 +161,7 @@ function backplane.detach(iface, type, device, println)
_bp.wl_nic.disconnect() _bp.wl_nic.disconnect()
log.info("BKPLN: WIRELESS PHY_DOWN " .. iface) log.info("BKPLN: WIRELESS PHY_DOWN " .. iface)
println("wireless comms modem disconnected") print_no_fp("wireless comms modem disconnected")
log.warning("BKPLN: wireless comms modem disconnected") log.warning("BKPLN: wireless comms modem disconnected")
local modem, m_iface = ppm.get_wireless_modem() local modem, m_iface = ppm.get_wireless_modem()
@ -174,10 +175,10 @@ function backplane.detach(iface, type, device, println)
end end
elseif _bp.wl_nic and m_is_wl then elseif _bp.wl_nic and m_is_wl then
-- wireless, but not active -- wireless, but not active
println("standby wireless modem disconnected") print_no_fp("standby wireless modem disconnected")
log.info("BKPLN: standby wireless modem disconnected") log.info("BKPLN: standby wireless modem disconnected")
else else
println("unassigned modem disconnected") print_no_fp("unassigned modem disconnected")
log.warning("BKPLN: unassigned modem disconnected") log.warning("BKPLN: unassigned modem disconnected")
end end
end end

View File

@ -127,7 +127,7 @@ local function main()
end end
-- hardware backplane initialization -- hardware backplane initialization
if not backplane.init(config, println) then return end if not backplane.init(config) then return end
-- start UI -- start UI
local fp_ok, message = renderer.try_start_ui(config) local fp_ok, message = renderer.try_start_ui(config)