From 4d2587574a984a6ea7846f97ca8753a073d72d48 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Fri, 9 Aug 2013 16:21:58 -0700 Subject: [PATCH] Use single gain setting for HackRF devices. This requires updated gr-osmosdr with gain bin settings. --- python/radio.py | 14 +++----------- python/rx_path.py | 3 +++ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/python/radio.py b/python/radio.py index ebdfa7f..9d28b9f 100644 --- a/python/radio.py +++ b/python/radio.py @@ -174,8 +174,6 @@ class modes_radio (gr.top_block, pubsub): #TODO: detect if you're using an RTLSDR or Jawbreaker #and set up accordingly. - #ALSO TODO: Actually set gain appropriately using gain bins in HackRF driver. - #osmocom doesn't have gain bucket distribution like UHD does elif options.source == "osmocom": #RTLSDR dongle or HackRF Jawbreaker import osmosdr self._u = osmosdr.source(options.args) @@ -184,22 +182,16 @@ class modes_radio (gr.top_block, pubsub): if not self._u.set_center_freq(options.freq): print "Failed to set initial frequency" - self._u.set_gain_mode(0) #manual gain mode +# self._u.set_gain_mode(0) #manual gain mode if options.gain is None: options.gain = 34 -###DO NOT COMMIT - self._u.set_gain(14, "RF", 0) - self._u.set_gain(30, "IF", 0) - self._u.set_gain(6, "BB", 0) - self._u.set_bandwidth(4e6) -###DO NOT COMMIT -# self._u.set_gain(options.gain) + self._u.set_gain(options.gain) print "Gain is %i" % self._u.get_gain() #Note: this should only come into play if using an RTLSDR. # lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3) # self._resample = filter.rational_resampler_ccf(interpolation=5, decimation=4, taps=lpfiltcoeffs) - + else: #semantically detect whether it's ip.ip.ip.ip:port or filename if ':' in options.source: diff --git a/python/rx_path.py b/python/rx_path.py index fa13889..36350c2 100644 --- a/python/rx_path.py +++ b/python/rx_path.py @@ -41,6 +41,7 @@ class rx_path(gr.hier_block2): self.connect(self, self._dcblock, self._demod) else: self.connect(self, self._demod) + self._dcblock = None self._bb = self._demod # Pulse matched filter for 0.5us pulses @@ -69,6 +70,8 @@ class rx_path(gr.hier_block2): self._avg.set_length_and_scale(48*self._spc, 1.0/(48*self._spc)) if self._bb != self._demod: self._pmf.set_length_and_scale(self._spc, 1.0/self._spc) + if self._dcblock is not None: + self._dcblock.set_length(100*self._spc) def set_threshold(self, threshold): self._sync.set_threshold(threshold)