@@ -71,12 +71,12 @@ def _print(label, value, unit=None):
7171 _print ("CPR Longitude" , cprlon )
7272 _print ("Altitude" , alt , "feet" )
7373
74- if tc == 29 : # target state and status
74+ if tc == 29 : # target state and status
7575 _print ("Type" , "Target State and Status" )
7676 subtype = common .bin2int ((common .hex2bin (msg )[32 :])[5 :7 ])
7777 _print ("Subtype" , subtype )
7878 tcas_operational = adsb .tcas_operational (msg )
79- types = {0 : "Not Engaged" , 1 : "Engaged" }
79+ types_29 = {0 : "Not Engaged" , 1 : "Engaged" }
8080 tcas_operational_types = {0 : "Not Operational" , 1 : "Operational" }
8181 if subtype == 0 :
8282 emergency_types = {
@@ -87,11 +87,11 @@ def _print(label, value, unit=None):
8787 4 : "No communications" ,
8888 5 : "Unlawful interference" ,
8989 6 : "Downed aircraft" ,
90- 7 : "Reserved"
90+ 7 : "Reserved" ,
9191 }
9292 vertical_horizontal_types = {
9393 1 : "Acquiring mode" ,
94- 2 : "Capturing/Maintaining mode"
94+ 2 : "Capturing/Maintaining mode" ,
9595 }
9696 tcas_ra_types = {0 : "Not active" , 1 : "Active" }
9797 alt , alt_source , alt_ref = adsb .target_altitude (msg )
@@ -108,7 +108,12 @@ def _print(label, value, unit=None):
108108 _print ("Angle Source" , angle_source )
109109 _print ("Vertical mode" , vertical_horizontal_types [vertical_mode ])
110110 _print ("Horizontal mode" , vertical_horizontal_types [horizontal_mode ])
111- _print ("TCAS/ACAS" , tcas_operational_types [tcas_operational ])
111+ _print (
112+ "TCAS/ACAS" ,
113+ tcas_operational_types [tcas_operational ]
114+ if tcas_operational
115+ else None ,
116+ )
112117 _print ("TCAS/ACAS RA" , tcas_ra_types [tcas_ra ])
113118 _print ("Emergency status" , emergency_types [emergency_status ])
114119 else :
@@ -124,14 +129,20 @@ def _print(label, value, unit=None):
124129 _print ("Altitude source" , alt_source )
125130 _print ("Barometric pressure setting" , baro , "millibars" )
126131 _print ("Selected Heading" , hdg , "°" )
127- if not (common .bin2int ((common .hex2bin (msg )[32 :])[46 ]) == 0 ):
128- _print ("Autopilot" , types [autopilot ])
129- _print ("VNAV mode" , types [vnav ])
130- _print ("Altitude hold mode" , types [alt_hold ])
131- _print ("Approach mode" , types [app ])
132- _print ("TCAS/ACAS" , tcas_operational_types [tcas_operational ])
133- _print ("LNAV mode" , types [lnav ])
134-
132+ if not (common .bin2int ((common .hex2bin (msg )[32 :])[46 ]) == 0 ):
133+ _print ("Autopilot" , types_29 [autopilot ] if autopilot else None )
134+ _print ("VNAV mode" , types_29 [vnav ] if vnav else None )
135+ _print (
136+ "Altitude hold mode" , types_29 [alt_hold ] if alt_hold else None
137+ )
138+ _print ("Approach mode" , types_29 [app ] if app else None )
139+ _print (
140+ "TCAS/ACAS" ,
141+ tcas_operational_types [tcas_operational ]
142+ if tcas_operational
143+ else None ,
144+ )
145+ _print ("LNAV mode" , types_29 [lnav ] if lnav else None )
135146
136147 if df == 20 :
137148 _print ("Protocol" , "Mode-S Comm-B altitude reply" )
0 commit comments