commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11316 - gnuradio/trunk/gnuradio-examples/python/usrp


From: jcorgan
Subject: [Commit-gnuradio] r11316 - gnuradio/trunk/gnuradio-examples/python/usrp
Date: Tue, 30 Jun 2009 10:49:31 -0600 (MDT)

Author: jcorgan
Date: 2009-06-30 10:49:31 -0600 (Tue, 30 Jun 2009)
New Revision: 11316

Modified:
   gnuradio/trunk/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py
Log:
Fixes ticket:372

Modified: gnuradio/trunk/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py 
2009-06-30 02:33:37 UTC (rev 11315)
+++ gnuradio/trunk/gnuradio-examples/python/usrp/usrp_wfm_rcv2_nogui.py 
2009-06-30 16:49:31 UTC (rev 11316)
@@ -30,6 +30,18 @@
 import sys
 import math
 
+def calc_dxc_freq(target_freq, baseband_freq, fs):
+   dxc_temp = (target_freq - baseband_freq) % fs
+
+   if dxc_temp < fs/2.0:
+       dxc_freq = - dxc_temp
+       inverted = False
+   else:
+       dxc_freq = fs - dxc_temp
+       inverted = True
+
+   return (dxc_freq, inverted)
+
 def pick_subdevice(u):
     """
     The user didn't specify a subdevice on the command line.
@@ -123,7 +135,7 @@
 
         mid_freq = (f[0] + f[1]) / 2
         # set front end PLL to middle frequency
-        ok, baseband_freq = self.subdev.set_freq(mid_freq)
+        tune_result = self.subdev.set_freq(mid_freq)
 
         for n in range(2):
             chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
@@ -132,8 +144,8 @@
             self.connect((di, n), chan_filt)
             self.connect(chan_filt, guts, volume_control)
             self.connect(volume_control, (audio_sink, n))
-            dxc_freq, inverted = usrp.calc_dxc_freq(f[n], baseband_freq,
-                                                    self.u.converter_rate())
+            dxc_freq, inverted = calc_dxc_freq(f[n], tune_result.baseband_freq,
+                                               self.u.converter_rate())
             self.u.set_rx_freq(n, dxc_freq)
         
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]