diff options
-rw-r--r-- | config/grc_gnuradio_examples.m4 | 3 | ||||
-rw-r--r-- | gnuradio-examples/python/Makefile.am | 1 | ||||
-rw-r--r-- | gnuradio-examples/python/apps/.gitignore | 2 | ||||
-rw-r--r-- | gnuradio-examples/python/apps/Makefile.am | 26 | ||||
-rw-r--r-- | gnuradio-examples/python/apps/README | 26 | ||||
-rw-r--r-- | gnuradio-examples/python/apps/hf_explorer/README | 48 | ||||
-rw-r--r-- | gr-uhd/apps/hf_explorer/.gitignore (renamed from gnuradio-examples/python/apps/hf_explorer/.gitignore) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_explorer/Makefile.am (renamed from gnuradio-examples/python/apps/hf_explorer/Makefile.am) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_explorer/README | 42 | ||||
-rwxr-xr-x | gr-uhd/apps/hf_explorer/hfx.py (renamed from gnuradio-examples/python/apps/hf_explorer/hfx2.py) | 225 | ||||
-rw-r--r-- | gr-uhd/apps/hf_explorer/hfx_help (renamed from gnuradio-examples/python/apps/hf_explorer/hfx_help) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/.gitignore (renamed from gnuradio-examples/python/apps/hf_radio/.gitignore) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/Makefile.am (renamed from gnuradio-examples/python/apps/hf_radio/Makefile.am) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/README.TXT (renamed from gnuradio-examples/python/apps/hf_radio/README.TXT) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/hfir.sci (renamed from gnuradio-examples/python/apps/hf_radio/hfir.sci) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/input.py (renamed from gnuradio-examples/python/apps/hf_radio/input.py) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/output.py (renamed from gnuradio-examples/python/apps/hf_radio/output.py) | 0 | ||||
-rwxr-xr-x | gr-uhd/apps/hf_radio/radio.py (renamed from gnuradio-examples/python/apps/hf_radio/radio.py) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/radio.xml (renamed from gnuradio-examples/python/apps/hf_radio/radio.xml) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/ssb_taps (renamed from gnuradio-examples/python/apps/hf_radio/ssb_taps) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/ssbagc.py (renamed from gnuradio-examples/python/apps/hf_radio/ssbagc.py) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/ssbdemod.py (renamed from gnuradio-examples/python/apps/hf_radio/ssbdemod.py) | 0 | ||||
-rw-r--r-- | gr-uhd/apps/hf_radio/startup.py (renamed from gnuradio-examples/python/apps/hf_radio/startup.py) | 0 | ||||
-rwxr-xr-x | gr-uhd/apps/hf_radio/ui.py (renamed from gnuradio-examples/python/apps/hf_radio/ui.py) | 0 |
24 files changed, 165 insertions, 208 deletions
diff --git a/config/grc_gnuradio_examples.m4 b/config/grc_gnuradio_examples.m4 index f5d94318e..adf8672c6 100644 --- a/config/grc_gnuradio_examples.m4 +++ b/config/grc_gnuradio_examples.m4 @@ -28,9 +28,6 @@ AC_DEFUN([GRC_GNURADIO_EXAMPLES],[ gnuradio-examples/Makefile \ gnuradio-examples/python/Makefile \ gnuradio-examples/grc/Makefile \ - gnuradio-examples/python/apps/hf_explorer/Makefile \ - gnuradio-examples/python/apps/hf_radio/Makefile \ - gnuradio-examples/python/apps/Makefile \ gnuradio-examples/python/digital/Makefile \ gnuradio-examples/python/digital-bert/Makefile \ gnuradio-examples/python/mp-sched/Makefile \ diff --git a/gnuradio-examples/python/Makefile.am b/gnuradio-examples/python/Makefile.am index 3f1977e74..c9084505d 100644 --- a/gnuradio-examples/python/Makefile.am +++ b/gnuradio-examples/python/Makefile.am @@ -22,7 +22,6 @@ include $(top_srcdir)/Makefile.common SUBDIRS = \ - apps \ digital \ digital-bert \ mp-sched \ diff --git a/gnuradio-examples/python/apps/.gitignore b/gnuradio-examples/python/apps/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/gnuradio-examples/python/apps/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/gnuradio-examples/python/apps/Makefile.am b/gnuradio-examples/python/apps/Makefile.am deleted file mode 100644 index 50fe75151..000000000 --- a/gnuradio-examples/python/apps/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright 2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -SUBDIRS = hf_explorer hf_radio -EXTRA_DIST += README - diff --git a/gnuradio-examples/python/apps/README b/gnuradio-examples/python/apps/README deleted file mode 100644 index b64b9d066..000000000 --- a/gnuradio-examples/python/apps/README +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright 2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -This directory servers as the parent directory for various and sundry -applications such as scanners, HF radios, etc. Each subdirectory -shall have a README file that includes a short description of what the -application does, and a list of hardware dependencies. E.g., requires -a USRP with an xyz daughterboard, connected to a footronics magic box. diff --git a/gnuradio-examples/python/apps/hf_explorer/README b/gnuradio-examples/python/apps/hf_explorer/README deleted file mode 100644 index 5f780b3d9..000000000 --- a/gnuradio-examples/python/apps/hf_explorer/README +++ /dev/null @@ -1,48 +0,0 @@ -hfx.py is meant to be a full-featured Long Wave / Medium Wave -and Short Wave (250kHz to 30Mhz) AM and Single Sideband receiver. -It uses the USRP with a Basic RX board, and will need an -antenna and some preamps, about 30db gain will work. See the -'Help' menu or hfx_help for more info. - ----------------------------------------------------------- - -hfx2.py is a major revision built about complex fir filter -coeffecients ability and cleaner python script. Inherits -most features from hfx.py - Powermate knob supported but -not required, tooltip frequency display, single click -tuning, AGC, record to disk, play from disk and record audio. -New feature is ability to tailor the audio passband with two -sliders over the spectrum display. The sliders almost align -with the actual frequency. Preset filter settings for LSB -(-3000 to 0kHz), USB (0 to +3000kHz), CW (-400 to -800Hz) -and AM (-5kHz from carrier to +5kHz). - -AM now switches in a synchronous PLL detector with the -carriers at 7.5kHz. The PLL carrier is displayed in the -bottom display and helps show where on the upper spectrum -the demodulated signal lies. Everything gets shifted up -7.5kHz in AM, center frequency, tooltips, etc. The target -AM carrier needs to be closely tuned in, it will have a -hollow sound untill it is locked, and then the PLL carrier -in the bottom display will jump up and remain relatively -constant. There is a slider "AM sync carrier" to play with -different levels to mix with the signal for demodulation. -The filter in AM is preset to 2500/12500 (7.5kHz +/- 5kHz) -and is handy for removing adjacent channel interference. -Change AM_SYNC_DISPLAY in script for whether to show AM -Sync carrier or not. -Run with "-h" for command line help with setting USRP -ddc center frequency, decimation, rf data record, playback -and audio data recording. - -There are some controls for controlling a varactor and -tuning an antenna - just ignore them unless you want -to build a voltage tuned antenna to track frequency. - -There is also code for Web based control of frequency and -volume - so I can tune the radio with an Ipaq from bed. -Disabled by default - it takes a web server, some -directories and scripts to use. - - - diff --git a/gnuradio-examples/python/apps/hf_explorer/.gitignore b/gr-uhd/apps/hf_explorer/.gitignore index b6950912c..b6950912c 100644 --- a/gnuradio-examples/python/apps/hf_explorer/.gitignore +++ b/gr-uhd/apps/hf_explorer/.gitignore diff --git a/gnuradio-examples/python/apps/hf_explorer/Makefile.am b/gr-uhd/apps/hf_explorer/Makefile.am index 88ad52128..88ad52128 100644 --- a/gnuradio-examples/python/apps/hf_explorer/Makefile.am +++ b/gr-uhd/apps/hf_explorer/Makefile.am diff --git a/gr-uhd/apps/hf_explorer/README b/gr-uhd/apps/hf_explorer/README new file mode 100644 index 000000000..57f45ceba --- /dev/null +++ b/gr-uhd/apps/hf_explorer/README @@ -0,0 +1,42 @@ +hfx.py is meant to be a full-featured Long Wave / Medium Wave +and Short Wave (250kHz to 30Mhz) AM and Single Sideband receiver. +It uses the USRP with a Basic RX board, and will need an +antenna and some preamps, about 30db gain will work. See the +'Help' menu or hfx_help for more info. + +---------------------------------------------------------- + +Powermate knob supported but not required, tooltip frequency display, +single click tuning, AGC, record to disk, play from disk and record +audio. Ability to tailor the audio passband with two sliders over the +spectrum display. The sliders almost align with the actual +frequency. Preset filter settings for LSB (-3000 to 0kHz), USB (0 to ++3000kHz), CW (-400 to -800Hz) and AM (-5kHz from carrier to +5kHz). + +AM now switches in a synchronous PLL detector with the carriers at +7.5kHz. The PLL carrier is displayed in the bottom display and helps +show where on the upper spectrum the demodulated signal +lies. Everything gets shifted up 7.5kHz in AM, center frequency, +tooltips, etc. The target AM carrier needs to be closely tuned in, it +will have a hollow sound untill it is locked, and then the PLL carrier +in the bottom display will jump up and remain relatively +constant. There is a slider "AM sync carrier" to play with different +levels to mix with the signal for demodulation. The filter in AM is +preset to 2500/12500 (7.5kHz +/- 5kHz) and is handy for removing +adjacent channel interference. Change AM_SYNC_DISPLAY in script for +whether to show AM Sync carrier or not. + +Run with "-h" for command line help with setting USRP ddc center +frequency, decimation, rf data record, playback and audio data +recording. + +There are some controls for controlling a varactor and tuning an +antenna - just ignore them unless you want to build a voltage tuned +antenna to track frequency. + +There is also code for Web based control of frequency and volume - so +I can tune the radio with an Ipaq from bed. Disabled by default - it +takes a web server, some directories and scripts to use. + + + diff --git a/gnuradio-examples/python/apps/hf_explorer/hfx2.py b/gr-uhd/apps/hf_explorer/hfx.py index 00a3b9047..dab1ce862 100755 --- a/gnuradio-examples/python/apps/hf_explorer/hfx2.py +++ b/gr-uhd/apps/hf_explorer/hfx.py @@ -1,8 +1,7 @@ #!/usr/bin/env python -# -*- coding: ANSI_X3.4-1968 -*- # generated by wxGlade 0.4 on Tue Mar 14 10:16:06 2006 # -# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -81,10 +80,13 @@ AM_SYNC_DISPLAY = False import os, wx, sys, math import wx.lib.evtmgr as em from gnuradio.wxgui import powermate, fftsink2 -from gnuradio import gr, audio, eng_notation, usrp, gru +from gnuradio import gr, audio, eng_notation from gnuradio.eng_option import eng_option +from gnuradio import uhd from optparse import OptionParser +n2s = eng_notation.num_to_str + ID_BUTTON_1 = wx.NewId() # LSB button ID_BUTTON_2 = wx.NewId() # USB ID_BUTTON_3 = wx.NewId() # AM @@ -111,20 +113,6 @@ ID_SLIDER_7 = wx.NewId() # AT control voltage output ID_EXIT = wx.NewId() # Menu Exit -def pick_subdevice(u): - """ - The user didn't specify a subdevice on the command line. - If there's a daughterboard on A, select A. - If there's a daughterboard on B, select B. - Otherwise, select A. - """ - if u.db(0, 0).dbid() >= 0: # dbid is < 0 if there's no d'board or a problem - return (0, 0) - if u.db(1, 0).dbid() >= 0: - return (1, 0) - return (0, 0) - - class MyFrame(wx.Frame): def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ @@ -135,7 +123,8 @@ class MyFrame(wx.Frame): self.frame_1_menubar = wx.MenuBar() self.SetMenuBar(self.frame_1_menubar) wxglade_tmp_menu = wx.Menu() - self.Exit = wx.MenuItem(wxglade_tmp_menu, ID_EXIT, "Exit", "Exit", wx.ITEM_NORMAL) + self.Exit = wx.MenuItem(wxglade_tmp_menu, ID_EXIT, "Exit", + "Exit", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.Exit) self.frame_1_menubar.Append(wxglade_tmp_menu, "File") # Menu Bar end @@ -145,9 +134,11 @@ class MyFrame(wx.Frame): self.button_3 = wx.Button(self, ID_BUTTON_3, "AM") self.button_4 = wx.Button(self, ID_BUTTON_4, "CW") self.button_5 = wx.ToggleButton(self, ID_BUTTON_5, "Upper") - self.slider_1 = wx.Slider(self, ID_SLIDER_1, 0, -15799, 15799, style=wx.SL_HORIZONTAL|wx.SL_LABELS) + self.slider_fcutoff_hi = wx.Slider(self, ID_SLIDER_1, 0, -15798, 15799, + style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.button_6 = wx.ToggleButton(self, ID_BUTTON_6, "Lower") - self.slider_2 = wx.Slider(self, ID_SLIDER_2, 0, -15799, 15799, style=wx.SL_HORIZONTAL|wx.SL_LABELS) + self.slider_fcutoff_lo = wx.Slider(self, ID_SLIDER_2, 0, -15799, 15798, + style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.panel_5 = wx.Panel(self, -1) self.label_1 = wx.StaticText(self, -1, " Band\nCenter") self.text_ctrl_1 = wx.TextCtrl(self, ID_TEXT_1, "") @@ -169,9 +160,11 @@ class MyFrame(wx.Frame): self.panel_8 = wx.Panel(self, -1) self.panel_9 = wx.Panel(self, -1) self.label_3 = wx.StaticText(self, -1, "AM Sync\nCarrier") - self.slider_6 = wx.Slider(self, ID_SLIDER_6, 50, 0, 200, style=wx.SL_HORIZONTAL|wx.SL_LABELS) + self.slider_6 = wx.Slider(self, ID_SLIDER_6, 50, 0, 200, + style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.label_4 = wx.StaticText(self, -1, "Antenna Tune") - self.slider_7 = wx.Slider(self, ID_SLIDER_7, 1575, 950, 2200, style=wx.SL_HORIZONTAL|wx.SL_LABELS) + self.slider_7 = wx.Slider(self, ID_SLIDER_7, 1575, 950, 2200, + style=wx.SL_HORIZONTAL|wx.SL_LABELS) self.panel_10 = wx.Panel(self, -1) self.button_12 = wx.ToggleButton(self, ID_BUTTON_12, "Auto Tune") self.button_13 = wx.Button(self, ID_BUTTON_13, "Calibrate") @@ -186,24 +179,26 @@ class MyFrame(wx.Frame): parser = OptionParser (option_class=eng_option) parser.add_option ("-c", "--ddc-freq", type="eng_float", default=3.9e6, help="set Rx DDC frequency to FREQ", metavar="FREQ") + parser.add_option ("-s", "--samp-rate", type="eng_float", default=256e3, + help="set sample rate (bandwidth) [default=%default]") parser.add_option ("-a", "--audio_file", default="", help="audio output file", metavar="FILE") parser.add_option ("-r", "--radio_file", default="", help="radio output file", metavar="FILE") parser.add_option ("-i", "--input_file", default="", help="radio input file", metavar="FILE") - parser.add_option ("-d", "--decim", type="int", default=250, - help="USRP decimation") - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, help="select USRP Rx side A or B (default=first one with a daughterboard)") + parser.add_option ("-O", "--audio-output", type="string", default="", + help="audio output device name. E.g., hw:0,0, /dev/dsp, or pulse") + (options, args) = parser.parse_args () self.usrp_center = options.ddc_freq - usb_rate = 64e6 / options.decim - self.slider_range = usb_rate * 0.9375 + input_rate = options.samp_rate + self.slider_range = input_rate * 0.9375 self.f_lo = self.usrp_center - (self.slider_range/2) self.f_hi = self.usrp_center + (self.slider_range/2) self.af_sample_rate = 32000 - fir_decim = long (usb_rate / self.af_sample_rate) + fir_decim = long (input_rate / self.af_sample_rate) # data point arrays for antenna tuner self.xdata = [] @@ -215,7 +210,7 @@ class MyFrame(wx.Frame): self.frequency = self.usrp_center # these map the frequency slider (0-6000) to the actual range self.f_slider_offset = self.f_lo - self.f_slider_scale = 10000/options.decim + self.f_slider_scale = 10000 self.spin_ctrl_1.SetRange(self.f_lo,self.f_hi) self.text_ctrl_1.SetValue(str(int(self.usrp_center))) self.slider_5.SetValue(0) @@ -245,40 +240,41 @@ class MyFrame(wx.Frame): else: self.PLAY_FROM_USRP = False if self.PLAY_FROM_USRP: - self.src = usrp.source_s(decim_rate=options.decim) - if options.rx_subdev_spec is None: - options.rx_subdev_spec = pick_subdevice(self.src) - self.src.set_mux(usrp.determine_rx_mux_value(self.src, options.rx_subdev_spec)) - self.subdev = usrp.selected_subdev(self.src, options.rx_subdev_spec) - self.src.tune(0, self.subdev, self.usrp_center) - self.tune_offset = 0 # -self.usrp_center - self.src.rx_freq(0) + options.address = "addr=192.168.11.2" + self.src = uhd.usrp_source(device_addr=options.address, + io_type=uhd.io_type.COMPLEX_FLOAT32, + num_channels=1) + self.src.set_samp_rate(input_rate) + input_rate = self.src.get_samp_rate() + + self.src.set_center_freq(self.usrp_center, 0) + self.tune_offset = 0 else: self.src = gr.file_source (gr.sizeof_short,options.input_file) self.tune_offset = 2200 # 2200 works for 3.5-4Mhz band + # convert rf data in interleaved short int form to complex + s2ss = gr.stream_to_streams(gr.sizeof_short,2) + s2f1 = gr.short_to_float() + s2f2 = gr.short_to_float() + src_f2c = gr.float_to_complex() + self.tb.connect(self.src,s2ss) + self.tb.connect((s2ss,0),s2f1) + self.tb.connect((s2ss,1),s2f2) + self.tb.connect(s2f1,(src_f2c,0)) + self.tb.connect(s2f2,(src_f2c,1)) + # save radio data to a file if SAVE_RADIO_TO_FILE: - file = gr.file_sink(gr.sizeof_short, options.radio_file) - self.tb.connect (self.src, file) + radio_file = gr.file_sink(gr.sizeof_short, options.radio_file) + self.tb.connect (self.src, radio_file) # 2nd DDC xlate_taps = gr.firdes.low_pass ( \ - 1.0, usb_rate, 16e3, 4e3, gr.firdes.WIN_HAMMING ) + 1.0, input_rate, 16e3, 4e3, gr.firdes.WIN_HAMMING ) self.xlate = gr.freq_xlating_fir_filter_ccf ( \ - fir_decim, xlate_taps, self.tune_offset, usb_rate ) - - # convert rf data in interleaved short int form to complex - s2ss = gr.stream_to_streams(gr.sizeof_short,2) - s2f1 = gr.short_to_float() - s2f2 = gr.short_to_float() - src_f2c = gr.float_to_complex() - self.tb.connect(self.src,s2ss) - self.tb.connect((s2ss,0),s2f1) - self.tb.connect((s2ss,1),s2f2) - self.tb.connect(s2f1,(src_f2c,0)) - self.tb.connect(s2f2,(src_f2c,1)) - + fir_decim, xlate_taps, self.tune_offset, input_rate ) # Complex Audio filter audio_coeffs = gr.firdes.complex_band_pass ( @@ -288,17 +284,22 @@ class MyFrame(wx.Frame): 0, # high cutoff 100, # transition gr.firdes.WIN_HAMMING) # window - self.slider_1.SetValue(0) - self.slider_2.SetValue(-3000) + self.slider_fcutoff_hi.SetValue(0) + self.slider_fcutoff_lo.SetValue(-3000) - self.audio_filter = gr.fir_filter_ccc ( 1, audio_coeffs) + self.audio_filter = gr.fir_filter_ccc(1, audio_coeffs) # Main +/- 16Khz spectrum display - self.fft = fftsink2.fft_sink_c (self.panel_2, fft_size=512, sample_rate=self.af_sample_rate, average=True, size=(640,240)) + self.fft = fftsink2.fft_sink_c(self.panel_2, fft_size=512, + sample_rate=self.af_sample_rate, + average=True, size=(640,240)) # AM Sync carrier if AM_SYNC_DISPLAY: - self.fft2 = fftsink.fft_sink_c (self.tb, self.panel_9, y_per_div=20, fft_size=512, sample_rate=self.af_sample_rate, average=True, size=(640,240)) + self.fft2 = fftsink.fft_sink_c(self.tb, self.panel_9, + y_per_div=20, fft_size=512, + sample_rate=self.af_sample_rate, + average=True, size=(640,240)) c2f = gr.complex_to_float() @@ -307,7 +308,8 @@ class MyFrame(wx.Frame): # the following frequencies turn out to be in radians/sample # gr.pll_refout_cc(alpha,beta,min_freq,max_freq) # suggested alpha = X, beta = .25 * X * X - pll = gr.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate),(2.*math.pi*6.5e3/self.af_sample_rate)) + pll = gr.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate), + (2.*math.pi*6.5e3/self.af_sample_rate)) self.pll_carrier_scale = gr.multiply_const_cc(complex(10,0)) am_det = gr.multiply_cc() # these are for converting +7.5kHz to -7.5kHz @@ -327,7 +329,7 @@ class MyFrame(wx.Frame): 100, # transition gr.firdes.WIN_HAMMING) # window - self.pll_carrier_filter = gr.fir_filter_ccc ( 1, pll_carrier_coeffs) + self.pll_carrier_filter = gr.fir_filter_ccc (1, pll_carrier_coeffs) self.sel_sb = gr.multiply_const_ff(1) combine = gr.add_ff() @@ -338,20 +340,29 @@ class MyFrame(wx.Frame): offset = gr.add_const_ff(1) agc = gr.divide_ff() - self.scale = gr.multiply_const_ff(0.00001) - dst = audio.sink(long(self.af_sample_rate)) + dst = audio.sink(long(self.af_sample_rate), + options.audio_output) + + + if self.PLAY_FROM_USRP: + self.tb.connect(self.src, self.xlate, self.fft) + else: + self.tb.connect(src_f2c, self.xlate, self.fft) - self.tb.connect(src_f2c,self.xlate,self.fft) self.tb.connect(self.xlate,self.audio_filter,self.sel_am,(am_det,0)) - self.tb.connect(self.sel_am,pll,self.pll_carrier_scale,self.pll_carrier_filter,c2f3) + self.tb.connect(self.sel_am,pll,self.pll_carrier_scale, + self.pll_carrier_filter,c2f3) self.tb.connect((c2f3,0),phaser1,(f2c,0)) self.tb.connect((c2f3,1),phaser2,(f2c,1)) self.tb.connect(f2c,(am_det,1)) self.tb.connect(am_det,c2f2,(combine,0)) - self.tb.connect(self.audio_filter,c2f,self.sel_sb,(combine,1)) + self.tb.connect(self.audio_filter,c2f, + self.sel_sb,(combine,1)) + if AM_SYNC_DISPLAY: self.tb.connect(self.pll_carrier_filter,self.fft2) + self.tb.connect(combine,self.scale) self.tb.connect(self.scale,(sqr1,0)) self.tb.connect(self.scale,(sqr1,1)) @@ -368,9 +379,9 @@ class MyFrame(wx.Frame): self.tb.start() # for mouse position reporting on fft display - em.eventManager.Register(self.Mouse, wx.EVT_MOTION, self.fft.win) + self.fft.win.Bind(wx.EVT_LEFT_UP, self.Mouse) # and left click to re-tune - em.eventManager.Register(self.Click, wx.EVT_LEFT_DOWN, self.fft.win) + self.fft.win.Bind(wx.EVT_LEFT_DOWN, self.Click) # start a timer to check for web commands if WEB_CONTROL: @@ -403,9 +414,9 @@ class MyFrame(wx.Frame): def __set_properties(self): # begin wxGlade: MyFrame.__set_properties - self.SetTitle("HF Explorer 2") - self.slider_1.SetMinSize((450, 38)) - self.slider_2.SetMinSize((450, 38)) + self.SetTitle("HF Explorer") + self.slider_fcutoff_hi.SetMinSize((450, 38)) + self.slider_fcutoff_lo.SetMinSize((450, 38)) self.panel_2.SetMinSize((640, 240)) self.button_7.SetValue(1) self.slider_3.SetMinSize((450, 19)) @@ -434,11 +445,14 @@ class MyFrame(wx.Frame): sizer_2.Add(self.button_4, 0, wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) grid_sizer_1.Add(self.button_5, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.slider_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) + grid_sizer_1.Add(self.slider_fcutoff_hi, 0, + wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.button_6, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.slider_2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) + grid_sizer_1.Add(self.slider_fcutoff_lo, 0, + wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) sizer_6.Add(self.panel_5, 1, wx.EXPAND, 0) - sizer_6.Add(self.label_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) + sizer_6.Add(self.label_1, 0, + wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) sizer_6.Add(self.text_ctrl_1, 0, wx.ADJUST_MINSIZE, 0) sizer_6.Add(self.panel_6, 1, wx.EXPAND, 0) sizer_6.Add(self.panel_7, 1, wx.EXPAND, 0) @@ -461,9 +475,11 @@ class MyFrame(wx.Frame): grid_sizer_1.Add(sizer_5, 1, wx.EXPAND, 0) grid_sizer_1.Add(self.panel_8, 1, wx.EXPAND, 0) grid_sizer_1.Add(self.panel_9, 1, wx.EXPAND, 0) - grid_sizer_1.Add(self.label_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) + grid_sizer_1.Add(self.label_3, 0, + wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.slider_6, 0, wx.ADJUST_MINSIZE, 0) - grid_sizer_1.Add(self.label_4, 0, wx.ALIGN_BOTTOM|wx.ADJUST_MINSIZE, 0) + grid_sizer_1.Add(self.label_4, 0, + wx.ALIGN_BOTTOM|wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.slider_7, 0, wx.ADJUST_MINSIZE, 0) grid_sizer_1.Add(self.panel_10, 1, wx.EXPAND, 0) sizer_7.Add(self.button_12, 0, wx.ADJUST_MINSIZE, 0) @@ -488,14 +504,14 @@ class MyFrame(wx.Frame): # Powermate being turned def on_rotate(self, event): if self.active_button == 5: - self.slider_1.SetValue(self.slider_1.GetValue()+event.delta) - if self.slider_2.GetValue() > (self.slider_1.GetValue() - 200) : - self.slider_2.SetValue(self.slider_1.GetValue() - 200) + self.slider_fcutoff_hi.SetValue(self.slider_fcutoff_hi.GetValue()+event.delta) + if self.slider_fcutoff_lo.GetValue() > (self.slider_fcutoff_hi.GetValue() - 200) : + self.slider_fcutoff_lo.SetValue(self.slider_fcutoff_hi.GetValue() - 200) self.filter() if self.active_button == 6: - self.slider_2.SetValue(self.slider_2.GetValue()+event.delta) - if self.slider_1.GetValue() < (self.slider_2.GetValue() + 200) : - self.slider_1.SetValue(self.slider_2.GetValue() + 200) + self.slider_fcutoff_lo.SetValue(self.slider_fcutoff_lo.GetValue()+event.delta) + if self.slider_fcutoff_hi.GetValue() < (self.slider_fcutoff_lo.GetValue() + 200) : + self.slider_fcutoff_hi.SetValue(self.slider_fcutoff_lo.GetValue() + 200) self.filter() if self.active_button == 7: new = max(0, min(6000, self.slider_3.GetValue() + event.delta)) @@ -581,14 +597,14 @@ class MyFrame(wx.Frame): # Make sure filter settings are legal def set_filter(self, event): slider = event.GetId() - slider1 = self.slider_1.GetValue() - slider2 = self.slider_2.GetValue() + slider1 = self.slider_fcutoff_hi.GetValue() + slider2 = self.slider_fcutoff_lo.GetValue() if slider == ID_SLIDER_1: - if slider2 > (self.slider_1.GetValue() - 200) : - self.slider_2.SetValue(slider1 - 200) + if slider2 > (self.slider_fcutoff_hi.GetValue() - 200) : + self.slider_fcutoff_lo.SetValue(slider1 - 200) elif slider == ID_SLIDER_2: - if slider1 < (self.slider_2.GetValue() + 200) : - self.slider_1.SetValue(slider2 + 200) + if slider1 < (self.slider_fcutoff_lo.GetValue() + 200) : + self.slider_fcutoff_hi.SetValue(slider2 + 200) self.filter() # Calculate taps and apply @@ -596,8 +612,8 @@ class MyFrame(wx.Frame): audio_coeffs = gr.firdes.complex_band_pass ( 1.0, # gain self.af_sample_rate, # sample rate - self.slider_2.GetValue(), # low cutoff - self.slider_1.GetValue(), # high cutoff + self.slider_fcutoff_lo.GetValue(), # low cutoff + self.slider_fcutoff_hi.GetValue(), # high cutoff 100, # transition gr.firdes.WIN_HAMMING) # window self.audio_filter.set_taps(audio_coeffs) @@ -607,8 +623,8 @@ class MyFrame(wx.Frame): self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) self.sel_sb.set_k(1) self.sel_am.set_k(0) - self.slider_1.SetValue(0) - self.slider_2.SetValue(-3000) + self.slider_fcutoff_hi.SetValue(0) + self.slider_fcutoff_lo.SetValue(-3000) self.filter() def set_usb(self, event): @@ -616,8 +632,8 @@ class MyFrame(wx.Frame): self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset)) self.sel_sb.set_k(1) self.sel_am.set_k(0) - self.slider_1.SetValue(3000) - self.slider_2.SetValue(0) + self.slider_fcutoff_hi.SetValue(3000) + self.slider_fcutoff_lo.SetValue(0) self.filter() def set_am(self, event): @@ -625,8 +641,8 @@ class MyFrame(wx.Frame): self.xlate.set_center_freq( self.usrp_center - (self.frequency - self.tune_offset - 7.5e3)) self.sel_sb.set_k(0) self.sel_am.set_k(1) - self.slider_1.SetValue(12500) - self.slider_2.SetValue(2500) + self.slider_fcutoff_hi.SetValue(12500) + self.slider_fcutoff_lo.SetValue(2500) self.filter() def set_cw(self, event): @@ -635,8 +651,8 @@ class MyFrame(wx.Frame): self.AM_mode = False self.sel_sb.set_k(1) self.sel_am.set_k(0) - self.slider_1.SetValue(-400) - self.slider_2.SetValue(-800) + self.slider_fcutoff_hi.SetValue(-400) + self.slider_fcutoff_lo.SetValue(-800) self.filter() def set_volume(self, event): @@ -644,7 +660,7 @@ class MyFrame(wx.Frame): def set_pga(self,event): if self.PLAY_FROM_USRP: - self.subdev.set_gain(self.slider_5.GetValue()) + self.src.set_gain(self.slider_5.GetValue()) def slide_tune(self, event): self.frequency = (self.f_slider_scale * self.slider_3.GetValue()) + self.f_slider_offset @@ -731,8 +747,11 @@ class MyFrame(wx.Frame): # Slider to set loop antenna capacitance def antenna_tune(self, evt): if self.PLAY_FROM_USRP: - self.src.write_aux_dac(0,3,self.slider_7.GetValue()) - + dev = self.src.get_dboard_iface() + dev.write_aux_dac(uhd.dboard_iface.UNIT_RX, + uhd.dboard_iface.AUX_DAC_C, + float(self.slider_7.GetValue())) + # Timer events - check for web commands def OnUpdate(self): cmds = os.listdir("/var/www/cgi-bin/commands/") @@ -791,11 +810,13 @@ class UpdateTimer(wx.Timer): class MyApp(wx.App): def OnInit(self): - frame = MyFrame(None, -1, "HF Explorer 2") + frame = MyFrame(None, -1, "HF Explorer") frame.Show(True) self.SetTopWindow(frame) return True -app = MyApp(0) -app.MainLoop() + +if __name__ == "__main__": + app = MyApp(0) + app.MainLoop() diff --git a/gnuradio-examples/python/apps/hf_explorer/hfx_help b/gr-uhd/apps/hf_explorer/hfx_help index 9a52dd2bb..9a52dd2bb 100644 --- a/gnuradio-examples/python/apps/hf_explorer/hfx_help +++ b/gr-uhd/apps/hf_explorer/hfx_help diff --git a/gnuradio-examples/python/apps/hf_radio/.gitignore b/gr-uhd/apps/hf_radio/.gitignore index b6950912c..b6950912c 100644 --- a/gnuradio-examples/python/apps/hf_radio/.gitignore +++ b/gr-uhd/apps/hf_radio/.gitignore diff --git a/gnuradio-examples/python/apps/hf_radio/Makefile.am b/gr-uhd/apps/hf_radio/Makefile.am index e514076f6..e514076f6 100644 --- a/gnuradio-examples/python/apps/hf_radio/Makefile.am +++ b/gr-uhd/apps/hf_radio/Makefile.am diff --git a/gnuradio-examples/python/apps/hf_radio/README.TXT b/gr-uhd/apps/hf_radio/README.TXT index 7c7edf5e0..7c7edf5e0 100644 --- a/gnuradio-examples/python/apps/hf_radio/README.TXT +++ b/gr-uhd/apps/hf_radio/README.TXT diff --git a/gnuradio-examples/python/apps/hf_radio/hfir.sci b/gr-uhd/apps/hf_radio/hfir.sci index a2d5e2a62..a2d5e2a62 100644 --- a/gnuradio-examples/python/apps/hf_radio/hfir.sci +++ b/gr-uhd/apps/hf_radio/hfir.sci diff --git a/gnuradio-examples/python/apps/hf_radio/input.py b/gr-uhd/apps/hf_radio/input.py index 5984d8254..5984d8254 100644 --- a/gnuradio-examples/python/apps/hf_radio/input.py +++ b/gr-uhd/apps/hf_radio/input.py diff --git a/gnuradio-examples/python/apps/hf_radio/output.py b/gr-uhd/apps/hf_radio/output.py index dc9caf528..dc9caf528 100644 --- a/gnuradio-examples/python/apps/hf_radio/output.py +++ b/gr-uhd/apps/hf_radio/output.py diff --git a/gnuradio-examples/python/apps/hf_radio/radio.py b/gr-uhd/apps/hf_radio/radio.py index 9f444b916..9f444b916 100755 --- a/gnuradio-examples/python/apps/hf_radio/radio.py +++ b/gr-uhd/apps/hf_radio/radio.py diff --git a/gnuradio-examples/python/apps/hf_radio/radio.xml b/gr-uhd/apps/hf_radio/radio.xml index 81daa19b0..81daa19b0 100644 --- a/gnuradio-examples/python/apps/hf_radio/radio.xml +++ b/gr-uhd/apps/hf_radio/radio.xml diff --git a/gnuradio-examples/python/apps/hf_radio/ssb_taps b/gr-uhd/apps/hf_radio/ssb_taps index 0ef3bbf26..0ef3bbf26 100644 --- a/gnuradio-examples/python/apps/hf_radio/ssb_taps +++ b/gr-uhd/apps/hf_radio/ssb_taps diff --git a/gnuradio-examples/python/apps/hf_radio/ssbagc.py b/gr-uhd/apps/hf_radio/ssbagc.py index fdf40bc6b..fdf40bc6b 100644 --- a/gnuradio-examples/python/apps/hf_radio/ssbagc.py +++ b/gr-uhd/apps/hf_radio/ssbagc.py diff --git a/gnuradio-examples/python/apps/hf_radio/ssbdemod.py b/gr-uhd/apps/hf_radio/ssbdemod.py index c73567b66..c73567b66 100644 --- a/gnuradio-examples/python/apps/hf_radio/ssbdemod.py +++ b/gr-uhd/apps/hf_radio/ssbdemod.py diff --git a/gnuradio-examples/python/apps/hf_radio/startup.py b/gr-uhd/apps/hf_radio/startup.py index 093369b57..093369b57 100644 --- a/gnuradio-examples/python/apps/hf_radio/startup.py +++ b/gr-uhd/apps/hf_radio/startup.py diff --git a/gnuradio-examples/python/apps/hf_radio/ui.py b/gr-uhd/apps/hf_radio/ui.py index 71b73c128..71b73c128 100755 --- a/gnuradio-examples/python/apps/hf_radio/ui.py +++ b/gr-uhd/apps/hf_radio/ui.py |