luci-app-dawn: return 0 in case of weird frequency 5992/head
authorNick Hainke <vincent@systemli.org>
Tue, 27 Sep 2022 07:30:15 +0000 (09:30 +0200)
committerNick Hainke <vincent@systemli.org>
Tue, 27 Sep 2022 07:30:15 +0000 (09:30 +0200)
Sometimes 0 is passed to the frequency. Return 0 in that case.

Signed-off-by: Nick Hainke <vincent@systemli.org>
applications/luci-app-dawn/luasrc/tools/ieee80211.lua

index b35991ed7d08f0bdb5704b4d1d9c6b4dbb83696d..44b04644274381e345aa1448068a2813dad0d165 100644 (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;