Parser and error-handling changes.
This commit is contained in:
parent
b4cafe0384
commit
8439e0e5f3
@ -227,7 +227,7 @@ if __name__ == '__main__':
|
|||||||
for out in outputs:
|
for out in outputs:
|
||||||
try:
|
try:
|
||||||
out(msg.to_string())
|
out(msg.to_string())
|
||||||
except ADSBError:
|
except air_modes.ADSBError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif runner.done:
|
elif runner.done:
|
||||||
|
@ -75,9 +75,14 @@ class data_field:
|
|||||||
def get_bits(self, *args):
|
def get_bits(self, *args):
|
||||||
startbit = args[0]
|
startbit = args[0]
|
||||||
num = args[1]
|
num = args[1]
|
||||||
bits = (self.data \
|
bits = 0
|
||||||
>> (self.get_numbits() - startbit - num + self.offset)) \
|
try:
|
||||||
& ((1 << num) - 1)
|
bits = (self.data \
|
||||||
|
>> (self.get_numbits() - startbit - num + self.offset)) \
|
||||||
|
& ((1 << num) - 1)
|
||||||
|
except ValueError:
|
||||||
|
#pass
|
||||||
|
print "Got short packet but expected long retrieving bits (%i, %i) with type %i" % (startbit, num, self.get_type())
|
||||||
return bits
|
return bits
|
||||||
|
|
||||||
class bds09_reply(data_field):
|
class bds09_reply(data_field):
|
||||||
|
@ -217,7 +217,7 @@ class modes_output_print(modes_parse.modes_parse):
|
|||||||
retstr = "No handler for BDS1 == %i from %x" % (bds1, ecc)
|
retstr = "No handler for BDS1 == %i from %x" % (bds1, ecc)
|
||||||
|
|
||||||
if(msgtype == 20):
|
if(msgtype == 20):
|
||||||
retstr += " at %ift" % altitude
|
retstr += " at %ift" % alt
|
||||||
else:
|
else:
|
||||||
retstr += " ident %x" % ident
|
retstr += " ident %x" % ident
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user