commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10844 - gnuradio/branches/developers/trondeau/qtdevel


From: trondeau
Subject: [Commit-gnuradio] r10844 - gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python
Date: Tue, 14 Apr 2009 20:10:00 -0600 (MDT)

Author: trondeau
Date: 2009-04-14 20:10:00 -0600 (Tue, 14 Apr 2009)
New Revision: 10844

Modified:
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp2_display.py
   
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp_display.py
Log:
Set the frequency range of the display

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp2_display.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp2_display.py
 2009-04-15 02:08:37 UTC (rev 10843)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp2_display.py
 2009-04-15 02:10:00 UTC (rev 10844)
@@ -41,13 +41,19 @@
         self.resize(800, 500)
 
 class control_panel(QtGui.QWidget):
-    def __init__(self, usrp, parent=None):
+    def __init__(self, usrp, qtsink, parent=None):
         QtGui.QWidget.__init__(self, parent)
         self.setWindowTitle('USRP2 Control Panel')
 
         self.usrp = usrp
+        self.qtsink = qtsink
         self.adc_rate = self.usrp.adc_rate()
-        
+
+        self.freq = 0
+        self.decim = 0
+        self.bw = 0
+        self.gain = 0
+         
         self.setToolTip('Set the values of the USRP2')
         QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
 
@@ -97,6 +103,7 @@
             freq = eng_notation.str_to_num(self.freqEdit.text().toAscii())
             r = self.usrp.set_center_freq(freq)
             self.freq = freq
+            self.qtsink.set_frequency_range(self.freq, self.freq-self.bw/2.0, 
self.freq+self.bw/2.0)
         except RuntimeError:
             pass
 
@@ -116,6 +123,11 @@
         try:
             decim = int(self.decimEdit.text())
             self.usrp.set_decim(decim)
+
+            self.decim = decim
+            self.bw = self.adc_rate / self.decim
+            self.qtsink.set_frequency_range(-self.bw/2.0, self.bw/2.0, 
self.freq)           
+            
         except ValueError:
             pass
 
@@ -179,7 +191,7 @@
             print "D'board: ", self.u.daughterboard_id()
 
 
-        self.ctrl_win = control_panel(self.u)
+        self.ctrl_win = control_panel(self.u, self.snk)
 
         self.ctrl_win.set_frequency(options.freq)
         self.ctrl_win.set_gain(options.gain)

Modified: 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp_display.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp_display.py
  2009-04-15 02:08:37 UTC (rev 10843)
+++ 
gnuradio/branches/developers/trondeau/qtdevel2/gr-qtgui/src/python/usrp_display.py
  2009-04-15 02:10:00 UTC (rev 10844)
@@ -21,14 +21,20 @@
         self.resize(800, 500)
 
 class control_panel(QtGui.QWidget):
-    def __init__(self, usrp, subdev, parent=None):
+    def __init__(self, usrp, subdev, qtsink, parent=None):
         QtGui.QWidget.__init__(self, parent)
         self.setWindowTitle('USRP Control Panel')
 
         self.usrp = usrp
         self.subdev = subdev
+        self.qtsink = qtsink
         self.adc_rate = self.usrp.converter_rate()
-        
+
+        self.freq = 0
+        self.decim = 0
+        self.bw = 0
+        self.gain = 0
+
         self.setToolTip('Set the values of the USRP')
         QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
 
@@ -78,6 +84,7 @@
             freq = eng_notation.str_to_num(self.freqEdit.text().toAscii())
             self.usrp.tune(0, self.subdev, freq)
             self.freq = freq
+            self.qtsink.set_frequency_range(self.freq, self.freq-self.bw/2.0, 
self.freq+self.bw/2.0)
         except RuntimeError:
             pass
 
@@ -97,6 +104,11 @@
         try:
             decim = int(self.decimEdit.text())
             self.usrp.set_decim_rate(decim)
+
+            self.decim = decim
+            self.bw = self.adc_rate / self.decim
+            self.qtsink.set_frequency_range(-self.bw/2.0, self.bw/2.0, 
self.freq)           
+
         except ValueError:
             pass
 
@@ -173,7 +185,7 @@
         amp = gr.multiply_const_cc(0.001)
         self.connect(self.u, amp, self.snk)
 
-        self.ctrl_win = control_panel(self.u, self.subdev)
+        self.ctrl_win = control_panel(self.u, self.subdev, self.snk)
 
         self.ctrl_win.set_frequency(options.freq)
         self.ctrl_win.set_gain(options.gain)





reply via email to

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