Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Applevangelist 2024-01-11 17:14:43 +01:00
commit baf7123364
2 changed files with 26 additions and 10 deletions

View File

@ -1744,7 +1744,7 @@ end
function CTLD:_GenerateUHFrequencies()
self:T(self.lid .. " _GenerateUHFrequencies")
self.FreeUHFFrequencies = {}
self.FreeUHFFrequencies = UTILS.GenerateUHFrequencies()
self.FreeUHFFrequencies = UTILS.GenerateUHFrequencies(243,320)
return self
end

View File

@ -2271,20 +2271,36 @@ function UTILS.GenerateVHFrequencies()
return FreeVHFFrequencies
end
--- Function to generate valid UHF Frequencies in mHz (AM).
--- Function to generate valid UHF Frequencies in mHz (AM). Can be between 220 and 399 mHz. 243 is auto-excluded.
-- @param Start (Optional) Avoid frequencies between Start and End in mHz, e.g. 244
-- @param End (Optional) Avoid frequencies between Start and End in mHz, e.g. 320
-- @return #table UHF Frequencies
function UTILS.GenerateUHFrequencies()
function UTILS.GenerateUHFrequencies(Start,End)
local FreeUHFFrequencies = {}
local _start = 220000000
while _start < 399000000 do
if _start ~= 243000000 then
table.insert(FreeUHFFrequencies, _start)
end
_start = _start + 500000
if not Start then
while _start < 399000000 do
if _start ~= 243000000 then
table.insert(FreeUHFFrequencies, _start)
end
_start = _start + 500000
end
else
local End = End*1000000 or 399000000
local Start = Start*1000000 or 220000000
while _start < 399000000 do
if _start ~= 243000000 and _start < Start and _start > End then
table.insert(FreeUHFFrequencies, _start)
end
_start = _start + 500000
end
end
return FreeUHFFrequencies
end