From 1630e67c3bc2a2ae1be0303b7c2f3eb59bca5135 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Sun, 4 Aug 2013 22:20:15 -0700 Subject: [PATCH] Preamble subtracts average (LPF'ed) input from samples. This has the effect only of improving the slicer threshold to exactly 0.5. --- lib/air_modes_preamble.cc | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/air_modes_preamble.cc b/lib/air_modes_preamble.cc index 13ca7c6..0c3c8d2 100644 --- a/lib/air_modes_preamble.cc +++ b/lib/air_modes_preamble.cc @@ -128,7 +128,7 @@ int air_modes_preamble::general_work(int noutput_items, if(tstamp_tags.size() > 0) { d_timestamp = tstamp_tags.back(); } - + for(int i=0; i < ninputs; i++) { float pulse_threshold = inavg[i] * d_threshold; if(in[i] > pulse_threshold) { //hey we got a candidate @@ -175,17 +175,9 @@ int air_modes_preamble::general_work(int noutput_items, return 0; } - //all right i'm prepared to call this a preamble - //let's integrate and dump the output - //FIXME: disable and use center sample - bool life_sucks = true; - if(life_sucks) { - for(int j=0; j<240; j++) { - out[j] = in[i+j*d_samples_per_chip]; - } - } else { - i -= d_samples_per_chip-1; - integrate_and_dump(out, &in[i], 240, d_samples_per_chip); + //all right i'm prepared to call this a preamble + for(int j=0; j<240; j++) { + out[j] = in[i+j*d_samples_per_chip] - inavg[i]; } //get the timestamp of the preamble @@ -198,9 +190,9 @@ int air_modes_preamble::general_work(int noutput_items, pmt::from_double(tstamp), d_me //block src id ); - + //std::cout << "PREAMBLE" << std::endl; - + //produce only one output per work call -- TODO this should probably change if(0) std::cout << "Preamble consumed " << i+240*d_samples_per_chip << "with i=" << i << ", returned 240" << std::endl; @@ -208,7 +200,7 @@ int air_modes_preamble::general_work(int noutput_items, return 240; } } - + //didn't get anything this time if(0) std::cout << "Preamble consumed " << ninputs << ", returned 0" << std::endl; consume_each(ninputs);