Show frequency range on status page to help with overlapping channels (#978)

This commit is contained in:
Tim Wilkinson 2023-12-06 12:06:34 -08:00 committed by GitHub
parent 927bdd1c8f
commit 161c5439c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -167,10 +167,12 @@ local cursor = uci.cursor()
local wifi_channel local wifi_channel
local wifi_chanbw local wifi_chanbw
local wifi_freq_range = ""
local wifi_ssid local wifi_ssid
if not wifi_disabled then if not wifi_disabled then
wifi_channel = cursor:get("wireless", radio, "channel") wifi_channel = cursor:get("wireless", radio, "channel")
wifi_channel = tonumber(wifi_channel) or 0 wifi_channel = tonumber(wifi_channel) or 0
wifi_chanbw = tonumber(cursor:get("wireless", radio, "chanbw") or "20")
local rfchans = aredn.hardware.get_rfchannels(wifi_iface) local rfchans = aredn.hardware.get_rfchannels(wifi_iface)
if rfchans and rfchans[1] then if rfchans and rfchans[1] then
local basefreq = rfchans[1].frequency local basefreq = rfchans[1].frequency
@ -179,8 +181,15 @@ if not wifi_disabled then
elseif basefreq > 900 and basefreq < 2300 then elseif basefreq > 900 and basefreq < 2300 then
wifi_channel = wifi_channel * 5 + 887 wifi_channel = wifi_channel * 5 + 887
end end
for _, chan in ipairs(rfchans)
do
if chan.number == wifi_channel then
wifi_freq_range = (chan.frequency - wifi_chanbw / 2) .. " - " .. (chan.frequency + wifi_chanbw / 2) .. " MHz"
break
end end
wifi_chanbw = cursor:get("wireless", radio, "chanbw") or "20" end
end
wifi_ssid = "none" wifi_ssid = "none"
cursor:foreach("wireless", "wifi-iface", cursor:foreach("wireless", "wifi-iface",
function (section) function (section)
@ -319,7 +328,7 @@ else
col1[#col1 + 1] = "<th align=right><nobr>primary address:</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" col1[#col1 + 1] = "<th align=right><nobr>primary address:</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>"
else else
wifi_gw = get_default_gw("wifi") wifi_gw = get_default_gw("wifi")
col1[#col1 + 1] = "<th align=right><nobr>mesh address:</nobr><br><nobr>mesh gateway:</nobr><br><nobr>gateway node:</nobr><br>SSID:<br>channel:<br><nobr>channel width:</nobr></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" .. wifi_gw .. "<br>" .. mesh_ip_to_hostnames(wifi_gw) .. "<br>" .. wifi_ssid .. "<br>" .. wifi_channel .. "<br>" .. wifi_chanbw .. " MHz</td>" col1[#col1 + 1] = "<th align=right><nobr>mesh address:</nobr><br><nobr>mesh gateway:</nobr><br><nobr>gateway node:</nobr><br>SSID:<br>channel:<br><nobr>channel width:</nobr><br>frequency range:</br></th><td>" .. ip .. " <small>/ " .. cidr .. "</small><br>" .. wifi_gw .. "<br>" .. mesh_ip_to_hostnames(wifi_gw) .. "<br>" .. wifi_ssid .. "<br>" .. wifi_channel .. "<br>" .. wifi_chanbw .. " MHz<br>" .. wifi_freq_range .. "</td>"
end end
end end