commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11451 - gnuradio/trunk/gr-qtgui/src/python


From: trondeau
Subject: [Commit-gnuradio] r11451 - gnuradio/trunk/gr-qtgui/src/python
Date: Thu, 16 Jul 2009 20:25:58 -0600 (MDT)

Author: trondeau
Date: 2009-07-16 20:25:57 -0600 (Thu, 16 Jul 2009)
New Revision: 11451

Modified:
   gnuradio/trunk/gr-qtgui/src/python/usrp2_display.py
   gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.py
   gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.ui
Log:
Adding a check box to cancel DC offset

Modified: gnuradio/trunk/gr-qtgui/src/python/usrp2_display.py
===================================================================
--- gnuradio/trunk/gr-qtgui/src/python/usrp2_display.py 2009-07-17 00:36:11 UTC 
(rev 11450)
+++ gnuradio/trunk/gr-qtgui/src/python/usrp2_display.py 2009-07-17 02:25:57 UTC 
(rev 11451)
@@ -61,6 +61,8 @@
         # Add the qtsnk widgets to the layout box
         self.gui.sinkLayout.addWidget(snk)
 
+        self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001))
+
         # Connect up some signals
         self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"),
                      self.pauseFg)
@@ -77,6 +79,11 @@
                      self.saveData)
         self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save)
 
+        self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"),
+                     self.dcGainEditText)
+        self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"),
+                     self.dcCancelClicked)
+
     def pauseFg(self):
         if(self.gui.pauseButton.text() == "Pause"):
             self.fg.stop()
@@ -145,6 +152,14 @@
         if(len(fileName)):
             self.fg.save_to_file(str(fileName))
 
+    def dcGainEditText(self):
+        gain = float(self.gui.dcGainEdit.text())
+        self.fg.set_dc_gain(gain)
+        
+    def dcCancelClicked(self, state):
+        self.dcGainEditText()
+        self.fg.cancel_dc(state)
+        
 
         
 class my_top_block(gr.top_block):
@@ -201,6 +216,12 @@
         self.amp = gr.multiply_const_cc(0.0)
         self.set_amplifier_gain(100)
 
+        # Create a single-pole IIR filter to remove DC
+        #   but don't connect it yet
+        self.dc_gain = 0.001
+        self.dc = gr.single_pole_iir_filter_cc(self.dc_gain)
+        self.dc_sub = gr.sub_cc()
+
         self.connect(self.u, self.amp, self.snk)
 
         if self.show_debug_info:
@@ -224,16 +245,13 @@
 
 
     def save_to_file(self, name):
-        # Pause the flow graph
-        self.stop()
-        self.wait()
+        self.lock()
 
         # Add file sink to save data
         self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name)
         self.connect(self.amp, self.file_sink)
 
-        # Restart flow graph
-        self.start()
+        self.unlock()
 
     def set_gain(self, gain):
         self._gain = gain
@@ -259,9 +277,29 @@
             pass
 
     def set_amplifier_gain(self, amp):
-            self._amp_value = amp
-            self.amp.set_k(self._amp_value)
+        self._amp_value = amp
+        self.amp.set_k(self._amp_value)
 
+    def set_dc_gain(self, gain):
+        self.dc.set_taps(gain)
+        
+    def cancel_dc(self, state):
+        self.lock()
+
+        if(state):
+            self.disconnect(self.u, self.amp)
+            self.connect(self.u, (self.dc_sub,0))
+            self.connect(self.u, self.dc, (self.dc_sub,1))
+            self.connect(self.dc_sub, self.amp)
+        else:
+            self.disconnect(self.dc_sub, self.amp)
+            self.disconnect(self.dc, (self.dc_sub,1))
+            self.disconnect(self.u, self.dc)
+            self.disconnect(self.u, (self.dc_sub,0))
+            self.connect(self.u, self.amp)
+
+        self.unlock()
+
 def main ():
     tb = my_top_block()
     tb.start()

Modified: gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.py
===================================================================
--- gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.py    2009-07-17 
00:36:11 UTC (rev 11450)
+++ gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.py    2009-07-17 
02:25:57 UTC (rev 11451)
@@ -2,7 +2,7 @@
 
 # Form implementation generated from reading ui file 'usrp_display_qtgui.ui'
 #
-# Created: Sun Jul  5 13:05:46 2009
+# Created: Thu Jul 16 22:06:24 2009
 #      by: PyQt4 UI code generator 4.4.3
 #
 # WARNING! All changes made in this file will be lost!
@@ -82,12 +82,37 @@
         self.amplifierEdit.setObjectName("amplifierEdit")
         self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, 
self.amplifierEdit)
         self.horizontalLayout_2.addWidget(self.groupBox)
-        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, 
QtGui.QSizePolicy.Minimum)
-        self.horizontalLayout_2.addItem(spacerItem)
+        self.frame_2 = QtGui.QFrame(self.centralwidget)
+        self.frame_2.setMinimumSize(QtCore.QSize(200, 0))
+        self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel)
+        self.frame_2.setFrameShadow(QtGui.QFrame.Raised)
+        self.frame_2.setObjectName("frame_2")
+        self.verticalLayoutWidget = QtGui.QWidget(self.frame_2)
+        self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, -1, 191, 151))
+        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
+        self.verticalLayout_3 = QtGui.QVBoxLayout(self.verticalLayoutWidget)
+        self.verticalLayout_3.setObjectName("verticalLayout_3")
+        self.dcCancelCheckBox = QtGui.QCheckBox(self.verticalLayoutWidget)
+        self.dcCancelCheckBox.setObjectName("dcCancelCheckBox")
+        self.verticalLayout_3.addWidget(self.dcCancelCheckBox)
+        self.horizontalLayout = QtGui.QHBoxLayout()
+        self.horizontalLayout.setObjectName("horizontalLayout")
+        self.dcGainLabel = QtGui.QLabel(self.verticalLayoutWidget)
+        self.dcGainLabel.setObjectName("dcGainLabel")
+        self.horizontalLayout.addWidget(self.dcGainLabel)
+        self.dcGainEdit = QtGui.QLineEdit(self.verticalLayoutWidget)
+        self.dcGainEdit.setObjectName("dcGainEdit")
+        self.horizontalLayout.addWidget(self.dcGainEdit)
+        self.verticalLayout_3.addLayout(self.horizontalLayout)
+        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, 
QtGui.QSizePolicy.Expanding)
+        self.verticalLayout_3.addItem(spacerItem)
+        self.horizontalLayout_2.addWidget(self.frame_2)
+        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, 
QtGui.QSizePolicy.Minimum)
+        self.horizontalLayout_2.addItem(spacerItem1)
         self.verticalLayout = QtGui.QVBoxLayout()
         self.verticalLayout.setObjectName("verticalLayout")
-        spacerItem1 = QtGui.QSpacerItem(20, 80, QtGui.QSizePolicy.Minimum, 
QtGui.QSizePolicy.Fixed)
-        self.verticalLayout.addItem(spacerItem1)
+        spacerItem2 = QtGui.QSpacerItem(20, 80, QtGui.QSizePolicy.Minimum, 
QtGui.QSizePolicy.Fixed)
+        self.verticalLayout.addItem(spacerItem2)
         self.pauseButton = QtGui.QPushButton(self.centralwidget)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, 
QtGui.QSizePolicy.Fixed)
         sizePolicy.setHorizontalStretch(0)
@@ -156,6 +181,8 @@
         self.gainLabel.setText(QtGui.QApplication.translate("MainWindow", "RF 
Gain", None, QtGui.QApplication.UnicodeUTF8))
         self.bandwidthLabel.setText(QtGui.QApplication.translate("MainWindow", 
"Bandwidth", None, QtGui.QApplication.UnicodeUTF8))
         self.amplifierLabel.setText(QtGui.QApplication.translate("MainWindow", 
"Amplifier", None, QtGui.QApplication.UnicodeUTF8))
+        
self.dcCancelCheckBox.setText(QtGui.QApplication.translate("MainWindow", 
"Cancel DC", None, QtGui.QApplication.UnicodeUTF8))
+        self.dcGainLabel.setText(QtGui.QApplication.translate("MainWindow", 
"DC Canceller Gain", None, QtGui.QApplication.UnicodeUTF8))
         self.pauseButton.setText(QtGui.QApplication.translate("MainWindow", 
"Pause", None, QtGui.QApplication.UnicodeUTF8))
         self.closeButton.setText(QtGui.QApplication.translate("MainWindow", 
"Close", None, QtGui.QApplication.UnicodeUTF8))
         self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", 
"&File", None, QtGui.QApplication.UnicodeUTF8))

Modified: gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.ui
===================================================================
--- gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.ui    2009-07-17 
00:36:11 UTC (rev 11450)
+++ gnuradio/trunk/gr-qtgui/src/python/usrp_display_qtgui.ui    2009-07-17 
02:25:57 UTC (rev 11451)
@@ -146,6 +146,68 @@
        </widget>
       </item>
       <item>
+       <widget class="QFrame" name="frame_2" >
+        <property name="minimumSize" >
+         <size>
+          <width>200</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="frameShape" >
+         <enum>QFrame::StyledPanel</enum>
+        </property>
+        <property name="frameShadow" >
+         <enum>QFrame::Raised</enum>
+        </property>
+        <widget class="QWidget" name="verticalLayoutWidget" >
+         <property name="geometry" >
+          <rect>
+           <x>10</x>
+           <y>-1</y>
+           <width>191</width>
+           <height>151</height>
+          </rect>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_3" >
+          <item>
+           <widget class="QCheckBox" name="dcCancelCheckBox" >
+            <property name="text" >
+             <string>Cancel DC</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout" >
+            <item>
+             <widget class="QLabel" name="dcGainLabel" >
+              <property name="text" >
+               <string>DC Canceller Gain</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLineEdit" name="dcGainEdit" />
+            </item>
+           </layout>
+          </item>
+          <item>
+           <spacer name="verticalSpacer_2" >
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeHint" stdset="0" >
+             <size>
+              <width>20</width>
+              <height>40</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </widget>
+       </widget>
+      </item>
+      <item>
        <spacer name="horizontalSpacer" >
         <property name="orientation" >
          <enum>Qt::Horizontal</enum>





reply via email to

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