Small bufixes to BEACON

This commit is contained in:
Grey-Echo
2017-04-20 12:10:36 +02:00
parent 510ff2f32f
commit 94ad317e61

View File

@@ -493,6 +493,7 @@ end
-- @param #number BeaconDuration How long will the beacon last in seconds. Omit for forever. -- @param #number BeaconDuration How long will the beacon last in seconds. Omit for forever.
-- @return #BEACON self -- @return #BEACON self
function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration) function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDuration)
self:F({FileName, Frequency, Modulation, Power, BeaconDuration})
local IsValid = false local IsValid = false
-- Check the filename -- Check the filename
@@ -502,7 +503,6 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
FileName = "l10n/DEFAULT/" .. FileName FileName = "l10n/DEFAULT/" .. FileName
end end
IsValid = true IsValid = true
return self
end end
end end
if not IsValid then if not IsValid then
@@ -514,6 +514,7 @@ function BEACON:RadioBeacon(FileName, Frequency, Modulation, Power, BeaconDurati
self:E({"Frequency invalid. ", Frequency}) self:E({"Frequency invalid. ", Frequency})
IsValid = false IsValid = false
end end
Frequency = Frequency * 1000000 -- Conversion to Hz
-- Check the modulation -- Check the modulation
if Modulation ~= radio.modulation.AM and Modulation ~= radio.modulation.FM and IsValid then --TODO Maybe make this future proof if ED decides to add an other modulation ? if Modulation ~= radio.modulation.AM and Modulation ~= radio.modulation.FM and IsValid then --TODO Maybe make this future proof if ED decides to add an other modulation ?
@@ -546,6 +547,7 @@ end
-- @param #BEACON self -- @param #BEACON self
-- @return #BEACON self -- @return #BEACON self
function BEACON:StopRadioBeacon() function BEACON:StopRadioBeacon()
self:F()
-- The unique name of the transmission is the class ID -- The unique name of the transmission is the class ID
trigger.action.stopRadioTransmission(tostring(self.ID)) trigger.action.stopRadioTransmission(tostring(self.ID))
end end