#580 review changes/fixes

This commit is contained in:
Mikayla Fischler
2025-11-08 15:20:28 -05:00
parent 699ba9f71e
commit 504dce64c2
8 changed files with 71 additions and 83 deletions

View File

@@ -158,16 +158,18 @@ function backplane.init(config, __shared_memory)
-- Modem Init
-- init wired NIC
if type(config.WiredModem) == "string" then
if type(_bp.lan_iface) == "string" then
local modem = ppm.get_modem(_bp.lan_iface)
local wd_nic = network.nic(modem)
log.info("BKPLN: WIRED PHY_" .. util.trinary(modem, "UP ", "DOWN ") .. _bp.lan_iface)
log_comms("wired comms modem " .. util.trinary(modem, "connected", "not found"))
-- set this as active for now
_bp.act_nic = wd_nic
_bp.wd_nic = wd_nic
_bp.act_nic = wd_nic -- set this as active for now
wd_nic.closeAll()
wd_nic.open(config.CRD_Channel)
iocontrol.fp_has_wd_modem(modem ~= nil)
end
@@ -339,11 +341,13 @@ function backplane.attach(type, device, iface)
end
elseif type == "speaker" then
---@cast device Speaker
log_sys("alarm sounder speaker reconnected")
log.info("BKPLN: SPEAKER LINK_UP " .. iface)
sounder.reconnect(device)
log_sys("alarm sounder speaker reconnected")
iocontrol.fp_has_speaker(true)
end
end
@@ -465,10 +469,11 @@ function backplane.detach(type, device, iface)
end
elseif type == "speaker" then
---@cast device Speaker
log_sys("lost alarm sounder speaker")
log.info("BKPLN: SPEAKER LINK_DOWN " .. iface)
log_sys("alarm sounder speaker disconnected")
iocontrol.fp_has_speaker(false)
end
end

View File

@@ -184,10 +184,6 @@ function coordinator.comms(version, nic, wl_nic, sv_watchdog)
comms.set_trusted_range(config.TrustedRange)
end
-- configure network channels
nic.closeAll()
nic.open(config.CRD_Channel)
-- pass config to apisessions
if config.API_Enabled and wl_nic then
apisessions.init(wl_nic, config)
@@ -254,15 +250,7 @@ function coordinator.comms(version, nic, wl_nic, sv_watchdog)
-- switch the current active NIC
---@param act_nic nic
function public.switch_nic(act_nic)
nic.closeAll()
-- configure receive channels
act_nic.closeAll()
act_nic.open(config.CRD_Channel)
nic = act_nic
end
function public.switch_nic(act_nic) nic = act_nic end
-- try to connect to the supervisor if not already linked
---@param abort boolean? true to print out cancel info if not linked (use on program terminate)

View File

@@ -71,7 +71,6 @@ local function init(panel, config)
wl_modem.register(ps, "has_wl_modem", wl_modem.update)
else
local modem = LED{parent=system,label="MODEM",colors=led_grn}
modem.register(ps, "has_modem", modem.update)
modem.register(ps, util.trinary(config.WirelessModem, "has_wl_modem", "has_wd_modem"), modem.update)
end