mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Change RADIO:NewGenericTransmission() and RADIO:NewUnitTransmission() to support optionnal parameters
This commit is contained in:
parent
65c61a15b4
commit
3754ea6c27
@ -69,17 +69,18 @@ end
|
|||||||
-- -- In this function the data is especially relevant if the broadcaster is anything but a UNIT or a GROUP,
|
-- -- In this function the data is especially relevant if the broadcaster is anything but a UNIT or a GROUP,
|
||||||
-- -- but it will work with a UNIT or a GROUP anyway
|
-- -- but it will work with a UNIT or a GROUP anyway
|
||||||
-- -- Only the RADIO and the Filename are mandatory
|
-- -- Only the RADIO and the Filename are mandatory
|
||||||
function RADIO:NewGenericTransmission(filename, frequency, mod, power)
|
-- @TODO : Verify the type of passed args and throw errors when necessary
|
||||||
self:F2({self, filename, frequency, mod, power})
|
function RADIO:NewGenericTransmission(...)
|
||||||
self.FileName = RADIO:VerifyFileName(filename)
|
self:F2(arg)
|
||||||
if frequency ~= "" then
|
self.FileName = RADIO:VerifyFileName(arg[1])
|
||||||
self.Frequecy = frequency * 1000 -- Convert to Hz
|
if arg[2] ~= nil then
|
||||||
|
self.Frequecy = arg[2] * 1000 -- Convert to Hz
|
||||||
end
|
end
|
||||||
if mod ~= 3 then
|
if arg[3] ~= nil then
|
||||||
self.Modulation = mod
|
self.Modulation = arg[3]
|
||||||
end
|
end
|
||||||
if power ~= 0 then
|
if arg[4] ~= nil then
|
||||||
self.Power = power
|
self.Power = arg[4]
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -98,23 +99,24 @@ end
|
|||||||
-- -- but it will work for any POSITIONABLE
|
-- -- but it will work for any POSITIONABLE
|
||||||
-- -- Only the RADIO and the Filename are mandatory
|
-- -- Only the RADIO and the Filename are mandatory
|
||||||
-- -- Loop : O is no loop, 1 is loop
|
-- -- Loop : O is no loop, 1 is loop
|
||||||
function RADIO:NewUnitTransmission(filename, subtitle, subtitleDuration, frequency, mod, loop)
|
-- -- @TODO : Verify the type of passed args and throw errors when necessary
|
||||||
self:F2({filename, subtitle, subtitleDuration, frequency, mod, loop})
|
function RADIO:NewUnitTransmission(...)
|
||||||
self.FileName = RADIO:VerifyFileName(filename)
|
self:F2(arg)
|
||||||
if subtitle ~= "" then
|
self.FileName = RADIO:VerifyFileName(arg[1])
|
||||||
self.Subtitle = subtitle
|
if arg[2] ~= nil then
|
||||||
|
self.Subtitle = arg[2]
|
||||||
end
|
end
|
||||||
if subtitleDuration ~= 0 then
|
if arg[3] ~= nil then
|
||||||
self.SubtitleDuration = subtitleDuration
|
self.SubtitleDuration = arg[3]
|
||||||
end
|
end
|
||||||
if frequency ~= 0 then
|
if arg[4] ~= nil then
|
||||||
self.Frequency = frequency * 1000 -- Convert to Hz
|
self.Frequency = arg[4] * 1000 -- Convert to Hz
|
||||||
end
|
end
|
||||||
if mod ~= 3 then
|
if arg[5] ~= nil then
|
||||||
self.Modulation = mod
|
self.Modulation = arg[5]
|
||||||
end
|
end
|
||||||
if loop ~= 3 then
|
if arg[6] ~= nil then
|
||||||
self.Loop = loop
|
self.Loop = arg[6]
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user