From bee1cdf01ce1a92aa396862e7e4a9d686c1d9986 Mon Sep 17 00:00:00 2001 From: Mikayla Date: Sat, 24 May 2025 20:03:17 +0000 Subject: [PATCH] return wireless modem interface name --- scada-common/ppm.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scada-common/ppm.lua b/scada-common/ppm.lua index 894e643..a0a1247 100644 --- a/scada-common/ppm.lua +++ b/scada-common/ppm.lua @@ -463,19 +463,20 @@ end -- get the wireless modem (if multiple, returns the first)
-- if this is in a CraftOS emulated environment, wired modems will be used instead ---@nodiscard ----@return Modem|nil modem function table +---@return Modem|nil modem, string|nil iface function ppm.get_wireless_modem() - local w_modem = nil + local w_modem, w_iface = nil, nil local emulated_env = periphemu ~= nil - for _, device in pairs(ppm_sys.mounts) do + for iface, device in pairs(ppm_sys.mounts) do if device.type == "modem" and (emulated_env or device.dev.isWireless()) then + w_iface = iface w_modem = device.dev break end end - return w_modem + return w_modem, w_iface end -- list all connected monitors