mirror of https://github.com/aredn/aredn.git
Fix various status information errors (#1195)
* Fix various status information errors * Fix whitespace
This commit is contained in:
parent
8bb01e0501
commit
2454accbb5
|
@ -290,6 +290,7 @@ end
|
|||
-- Return Frequency
|
||||
-------------------------------------
|
||||
function model.getFreq(radio)
|
||||
require("aredn.hardware")
|
||||
local api=iwinfo.type(radio)
|
||||
local iw = iwinfo[api]
|
||||
local freq = iw.frequency(radio)
|
||||
|
@ -298,6 +299,11 @@ function model.getFreq(radio)
|
|||
if (chan >= 76 and chan <= 99) then
|
||||
freq = freq - 2000
|
||||
end
|
||||
-- 900MHz channel -> Freq conversion
|
||||
local radio = aredn.hardware.get_radio()
|
||||
if radio and radio.name:match("M9") then
|
||||
freq = freq - 1520
|
||||
end
|
||||
return tostring(freq)
|
||||
end
|
||||
|
||||
|
|
|
@ -1003,7 +1003,8 @@ function lqm()
|
|||
|
||||
-- Save valid (unblocked) rf mac list for use by OLSR
|
||||
if config.enable and phy ~= "none" then
|
||||
f = io.open("/tmp/lqm." .. phy .. ".macs", "w")
|
||||
local tmpfile = "/tmp/lqm." .. phy .. ".macs.tmp"
|
||||
f = io.open(tmpfile, "w")
|
||||
if f then
|
||||
for _, track in pairs(tracker)
|
||||
do
|
||||
|
@ -1012,6 +1013,8 @@ function lqm()
|
|||
end
|
||||
end
|
||||
f:close()
|
||||
filecopy(tmpfile, "/tmp/lqm." .. phy .. ".macs", true)
|
||||
os.remove(tmpfile)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ local cursor = uci.cursor()
|
|||
|
||||
local wifi_channel
|
||||
local wifi_chanbw
|
||||
local wifi_freq_range = ""
|
||||
local wifi_freq_range = "-"
|
||||
local wifi_ssid
|
||||
if not wifi_disabled then
|
||||
wifi_channel = cursor:get("wireless", radio, "channel")
|
||||
|
@ -174,6 +174,7 @@ if not wifi_disabled then
|
|||
wifi_chanbw = tonumber(cursor:get("wireless", radio, "chanbw") or "20")
|
||||
local rfchans = aredn.hardware.get_rfchannels(wifi_iface)
|
||||
if rfchans and rfchans[1] then
|
||||
local num = wifi_channel
|
||||
local basefreq = rfchans[1].frequency
|
||||
if basefreq > 3000 and basefreq < 5000 then
|
||||
wifi_channel = wifi_channel * 5 + 3000
|
||||
|
@ -182,8 +183,8 @@ if not wifi_disabled then
|
|||
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"
|
||||
if chan.number == num then
|
||||
wifi_freq_range = math.floor(chan.frequency - wifi_chanbw / 2) .. " - " .. math.ceil(chan.frequency + wifi_chanbw / 2) .. " MHz"
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
|
@ -112,9 +112,9 @@ end
|
|||
-- Tunnel info
|
||||
info['tunnels']={}
|
||||
-- ACTIVE TUNNELS
|
||||
local atc=""
|
||||
atc=os.capture("ifconfig|grep tun|wc -l")
|
||||
info['tunnels']['active_tunnel_count']=atc:chomp()
|
||||
local atc=os.capture("ifconfig|grep tun|wc -l"):chomp()
|
||||
local awc=os.capture("wg|grep interface|wc -l"):chomp()
|
||||
info['tunnels']['active_tunnel_count']=tonumber(atc) + tonumber(awc)
|
||||
|
||||
-- Location info
|
||||
-- LAT/LON
|
||||
|
|
Loading…
Reference in New Issue