add callsign to modeslive

This commit is contained in:
Junzi Sun 2018-07-04 21:31:09 +02:00
parent 6f139d4ae9
commit 0085d03d4a
2 changed files with 9 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import time
from threading import Thread from threading import Thread
COLUMNS = [ COLUMNS = [
('call', 10),
('lat', 10), ('lat', 10),
('lon', 10), ('lon', 10),
('alt', 7), ('alt', 7),
@ -16,11 +17,12 @@ COLUMNS = [
('roc', 7), ('roc', 7),
('trk', 10), ('trk', 10),
('hdg', 10), ('hdg', 10),
('ver', 4),
('live', 6), ('live', 6),
] ]
UNCERTAINTY_COLUMNS = [ UNCERTAINTY_COLUMNS = [
('|', 5),
('ver', 4),
('HPL', 5), ('HPL', 5),
('RCu', 5), ('RCu', 5),
('RCv', 5), ('RCv', 5),
@ -113,8 +115,10 @@ class Screen(Thread):
line += icao line += icao
for c, cw in self.columns: for c, cw in self.columns:
if c=='live': if c=='|':
val = int(time.time() - ac[c]) val = '|'
elif c=='live':
val = str(int(time.time() - ac[c]))+'s'
elif ac[c] is None: elif ac[c] is None:
val = '' val = ''
else: else:

View File

@ -37,6 +37,7 @@ class Stream():
if icao not in self.acs: if icao not in self.acs:
self.acs[icao] = { self.acs[icao] = {
'live': None, 'live': None,
'call': None,
'lat': None, 'lat': None,
'lon': None, 'lon': None,
'alt': None, 'alt': None,
@ -66,7 +67,7 @@ class Stream():
self.acs[icao]['live'] = int(t) self.acs[icao]['live'] = int(t)
if 1 <= tc <= 4: if 1 <= tc <= 4:
self.acs[icao]['callsign'] = pms.adsb.callsign(msg) self.acs[icao]['call'] = pms.adsb.callsign(msg)
if (5 <= tc <= 8) or (tc == 19): if (5 <= tc <= 8) or (tc == 19):
vdata = pms.adsb.velocity(msg) vdata = pms.adsb.velocity(msg)