op-packages/luci-app-cpe/root/usr/bin/rsrp2rssi
github-actions[bot] 32600acc60 🌴 Sync 2026-03-05 23:51:42
2026-03-05 23:51:42 +08:00

22 lines
356 B
Lua
Executable File

#!/usr/bin/lua
rsrp = tonumber(arg[1])
bw = tonumber(arg[2])
if bw == 1.4 then
n = 6
else
n = bw * 5
end
if tonumber(string.match(_VERSION, "%d+%.%d")) > 5.1 then
rssi = rsrp + (10 * math.log(n * 12, 10))
else
rssi = rsrp + (10 * math.log10(n * 12))
end
if rssi < -113 then
rssi = -113
elseif rssi > -51 then
rssi = -51
end
print(math.floor(rssi))