Fix rate setting for devices with <4Msps rates (RTL).
This commit is contained in:
parent
cc0fa1801b
commit
6f11777724
@ -27,6 +27,7 @@ from gnuradio import gr, gru, eng_notation, filter, blocks
|
|||||||
from gnuradio.filter import optfir
|
from gnuradio.filter import optfir
|
||||||
from gnuradio.eng_option import eng_option
|
from gnuradio.eng_option import eng_option
|
||||||
from gnuradio.gr.pubsub import pubsub
|
from gnuradio.gr.pubsub import pubsub
|
||||||
|
from gnuradio.filter import pfb
|
||||||
from optparse import OptionParser, OptionGroup
|
from optparse import OptionParser, OptionGroup
|
||||||
import air_modes
|
import air_modes
|
||||||
import zmq
|
import zmq
|
||||||
@ -45,9 +46,16 @@ class modes_radio (gr.top_block, pubsub):
|
|||||||
self._resample = None
|
self._resample = None
|
||||||
self._setup_source(options)
|
self._setup_source(options)
|
||||||
|
|
||||||
self._rx_path = air_modes.rx_path(self._rate, options.threshold,
|
if self._rate < 4e6:
|
||||||
|
self._resample = pfb.arb_resampler_ccf(4.e6/self._rate)
|
||||||
|
self._rx_rate = 4e6
|
||||||
|
else:
|
||||||
|
self._rx_rate = self._rate
|
||||||
|
|
||||||
|
self._rx_path = air_modes.rx_path(self._rx_rate, options.threshold,
|
||||||
self._queue, options.pmf, options.dcblock)
|
self._queue, options.pmf, options.dcblock)
|
||||||
|
|
||||||
|
|
||||||
#now subscribe to set various options via pubsub
|
#now subscribe to set various options via pubsub
|
||||||
self.subscribe("freq", self.set_freq)
|
self.subscribe("freq", self.set_freq)
|
||||||
self.subscribe("gain", self.set_gain)
|
self.subscribe("gain", self.set_gain)
|
||||||
@ -125,7 +133,14 @@ class modes_radio (gr.top_block, pubsub):
|
|||||||
return self.get_gain()
|
return self.get_gain()
|
||||||
|
|
||||||
def set_rate(self, rate):
|
def set_rate(self, rate):
|
||||||
self._rx_path.set_rate(rate)
|
if(rate < 4e6 and self._rate > 4e6):
|
||||||
|
raise NotImplementedError("Lowering rate <4e6Msps not currently supported.")
|
||||||
|
if(rate < 4e6):
|
||||||
|
self._resample.set_rate(4e6/rate)
|
||||||
|
self._rx_rate = 4e6
|
||||||
|
else:
|
||||||
|
self._rx_rate = rate
|
||||||
|
self._rx_path.set_rate(self._rx_rate)
|
||||||
return self._u.set_rate(rate) if self.live_source() else 0
|
return self._u.set_rate(rate) if self.live_source() else 0
|
||||||
|
|
||||||
def set_threshold(self, threshold):
|
def set_threshold(self, threshold):
|
||||||
|
@ -37,7 +37,7 @@ class rx_path(gr.hier_block2):
|
|||||||
# Convert incoming I/Q baseband to amplitude
|
# Convert incoming I/Q baseband to amplitude
|
||||||
self._demod = blocks.complex_to_mag_squared()
|
self._demod = blocks.complex_to_mag_squared()
|
||||||
if use_dcblock:
|
if use_dcblock:
|
||||||
self._dcblock = filter.dc_blocker_cc(100*self._spc,True)
|
self._dcblock = filter.dc_blocker_cc(100*self._spc,False)
|
||||||
self.connect(self, self._dcblock, self._demod)
|
self.connect(self, self._dcblock, self._demod)
|
||||||
else:
|
else:
|
||||||
self.connect(self, self._demod)
|
self.connect(self, self._demod)
|
||||||
|
Loading…
Reference in New Issue
Block a user