Use single gain setting for HackRF devices. This requires updated gr-osmosdr

with gain bin settings.
This commit is contained in:
Nick Foster 2013-08-09 16:21:58 -07:00
parent ca58874861
commit 4d2587574a
2 changed files with 6 additions and 11 deletions

View File

@ -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:

View File

@ -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)