From ba7950ab7a690f910193d58d33411398d191fbd0 Mon Sep 17 00:00:00 2001 From: Uriei Date: Wed, 25 Apr 2018 17:11:08 +0200 Subject: [PATCH] Added autoclose if using config file and you are at your destination --- EDPlanetBearing.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/EDPlanetBearing.py b/EDPlanetBearing.py index dedd7f3..258a280 100644 --- a/EDPlanetBearing.py +++ b/EDPlanetBearing.py @@ -348,6 +348,7 @@ def GetConfigFromFile(Startup=False): #Gets config from config file if exists an global EDPBConfigFile global AudioMode global InfoHudLevel + global UsingConfigFile if os.path.exists(EDPBConfigFile): try: with open(EDPBConfigFile) as f: @@ -375,6 +376,7 @@ def GetConfigFromFile(Startup=False): #Gets config from config file if exists an try: AudioFeedBack.PingCycleMode(int(Configs["audio"])) + UsingConfigFile = True except: pass if DstLat == -0: @@ -406,6 +408,7 @@ def Calculate(event="None"): LeftArrow = "" RightArrow = "" global InfoHudLevel + global UsingConfigFile global PingPosX global PingPosZ global PingPitch @@ -572,10 +575,10 @@ def Calculate(event="None"): Distance = format(Distance, ",d") DestDistance.set(str(Distance)+" "+DisScale) - if Distance_meters < 2000 and FlagSRV != 0: - AudioFeedBack.PingCycleMode(0) - elif Distance_meters < 250 and FlagSRV == 0: + if (Distance_meters + CurrentAlt < 2000 and FlagSRV != 0) or (Distance_meters < 250 and FlagSRV == 0): AudioFeedBack.PingCycleMode(0) + if UsingConfigFile: + callback() #Angle of descent DescentAngle = - int(round(math.degrees(math.atan(CurrentAlt/Distance_meters)),0)) @@ -618,6 +621,7 @@ def Calculate(event="None"): #Declaring variables +UsingConfigFile = False DebugMode = False SessionID = 0 CurrentLat = 0.0