make modeslive uncertanty values optional
This commit is contained in:
parent
e5ca76ac0d
commit
6f139d4ae9
@ -80,6 +80,7 @@ Supports **Mode-S Beast** and **AVR** raw stream
|
||||
--port PORT raw data port
|
||||
--rawtype RAWTYPE beast or avr
|
||||
--latlon LAT LON receiver position
|
||||
--show-uncertainty display uncertaint values, default off
|
||||
|
||||
|
||||
If you have a RTL-SDR receiver or Mode-S Beast, use modesmixer2 (http://xdeco.org/?page_id=48) to create raw beast TCP stream:
|
||||
|
@ -22,7 +22,7 @@ parser.add_argument('--server', help='server address or IP', required=True)
|
||||
parser.add_argument('--port', help='raw data port', required=True)
|
||||
parser.add_argument('--rawtype', help='beast or avr', required=True)
|
||||
parser.add_argument('--latlon', help='receiver position', nargs=2, metavar=('LAT', 'LON'), required=True)
|
||||
parser.add_argument('--show-uncertainty', help='display uncertainty indicators', required=False)
|
||||
parser.add_argument('--show-uncertainty', dest='uncertainty', help='display uncertaint values, default off', action='store_true', required=False, default=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
SERVER = args.server
|
||||
@ -30,6 +30,7 @@ PORT = int(args.port)
|
||||
RAWTYPE = args.rawtype
|
||||
LAT0 = float(args.latlon[0])
|
||||
LON0 = float(args.latlon[1])
|
||||
UNCERTAINTY = args.uncertainty
|
||||
|
||||
|
||||
class ModesClient(BaseClient):
|
||||
@ -76,7 +77,7 @@ client.start()
|
||||
stream = Stream(lat0=LAT0, lon0=LON0)
|
||||
|
||||
try:
|
||||
screen = Screen()
|
||||
screen = Screen(uncertainty=UNCERTAINTY)
|
||||
screen.daemon = True
|
||||
screen.start()
|
||||
|
||||
|
@ -17,6 +17,10 @@ COLUMNS = [
|
||||
('trk', 10),
|
||||
('hdg', 10),
|
||||
('ver', 4),
|
||||
('live', 6),
|
||||
]
|
||||
|
||||
UNCERTAINTY_COLUMNS = [
|
||||
('HPL', 5),
|
||||
('RCu', 5),
|
||||
('RCv', 5),
|
||||
@ -30,11 +34,10 @@ COLUMNS = [
|
||||
('VFOMr', 7),
|
||||
('PE_RCu', 8),
|
||||
('PE_VPL', 8),
|
||||
('live', 6),
|
||||
]
|
||||
|
||||
class Screen(Thread):
|
||||
def __init__(self):
|
||||
def __init__(self, uncertainty=False):
|
||||
Thread.__init__(self)
|
||||
self.screen = curses.initscr()
|
||||
curses.noecho()
|
||||
@ -46,6 +49,10 @@ class Screen(Thread):
|
||||
self.acs = {}
|
||||
self.lock_icao = None
|
||||
|
||||
self.columns = COLUMNS
|
||||
if uncertainty:
|
||||
self.columns.extend(UNCERTAINTY_COLUMNS)
|
||||
|
||||
|
||||
def reset_cursor_pos(self):
|
||||
self.screen.move(self.y, self.x)
|
||||
@ -73,7 +80,7 @@ class Screen(Thread):
|
||||
row = 1
|
||||
|
||||
header = ' icao'
|
||||
for c, cw in COLUMNS:
|
||||
for c, cw in self.columns:
|
||||
header += (cw-len(c))*' ' + c
|
||||
|
||||
# fill end with spaces
|
||||
@ -105,7 +112,7 @@ class Screen(Thread):
|
||||
|
||||
line += icao
|
||||
|
||||
for c, cw in COLUMNS:
|
||||
for c, cw in self.columns:
|
||||
if c=='live':
|
||||
val = int(time.time() - ac[c])
|
||||
elif ac[c] is None:
|
||||
|
Loading…
Reference in New Issue
Block a user