Moved the band array out of the function prototype so it's not created each time

merge-requests/237/merge
Tag 2023-01-22 15:33:50 -08:00
rodzic 902efb82ea
commit a36f22bd92
1 zmienionych plików z 75 dodań i 77 usunięć

Wyświetl plik

@ -1,14 +1,9 @@
// GridTracker Copyright © 2023 GridTracker.org
// All rights reserved.
// See LICENSE for more information.
// Incoming is already float fixed ( 14.037 ) for 14,037,000hz
Number.prototype.formatBand = function ()
{
var freq = this;
var bands = [
var g_proto_bands = [
"OOB",
"OOB",
"0",
1,
"160m",
3,
@ -77,10 +72,13 @@ Number.prototype.formatBand = function ()
"1.25m",
225,
"1.25m"
];
var newFreq = parseInt(freq);
if (newFreq > 0 && newFreq < 226) return bands[bands.indexOf(newFreq) + 1];
];
// Incoming is already float fixed ( 14.037 ) for 14,037,000hz
Number.prototype.formatBand = function ()
{
let freq = this;
let newFreq = parseInt(freq);
if (newFreq > 0 && newFreq < 226) return g_proto_bands[g_proto_bands.indexOf(newFreq) + 1];
else if (newFreq >= 420 && newFreq <= 450) return "70cm";
else if (newFreq >= 902 && newFreq <= 928) return "33cm";
else if (newFreq >= 1240 && newFreq <= 1300) return "23cm";