luci-app-dawn: return 0 in case of weird frequency

Sometimes 0 is passed to the frequency. Return 0 in that case.

Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Nick Hainke 2022-09-27 09:30:15 +02:00
parent 27060f34e9
commit 88bb5f31c4

View file

@ -1,7 +1,9 @@
module("luci.tools.ieee80211", package.seeall)
function frequency_to_channel(freq)
if (freq == 2484) then
if (freq <= 2400) then
return 0;
elseif (freq == 2484) then
return 14;
elseif (freq < 2484) then
return (freq - 2407) / 5;