summaryrefslogtreecommitdiff
path: root/gr-uhd/apps
diff options
context:
space:
mode:
authorTom Rondeau2011-12-14 22:24:37 -0500
committerTom Rondeau2011-12-14 22:24:37 -0500
commitf395bd639c64ea7b61d1e5091f5af0b419a5b3a2 (patch)
treeb002d23b88a936351008aed8f92b6ba014496871 /gr-uhd/apps
parent7b3e1522274a41bcc3b432817bb02c33b2e4f84c (diff)
parente4cf0d1b51b7bc9843e76e8d6e35097664b6f2b3 (diff)
downloadgnuradio-f395bd639c64ea7b61d1e5091f5af0b419a5b3a2.tar.gz
gnuradio-f395bd639c64ea7b61d1e5091f5af0b419a5b3a2.tar.bz2
gnuradio-f395bd639c64ea7b61d1e5091f5af0b419a5b3a2.zip
Merge branch 'maint'
Diffstat (limited to 'gr-uhd/apps')
-rwxr-xr-xgr-uhd/apps/uhd_fft.py8
-rwxr-xr-xgr-uhd/apps/uhd_rx_cfile.py16
-rwxr-xr-xgr-uhd/apps/uhd_rx_nogui.py24
3 files changed, 24 insertions, 24 deletions
diff --git a/gr-uhd/apps/uhd_fft.py b/gr-uhd/apps/uhd_fft.py
index 7ebf5e106..a9bb1435e 100755
--- a/gr-uhd/apps/uhd_fft.py
+++ b/gr-uhd/apps/uhd_fft.py
@@ -85,6 +85,10 @@ class app_top_block(stdgui2.std_top_block):
if(options.spec):
self.u.set_subdev_spec(options.spec, 0)
+ # Set the antenna
+ if(options.antenna):
+ self.u.set_antenna(options.antenna, 0)
+
self.u.set_samp_rate(options.samp_rate)
input_rate = self.u.get_samp_rate()
@@ -128,10 +132,6 @@ class app_top_block(stdgui2.std_top_block):
self.set_gain(options.gain)
- # Set the antenna
- if(options.antenna):
- self.u.set_antenna(options.antenna, 0)
-
if self.show_debug_info:
self.myform['samprate'].set_value(self.u.get_samp_rate())
self.myform['rffreq'].set_value(0)
diff --git a/gr-uhd/apps/uhd_rx_cfile.py b/gr-uhd/apps/uhd_rx_cfile.py
index 61d5342c5..ea2aad8fe 100755
--- a/gr-uhd/apps/uhd_rx_cfile.py
+++ b/gr-uhd/apps/uhd_rx_cfile.py
@@ -47,6 +47,14 @@ class rx_cfile_block(gr.top_block):
self._u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32'))
self._sink = gr.file_sink(gr.sizeof_gr_complex, filename)
+ # Set the subdevice spec
+ if(options.spec):
+ self._u.set_subdev_spec(options.spec, 0)
+
+ # Set the antenna
+ if(options.antenna):
+ self._u.set_antenna(options.antenna, 0)
+
# Set receiver sample rate
self._u.set_samp_rate(options.samp_rate)
@@ -57,14 +65,6 @@ class rx_cfile_block(gr.top_block):
print "Using mid-point gain of", options.gain, "(", g.start(), "-", g.stop(), ")"
self._u.set_gain(options.gain)
- # Set the subdevice spec
- if(options.spec):
- self._u.set_subdev_spec(options.spec, 0)
-
- # Set the antenna
- if(options.antenna):
- self._u.set_antenna(options.antenna, 0)
-
# Set frequency (tune request takes lo_offset)
if(options.lo_offset is not None):
treq = uhd.tune_request(options.freq, options.lo_offset)
diff --git a/gr-uhd/apps/uhd_rx_nogui.py b/gr-uhd/apps/uhd_rx_nogui.py
index 7a2e0a07a..e692e6ea3 100755
--- a/gr-uhd/apps/uhd_rx_nogui.py
+++ b/gr-uhd/apps/uhd_rx_nogui.py
@@ -90,6 +90,14 @@ class uhd_src(gr.hier_block2):
self._src = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32'))
+ # Set the subdevice spec
+ if(spec):
+ self._src.set_subdev_spec(spec, 0)
+
+ # Set the antenna
+ if(antenna):
+ self._src.set_antenna(antenna, 0)
+
self._src.set_samp_rate(samp_rate)
dev_rate = self._src.get_samp_rate()
self._samp_rate = samp_rate
@@ -99,20 +107,12 @@ class uhd_src(gr.hier_block2):
self._resamp = blks2.pfb_arb_resampler_ccf(self._rrate)
# If no gain specified, set to midrange
+ gain_range = self._src.get_gain_range()
if gain is None:
- g = self._src.get_gain_range()
- gain = (g.start()+g.stop())/2.0
+ gain = (gain_range.start()+gain_range.stop())/2.0
print "Using gain: ", gain
self._src.set_gain(gain)
- # Set the subdevice spec
- if(spec):
- self._src.set_subdev_spec(spec, 0)
-
- # Set the antenna
- if(antenna):
- self._src.set_antenna(antenna, 0)
-
self._cal = calibration
self.connect(self._src, self._resamp, self)
@@ -205,12 +205,12 @@ def main():
parser.add_option("-c", "--calibration", type="eng_float",
default=0.0, metavar="Hz",
help="set frequency offset to Hz [default=%default]")
- parser.add_option("-g", "--gain", type="int",
+ parser.add_option("-g", "--gain", type="eng_float",
metavar="dB", default=None,
help="set RF gain [default is midpoint]")
parser.add_option("-m", "--modulation", type="choice", choices=('AM','FM','WFM'),
metavar="TYPE", default=None,
- help="set modulation type (AM,FM) [default=%default]")
+ help="set modulation type (AM,FM,WFM) [default=%default]")
parser.add_option("-o", "--output-rate", type="eng_float",
default=32000, metavar="RATE",
help="set audio output rate to RATE [default=%default]")