* FARP support
This commit is contained in:
Applevangelist 2022-12-25 14:19:27 +01:00
parent c6f4c6f0fa
commit 86ea757a16

View File

@ -94,6 +94,7 @@
-- @field #boolean ReportmBar Report mBar/hpa even if not metric, i.e. for Mirage flights -- @field #boolean ReportmBar Report mBar/hpa even if not metric, i.e. for Mirage flights
-- @field #boolean TransmitOnlyWithPlayers For SRS - If true, only transmit if there are alive Players. -- @field #boolean TransmitOnlyWithPlayers For SRS - If true, only transmit if there are alive Players.
-- @field #string SRSText Text of the complete SRS message (if done at least once, else nil) -- @field #string SRSText Text of the complete SRS message (if done at least once, else nil)
-- @field #boolean ATISforFARPs Will be set to true if the base given is a FARP/Helipad
-- @extends Core.Fsm#FSM -- @extends Core.Fsm#FSM
--- *It is a very sad thing that nowadays there is so little useless information.* - Oscar Wilde --- *It is a very sad thing that nowadays there is so little useless information.* - Oscar Wilde
@ -310,6 +311,19 @@
-- --
-- This uses a male voice with US accent. It requires SRS to be installed in the `D:\DCS\_SRS\` directory. Not that backslashes need to be escaped or simply use slashes (as in linux). -- This uses a male voice with US accent. It requires SRS to be installed in the `D:\DCS\_SRS\` directory. Not that backslashes need to be escaped or simply use slashes (as in linux).
-- --
-- ## FARPS
--
-- ATIS is working with FARPS, but this requires the usage of SRS. The airbase name for the `New()-method` is the UNIT name of the FARP:
--
-- atis = ATIS:New("FARP Gold",119,radio.modulation.AM)
-- atis:SetMetricUnits()
-- atis:SetTransmitOnlyWithPlayers(true)
-- atis:SetReportmBar(true)
-- atis:SetTowerFrequencies(127.50)
-- atis:SetSRS("D:\\DCS\\_SRS\\", "male", "en-US",nil,5002)
-- atis:SetAdditionalInformation("Welcome to the Jungle!")
-- atis:__Start(3)
--
-- @field #ATIS -- @field #ATIS
ATIS = { ATIS = {
ClassName = "ATIS", ClassName = "ATIS",
@ -351,6 +365,7 @@ ATIS = {
relHumidity = nil, relHumidity = nil,
ReportmBar = false, ReportmBar = false,
TransmitOnlyWithPlayers = false, TransmitOnlyWithPlayers = false,
ATISforFARPs = false,
} }
--- NATO alphabet. --- NATO alphabet.
@ -593,7 +608,7 @@ _ATIS = {}
--- ATIS class version. --- ATIS class version.
-- @field #string version -- @field #string version
ATIS.version = "0.9.12" ATIS.version = "0.9.14"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@ -1049,7 +1064,7 @@ end
-- --
-- * 186° on the Caucaus map -- * 186° on the Caucaus map
-- * 192° on the Nevada map -- * 192° on the Nevada map
-- * 170° on the Normany map -- * 170° on the Normandy map
-- * 182° on the Persian Gulf map -- * 182° on the Persian Gulf map
-- --
-- Likewise, to convert *true* into *magnetic* heading, one has to substract easterly and add westerly variation. -- Likewise, to convert *true* into *magnetic* heading, one has to substract easterly and add westerly variation.
@ -1257,11 +1272,18 @@ end
function ATIS:onafterStart( From, Event, To ) function ATIS:onafterStart( From, Event, To )
-- Check that this is an airdrome. -- Check that this is an airdrome.
if self.airbase:GetAirbaseCategory() ~= Airbase.Category.AIRDROME then if self.airbase:GetAirbaseCategory() == Airbase.Category.SHIP then
self:E( self.lid .. string.format( "ERROR: Cannot start ATIS for airbase %s! Only AIRDROMES are supported but NOT FARPS or SHIPS.", self.airbasename ) ) self:E( self.lid .. string.format( "ERROR: Cannot start ATIS for airbase %s! Only AIRDROMES are supported but NOT SHIPS.", self.airbasename ) )
return return
end end
-- Check that if is a Helipad.
if self.airbase:GetAirbaseCategory() == Airbase.Category.HELIPAD then
self:E( self.lid .. string.format( "EXPERIMENTAL: Starting ATIS for Helipad %s! SRS must be ON", self.airbasename ) )
self.ATISforFARPs = true
self.useSRS = true
end
-- Info. -- Info.
self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation ) ) self:I( self.lid .. string.format( "Starting ATIS v%s for airbase %s on %.3f MHz Modulation=%d", ATIS.version, self.airbasename, self.frequency, self.modulation ) )
@ -1474,8 +1496,17 @@ function ATIS:onafterBroadcast( From, Event, To )
--- Runway --- --- Runway ---
-------------- --------------
local runwayLanding, rwyLandingLeft=self:GetActiveRunway()
local runwayTakeoff, rwyTakeoffLeft=self:GetActiveRunway(true) local runwayLanding, rwyLandingLeft
local runwayTakeoff, rwyTakeoffLeft
if self.airbase:GetAirbaseCategory() == Airbase.Category.HELIPAD then
runwayLanding, rwyLandingLeft="PAD 01",false
runwayTakeoff, rwyTakeoffLeft="PAD 02",false
else
runwayLanding, rwyLandingLeft=self:GetActiveRunway()
runwayTakeoff, rwyTakeoffLeft=self:GetActiveRunway(true)
end
------------ ------------
--- Time --- --- Time ---
@ -1790,7 +1821,7 @@ function ATIS:onafterBroadcast( From, Event, To )
-- Airbase name -- Airbase name
subtitle = string.format( "%s", self.airbasename ) subtitle = string.format( "%s", self.airbasename )
if self.airbasename:find( "AFB" ) == nil and self.airbasename:find( "Airport" ) == nil and self.airbasename:find( "Airstrip" ) == nil and self.airbasename:find( "airfield" ) == nil and self.airbasename:find( "AB" ) == nil then if (not self.ATISforFARPs) and self.airbasename:find( "AFB" ) == nil and self.airbasename:find( "Airport" ) == nil and self.airbasename:find( "Airstrip" ) == nil and self.airbasename:find( "airfield" ) == nil and self.airbasename:find( "AB" ) == nil then
subtitle = subtitle .. " Airport" subtitle = subtitle .. " Airport"
end end
if not self.useSRS then if not self.useSRS then
@ -1865,8 +1896,6 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
end end
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
--self:I("Line 1811")
--self:I(alltext)
-- Visibility -- Visibility
if self.metric then if self.metric then
@ -1884,8 +1913,6 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
end end
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
--self:I("Line 1830")
--self:I(alltext)
subtitle = "" subtitle = ""
-- Weather phenomena -- Weather phenomena
@ -1987,10 +2014,8 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
end end
end end
--self:I("Line 1932")
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
--self:I(alltext)
subtitle = "" subtitle = ""
-- Temperature -- Temperature
if self.TDegF then if self.TDegF then
@ -2019,9 +2044,7 @@ function ATIS:onafterBroadcast( From, Event, To )
self:Transmission( ATIS.Sound.DegreesCelsius, 0.2 ) self:Transmission( ATIS.Sound.DegreesCelsius, 0.2 )
end end
end end
--self:I("Line 1962")
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
--self:I(alltext)
-- Dew point -- Dew point
if self.TDegF then if self.TDegF then
@ -2050,8 +2073,6 @@ function ATIS:onafterBroadcast( From, Event, To )
self:Transmission( ATIS.Sound.DegreesCelsius, 0.2 ) self:Transmission( ATIS.Sound.DegreesCelsius, 0.2 )
end end
end end
--self:I("Line 1992")
--self:I(alltext)
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
-- Altimeter QNH/QFE. -- Altimeter QNH/QFE.
@ -2117,10 +2138,9 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
end end
end end
--self:I("Line 2049")
--self:I(alltext)
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
if not self.ATISforFARPs then
-- Active runway. -- Active runway.
local subtitle=string.format("Active runway %s", runwayLanding) local subtitle=string.format("Active runway %s", runwayLanding)
if rwyLandingLeft==true then if rwyLandingLeft==true then
@ -2179,7 +2199,7 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
end end
end
-- Airfield elevation -- Airfield elevation
if self.elevation then if self.elevation then
@ -2246,9 +2266,7 @@ function ATIS:onafterBroadcast( From, Event, To )
end end
-- ILS -- ILS
--self:I({ils=self.ils})
local ils=self:GetNavPoint(self.ils, runwayLanding, rwyLandingLeft) local ils=self:GetNavPoint(self.ils, runwayLanding, rwyLandingLeft)
--self:I({ils=ils,runwayLanding=runwayLanding, rwyLandingLeft=rwyLandingLeft})
if ils then if ils then
subtitle = string.format( "ILS frequency %.2f MHz", ils.frequency ) subtitle = string.format( "ILS frequency %.2f MHz", ils.frequency )
if not self.useSRS then if not self.useSRS then
@ -2263,7 +2281,6 @@ function ATIS:onafterBroadcast( From, Event, To )
self:Transmission( ATIS.Sound.MegaHertz, 0.2 ) self:Transmission( ATIS.Sound.MegaHertz, 0.2 )
end end
alltext = alltext .. ";\n" .. subtitle alltext = alltext .. ";\n" .. subtitle
--self:I(alltext)
end end
-- Outer NDB -- Outer NDB