From 85da74b43a11e049dfce1f580a4df8f67ac51665 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Sat, 13 Oct 2012 20:52:38 -0700 Subject: [PATCH] Fix preamble/slicer dB numbers. Was using power ratios for voltages (2.0 instead of 1.414 for 3dB, etc.). No real performance change. Fix suggested by Denis Gapotchenko. --- apps/modes_gui | 4 ++-- apps/modes_rx | 2 +- lib/air_modes_preamble.cc | 2 +- lib/air_modes_slicer.cc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/modes_gui b/apps/modes_gui index 6de66c2..8182aa3 100755 --- a/apps/modes_gui +++ b/apps/modes_gui @@ -48,8 +48,8 @@ class mainwindow(QtGui.QMainWindow): #should round to actual achieved gain self.ui.line_gain.insert("30") - #default to 3dB - self.ui.line_threshold.insert("3") + #default to 5dB + self.ui.line_threshold.insert("5") self.ui.prog_rssi.setMinimum(-40) self.ui.prog_rssi.setMaximum(0) diff --git a/apps/modes_rx b/apps/modes_rx index 18313d1..9eba395 100755 --- a/apps/modes_rx +++ b/apps/modes_rx @@ -151,7 +151,7 @@ if __name__ == '__main__': help="set RF gain", metavar="dB") parser.add_option("-r", "--rate", type="eng_float", default=4000000, help="set ADC sample rate [default=%default]") - parser.add_option("-T", "--threshold", type="eng_float", default=3.0, + parser.add_option("-T", "--threshold", type="eng_float", default=5.0, help="set pulse detection threshold above noise in dB [default=%default]") parser.add_option("-a","--output-all", action="store_true", default=False, help="output all frames") diff --git a/lib/air_modes_preamble.cc b/lib/air_modes_preamble.cc index 157707a..deab73b 100644 --- a/lib/air_modes_preamble.cc +++ b/lib/air_modes_preamble.cc @@ -45,7 +45,7 @@ air_modes_preamble::air_modes_preamble(int channel_rate, float threshold_db) : d_samples_per_symbol = d_samples_per_chip * 2; d_check_width = 120 * d_samples_per_symbol; //only search to this far from the end of the stream buffer d_threshold_db = threshold_db; - d_threshold = powf(10., threshold_db/10.); //the level that the sample must be above the moving average in order to qualify as a pulse + d_threshold = powf(10., threshold_db/20.); //the level that the sample must be above the moving average in order to qualify as a pulse d_secs_per_sample = 1.0 / channel_rate; set_output_multiple(1+d_check_width*2); diff --git a/lib/air_modes_slicer.cc b/lib/air_modes_slicer.cc index c6519aa..48ea8b0 100644 --- a/lib/air_modes_slicer.cc +++ b/lib/air_modes_slicer.cc @@ -65,8 +65,8 @@ static slice_result_t slicer(const float bit0, const float bit1, const float ref slice_result_t result; //3dB limits for bit slicing and confidence measurement - float highlimit=ref*2; - float lowlimit=ref*0.5; + float highlimit=ref*1.414; + float lowlimit=ref*0.707; bool firstchip_inref = ((bit0 > lowlimit) && (bit0 < highlimit)); bool secondchip_inref = ((bit1 > lowlimit) && (bit1 < highlimit));