mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Remove RADIO.ConvertFrequency()
The implementataion didn't allow for WW2 style frequencies. I might try to redo it later, but for now, the user is expected to input frequency in kHz
This commit is contained in:
parent
921743bf20
commit
2437e45eec
@ -56,26 +56,9 @@ function RADIO.VerifyFileName(filename)
|
||||
return filename
|
||||
end
|
||||
|
||||
--- Whatever the Frequency's unit is, returns the frequency in Hz.
|
||||
-- @param #number Frequency
|
||||
-- @return #string Frequency in Hz
|
||||
-- @usage
|
||||
-- -- internal use only
|
||||
-- -- Frequency has to be an integer.
|
||||
function RADIO.ConvertFrequency(frequency)
|
||||
local digitCount = 0
|
||||
for i in string.gmatch(frequency, "%d") do
|
||||
digitCount = digitCount + 1
|
||||
end
|
||||
for i = (9 - digitCount), 0, -1 do
|
||||
frequency = frequency .. "0"
|
||||
end
|
||||
return frequency
|
||||
end
|
||||
|
||||
--- Create a new transmission, that is to say, populate the RADIO with relevant data
|
||||
-- @param #string Filename
|
||||
-- @param #number Frequency
|
||||
-- @param #number Frequency in kHz
|
||||
-- @param #number Modulation
|
||||
-- @param #number Power
|
||||
-- @return self
|
||||
@ -84,7 +67,7 @@ end
|
||||
-- -- but it will work with a UNIT or a GROUP anyway
|
||||
function RADIO:NewTransmission(filename, frequency, mod, power)
|
||||
self.FileName = RADIO.VerifyFile(filename)
|
||||
self.Frequecy = RADIO.ConvertFrequency(frequency)
|
||||
self.Frequecy = frequency * 1000 -- Convert to Hz
|
||||
self.Modulation = mod
|
||||
self.Power = power
|
||||
end
|
||||
@ -92,4 +75,3 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user