From a847f5f875115b053ded45d954baf7973b8af2de Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Wed, 5 Jun 2013 17:50:10 -0400 Subject: [PATCH] Fix introduced CPU consumption bug. --- lib/air_modes_preamble.cc | 2 +- lib/air_modes_slicer.cc | 4 ++-- python/radio.py | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/air_modes_preamble.cc b/lib/air_modes_preamble.cc index 612d581..b575ff2 100644 --- a/lib/air_modes_preamble.cc +++ b/lib/air_modes_preamble.cc @@ -184,7 +184,7 @@ int air_modes_preamble::general_work(int noutput_items, if(!valid_preamble) continue; //be sure we've got enough room in the input buffer to copy out a whole packet - if(ninputs-i < d_check_width) { + if(ninputs-i < 240*d_samples_per_chip) { consume_each(std::max(i-1,0)); if(0) std::cout << "Preamble consumed " << std::max(i-1,0) << ", returned 0 (no room)" << std::endl; return 0; diff --git a/lib/air_modes_slicer.cc b/lib/air_modes_slicer.cc index 82e4385..1b7dbbb 100644 --- a/lib/air_modes_slicer.cc +++ b/lib/air_modes_slicer.cc @@ -60,8 +60,8 @@ void air_modes_slicer::set_rate(int channel_rate) d_chip_rate = 2000000; //2Mchips per second d_samples_per_chip = 2;//FIXME this is constant now channel_rate / d_chip_rate; d_samples_per_symbol = d_samples_per_chip * 2; - d_check_width = 240 * d_samples_per_symbol; //how far you will have to look ahead - set_output_multiple(d_check_width); //how do you specify buffer size for sinks? + d_check_width = 120 * d_samples_per_symbol; //how far you will have to look ahead + set_output_multiple(d_check_width*2); //how do you specify buffer size for sinks? } //this slicer is courtesy of Lincoln Labs. supposedly it is more resistant to mode A/C FRUIT. diff --git a/python/radio.py b/python/radio.py index 79d9eec..08e66e2 100644 --- a/python/radio.py +++ b/python/radio.py @@ -80,18 +80,18 @@ class modes_radio (gr.top_block, pubsub): self.rx_path = air_modes.rx_path(rate, options.threshold, self._queue, options.pmf) #now subscribe to set various options via pubsub - self.subscribe("FREQ", self.set_freq) - self.subscribe("GAIN", self.set_gain) - self.subscribe("RATE", self.set_rate) - self.subscribe("RATE", self.rx_path.set_rate) - self.subscribe("THRESHOLD", self.rx_path.set_threshold) - self.subscribe("PMF", self.rx_path.set_pmf) + #self.subscribe("freq", self.set_freq) + #self.subscribe("gain", self.set_gain) + #self.subscribe("rate", self.set_rate) + #self.subscribe("rate", self.rx_path.set_rate) + #self.subscribe("threshold", self.rx_path.set_threshold) + #self.subscribe("pmf", self.rx_path.set_pmf) - self.publish("FREQ", self.get_freq) - self.publish("GAIN", self.get_gain) - self.publish("RATE", self.get_rate) - self.publish("THRESHOLD", self.rx_path.get_threshold) - self.publish("PMF", self.rx_path.get_pmf) + #self.publish("freq", self.get_freq) + #self.publish("gain", self.get_gain) + #self.publish("rate", self.get_rate) + #self.publish("threshold", self.rx_path.get_threshold) + #self.publish("pmf", self.rx_path.get_pmf) if use_resampler: self.lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)