Default RTL gain of 35 and parser catches negative shifts generated by invalid packets.

This commit is contained in:
Nick Foster
2012-07-16 09:36:15 -07:00
parent 4750d20044
commit c2129e0eab
2 changed files with 10 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ from string import split, join
import air_modes
import gnuradio.gr.gr_threading as _threading
import csv
from air_modes.modes_exceptions import *
class top_block_runner(_threading.Thread):
def __init__(self, tb):
@@ -87,7 +88,7 @@ class adsb_rx_block (gr.top_block):
self.u.set_gain_mode(0) #manual gain mode
if options.gain is None:
options.gain = 49
options.gain = 34
self.u.set_gain(options.gain)
print "Gain is %i" % self.u.get_gain()

View File

@@ -77,9 +77,16 @@ class data_field:
def get_bits(self, *args):
startbit = args[0]
num = args[1]
bits = (self.data \
try:
bits = (self.data \
>> (self.get_numbits() - startbit - num + self.offset)) \
& ((1 << num) - 1)
#the exception handler catches instances when you try to shift more than
#the number of bits. this can happen when a garbage packet gets through
#which reports itself as a short packet but of type long.
#TODO: should find more productive way to throw this out
except ValueError:
bits = 0
return bits
class bds09_reply(data_field):