Merge pull request #112 from maranov/bugfix/airborne_velocity_trk

Fix UnboundLocalError in airborne_velocity when velocity is zero
This commit is contained in:
Junzi Sun 2021-07-07 22:47:51 +02:00 committed by GitHub
commit a350050e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,8 +65,9 @@ def airborne_velocity(msg, source=False):
trk = math.degrees(trk) # convert to degrees trk = math.degrees(trk) # convert to degrees
trk = trk if trk >= 0 else trk + 360 # no negative val trk = trk if trk >= 0 else trk + 360 # no negative val
trk_or_hdg = round(trk, 2)
spd_type = "GS" spd_type = "GS"
trk_or_hdg = round(trk, 2)
dir_type = "TRUE_NORTH" dir_type = "TRUE_NORTH"
else: else: