Fixed some bugs where I was treating sample data as an integer. Allows use with UHD without multiplying everything up by 64K. =)

Also changed the reference level printout to show dB instead of sample value. This seems more useful. 0dB is full scale.
This commit is contained in:
Nick Foster
2010-09-20 11:09:59 -07:00
parent 13c5acca52
commit 7727b7c902
9 changed files with 16 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
#betcha this would be faster if you used a table for mode C
#you could strip out D1 since it's never used, that leaves 11 bits (table is 2048 entries)
#on the other hand doing it this way is educational for others
def decode_alt(alt, bit13):
if alt & 0x40 and bit13 is True:
return "METRIC ERROR"

Binary file not shown.

View File

@@ -2,12 +2,15 @@
#from string import split, join
#from math import pi, floor, cos, acos
import math, time
#this implements CPR position decoding. local only for now.
#this implements CPR position decoding.
latz = 15
nbits = 17
my_lat = 37.76225 #update these later!
my_lon = -122.44254
#my_lat = 37.76225 #update these later!
#my_lon = -122.44254
#ER
my_lat = 37.40889176297184
my_lon = -122.07765340805054
def nz(ctype):
@@ -229,8 +232,8 @@ def range_bearing(loc_a, loc_b):
avg_lat = (a_lat + b_lat) / 2.0
R1 = earth_radius_mi*(1.0-esquared)/pow((1.0-esquared*pow(math.sin(avg_lat),2)),1.5)
R1 = earth_radius_mi*(1.0-esquared)/pow((1.0-esquared*pow(math.sin(avg_lat),2)),1.5)
R2 = earth_radius_mi/math.sqrt(1.0-esquared*pow(math.sin(avg_lat),2))
distance_North = R1*delta_lat

Binary file not shown.

View File

@@ -33,7 +33,7 @@ def modes_print(message):
else:
output = "No handler for message type " + str(msgtype) + " from " + str(ecc)
output = "(%.0f) " % float(reference) + output
output = "(%.0f) " % (10.0*math.log10(float(reference))) + output
return output

View File

@@ -33,7 +33,7 @@ The following are optional command line parameters:
-R SUBDEV Daughter board specification, defaults to first found
-f FREQ USRP receive frequency (1090 MHz Default)
-g GAIN Daughterboard gain setting. Defaults to mid-range.
-d DECIM USRP decimation rate
-r RATE USRP sample rate
-t THRESH Receiver valid pulse threshold
-a Output all frames. Defaults only output frames
@@ -80,7 +80,6 @@ class adsb_rx_block (gr.top_block):
if options.output_all :
pass_all = 1
self.gain = gr.multiply_const_cc(1000000)
self.demod = gr.complex_to_mag()
self.avg = gr.moving_average_ff(100, 1.0/100, 400);
self.preamble = air.modes_preamble(rate, options.threshold)
@@ -95,7 +94,7 @@ class adsb_rx_block (gr.top_block):
# else:
self.filt = self.u
self.connect(self.filt, self.gain, self.demod)
self.connect(self.filt, self.demod)
self.connect(self.demod, self.avg)
self.connect(self.demod, (self.preamble, 0))
self.connect(self.avg, (self.preamble, 1))