diff --git a/src/lib/air_modes_framer.cc b/src/lib/air_modes_framer.cc index 7fbbc86..f4b9baf 100644 --- a/src/lib/air_modes_framer.cc +++ b/src/lib/air_modes_framer.cc @@ -39,7 +39,7 @@ int air_modes_framer::work(int noutput_items, int size = noutput_items - d_check_width; //need to be able to look ahead a full frame - int reference_level = 0; + float reference_level = 0; framer_packet_type packet_attrib; for(int i = 0; i < size; i++) { @@ -67,7 +67,7 @@ int air_modes_framer::work(int noutput_items, //NOTE: you can change the default here to be short packet, and then check for a long packet. don't know which way is better. for(int j = (65 * d_samples_per_symbol); j < (70 * d_samples_per_symbol); j += d_samples_per_symbol) { - int t_max = (bit_energy(&inraw[i+j], d_samples_per_chip) > bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip)) ? bit_energy(&inraw[i+j], d_samples_per_chip) : bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip); + float t_max = (bit_energy(&inraw[i+j], d_samples_per_chip) > bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip)) ? bit_energy(&inraw[i+j], d_samples_per_chip) : bit_energy(&inraw[i+j+d_samples_per_chip], d_samples_per_chip); if(t_max < (reference_level / 2)) packet_attrib = Short_Packet; } diff --git a/src/lib/air_modes_preamble.cc b/src/lib/air_modes_preamble.cc index 1c309a2..156072a 100644 --- a/src/lib/air_modes_preamble.cc +++ b/src/lib/air_modes_preamble.cc @@ -39,7 +39,7 @@ int air_modes_preamble::work(int noutput_items, int size = noutput_items - d_check_width; int pulse_offsets[4]; - int bit_energies[4]; + float bit_energies[4]; for(int i = d_samples_per_chip; i < size; i++) { float pulse_threshold = bit_energy(&inavg[i], d_samples_per_chip) * d_threshold; diff --git a/src/lib/air_modes_slicer.cc b/src/lib/air_modes_slicer.cc index 1035b05..18baf3d 100644 --- a/src/lib/air_modes_slicer.cc +++ b/src/lib/air_modes_slicer.cc @@ -90,7 +90,7 @@ int air_modes_slicer::work(int noutput_items, // confidence = bool(int(firstchip_inref) + int(secondchip_inref)); //one and only one chip in the reference zone //below is the Lincoln Labs slicer. it may produce greater bit errors. supposedly it is more resistant to mode A/C FRUIT. - + //see http://adsb.tc.faa.gov/WG3_Meetings/Meeting8/Squitter-Lon.pdf if(firstchip_inref && !secondchip_inref) { slice = 1; confidence = 1; diff --git a/src/python/altitude.py b/src/python/altitude.py index ce40d7d..c541fb9 100644 --- a/src/python/altitude.py +++ b/src/python/altitude.py @@ -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" diff --git a/src/python/altitude.pyc b/src/python/altitude.pyc index 1beff4b..9bfe393 100644 Binary files a/src/python/altitude.pyc and b/src/python/altitude.pyc differ diff --git a/src/python/cpr.py b/src/python/cpr.py index a1099db..3f2b892 100644 --- a/src/python/cpr.py +++ b/src/python/cpr.py @@ -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 diff --git a/src/python/cpr.pyc b/src/python/cpr.pyc index cd9c3b6..9e74677 100644 Binary files a/src/python/cpr.pyc and b/src/python/cpr.pyc differ diff --git a/src/python/modes_print.py b/src/python/modes_print.py index 29563b7..7d74c13 100644 --- a/src/python/modes_print.py +++ b/src/python/modes_print.py @@ -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 diff --git a/src/python/uhd_modes.py b/src/python/uhd_modes.py index a79b5c9..966af10 100755 --- a/src/python/uhd_modes.py +++ b/src/python/uhd_modes.py @@ -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))