luci-mod-network: use "band" from iwinfo freqlist 6104/head
authorAndre Heider <a.heider@gmail.com>
Wed, 23 Nov 2022 12:29:22 +0000 (13:29 +0100)
committerAndre Heider <a.heider@gmail.com>
Mon, 23 Jan 2023 13:51:28 +0000 (14:51 +0100)
Instead of mapping it by frequency.

Signed-off-by: Andre Heider <a.heider@gmail.com>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index 3c6f51afeb2afce0a1695c416cebaf0de99cdbad..a2b0c84ce211c50183a3790e1193790e14e395ee 100644 (file)
@@ -319,19 +319,11 @@ var CBIWifiFrequencyValue = form.Value.extend({
                        };
 
                        for (var i = 0; i < data[1].length; i++) {
-                               var band;
-
-                               if (data[1][i].mhz >= 2412 && data[1][i].mhz <= 2484)
-                                       band = '2g';
-                               else if (data[1][i].mhz >= 5160 && data[1][i].mhz <= 5885)
-                                       band = '5g';
-                               else if (data[1][i].mhz >= 5925 && data[1][i].mhz <= 7125)
-                                       band = '6g';
-                               else if (data[1][i].mhz >= 58320 && data[1][i].mhz <= 69120)
-                                       band = '60g';
-                               else
+                               if (!data[1][i].band)
                                        continue;
 
+                               var band = '%dg'.format(data[1][i].band);
+
                                this.channels[band].push(
                                        data[1][i].channel,
                                        '%d (%d Mhz)'.format(data[1][i].channel, data[1][i].mhz),