commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11662 - gnuradio/branches/developers/cswiger/wip/gnur


From: cswiger
Subject: [Commit-gnuradio] r11662 - gnuradio/branches/developers/cswiger/wip/gnuradio-examples/python/apps/hf_explorer
Date: Wed, 11 Nov 2009 12:21:54 -0700 (MST)

Author: cswiger
Date: 2009-11-11 12:21:54 -0700 (Wed, 11 Nov 2009)
New Revision: 11662

Modified:
   
gnuradio/branches/developers/cswiger/wip/gnuradio-examples/python/apps/hf_explorer/hfx2.py
Log:
Put in a few quick updates to fix mouse events on the fft display


Modified: 
gnuradio/branches/developers/cswiger/wip/gnuradio-examples/python/apps/hf_explorer/hfx2.py
===================================================================
--- 
gnuradio/branches/developers/cswiger/wip/gnuradio-examples/python/apps/hf_explorer/hfx2.py
  2009-11-11 18:56:51 UTC (rev 11661)
+++ 
gnuradio/branches/developers/cswiger/wip/gnuradio-examples/python/apps/hf_explorer/hfx2.py
  2009-11-11 19:21:54 UTC (rev 11662)
@@ -2,7 +2,7 @@
 # -*- 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 2009 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -60,6 +60,21 @@
 #                                                       
 #----------------------------------------------------------------------
 #
+# 11/11/2009 - Updating to work with changes in gnuradio-3.2.2
+#   Event manager registered mouse events (tooltip readout, click to tune)
+#   broken - this is all done in fftsink2 (fftsink_nongl on my system) now.
+#   Tooltips exist, so we set the fft display baseband_freq every change
+#   to radio center frequency and it not only displays the freq AND signal
+#   level, but the entire grids moves around. Downside is there is no
+#   'center' zero-beat reticule tuning mark. Attempts to draw static lines
+#   on the plot canvas have been thwarted by the 'auto' scale.
+#   Also click-to-tune somewhat works - it jumps to another frequency not
+#   always the one desires. Probably the same 'auto' scaling returning funny
+#   numbers
+#
+#   Usable, but playback from a recorded RF data file makes very jerky fft?
+#   
+#
 # Versions 2.2.1 adds loop antenna automatic tuner
 #
 # 2.3.1 adds web control, made AM Sync display optional,
@@ -294,7 +309,7 @@
         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, 
baseband_freq=self.frequency, fft_size=512, sample_rate=self.af_sample_rate, 
average=True, size=(640,240))
 
        # AM Sync carrier 
        if AM_SYNC_DISPLAY:
@@ -368,9 +383,14 @@
         self.tb.start()
 
         # for mouse position reporting on fft display
-        em.eventManager.Register(self.Mouse, wx.EVT_MOTION, self.fft.win)
+        # This is done in fftsink2.fft_sink_c now - all the app need do is set
+       # the fft baseband_freq 
+       #
         # and left click to re-tune
-        em.eventManager.Register(self.Click, wx.EVT_LEFT_DOWN, self.fft.win)
+       # This actually works. Need to re-jigger the magic numbers or get
+       # them from self.fft
+        # em.eventManager.Register(self.Click, wx.EVT_LEFT_DOWN, self.fft.win)
+       self.fft.win.plot.Bind(wx.EVT_LEFT_UP,self.Click)
 
         # start a timer to check for web commands
         if WEB_CONTROL:
@@ -504,8 +524,10 @@
            self.spin_ctrl_1.SetValue(self.frequency)
           if self.AM_mode == False:
              self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset))
+            self.fft.set_baseband_freq(self.frequency)
           else:
             self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset - 7.5e3))
+            self.fft.set_baseband_freq(self.frequency-7.5e3)
           if self.button_12.GetValue():
              self.auto_antenna_tune()
        if self.active_button == 8:
@@ -605,6 +627,7 @@
     def set_lsb(self, event):
        self.AM_mode = False
        self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset))
+       self.fft.set_baseband_freq(self.frequency)
        self.sel_sb.set_k(1)
        self.sel_am.set_k(0)
        self.slider_1.SetValue(0)
@@ -614,6 +637,7 @@
     def set_usb(self, event):
        self.AM_mode = False
        self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset))
+       self.fft.set_baseband_freq(self.frequency)
        self.sel_sb.set_k(1)
        self.sel_am.set_k(0)
        self.slider_1.SetValue(3000)
@@ -623,6 +647,7 @@
     def set_am(self, event):
        self.AM_mode = True
        self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset - 7.5e3))
+       self.fft.set_baseband_freq(self.frequency - 7.5e3)
        self.sel_sb.set_k(0)
        self.sel_am.set_k(1)
        self.slider_1.SetValue(12500)
@@ -632,6 +657,7 @@
     def set_cw(self, event):
        self.AM_mode = False
        self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset))
+       self.fft.set_baseband_freq(self.frequency)
        self.AM_mode = False
        self.sel_sb.set_k(1)
        self.sel_am.set_k(0)
@@ -650,8 +676,10 @@
         self.frequency = (self.f_slider_scale * self.slider_3.GetValue()) + 
self.f_slider_offset
        if self.AM_mode == False:
           self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset))
+         self.fft.set_baseband_freq(self.frequency)
        else:
          self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset - 7.5e3))
+         self.fft.set_baseband_freq(self.frequency-7.5e3)
         self.spin_ctrl_1.SetValue(self.frequency)
        if self.button_12.GetValue():
           self.auto_antenna_tune()
@@ -660,8 +688,10 @@
        self.frequency = self.spin_ctrl_1.GetValue()
        if self.AM_mode == False:
            self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset))
+          self.fft.set_baseband_freq(self.frequency)
        else:
           self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset - 7.5e3))
+          self.fft.set_baseband_freq(self.frequency-7.5e3)
         
self.slider_3.SetValue(int((self.frequency-self.f_slider_offset)/self.f_slider_scale))
        if self.button_12.GetValue():
           self.auto_antenna_tune()
@@ -676,17 +706,11 @@
        if self.PLAY_FROM_USRP == False:
           self.src.seek(-10000000,gr.SEEK_CUR)
 
-    # Mouse over fft display - show frequency in tooltip
-    def Mouse(self,event):
-       if self.AM_mode:
-          fRel = ( event.GetX() - 330. ) / 14.266666 - 7.5
-       else:
-          fRel = ( event.GetX() - 330. ) / 14.266666 
-        
self.fft.win.SetToolTip(wx.ToolTip(eng_notation.num_to_str(self.frequency + 
(fRel*1e3))))
-
     # Mouse clicked on fft display - change frequency 
+    # This actually works! just need to redo the magic numbers or get them
+    # from self.fft
     def Click(self,event):
-        fRel = ( event.GetX() - 330. ) / 14.266666
+        fRel = ( event.GetX() - 355. ) / 14.266666
        if self.AM_mode == False:
            self.frequency = self.frequency + (fRel*1e3)
        else:
@@ -695,8 +719,10 @@
         
self.slider_3.SetValue(int((self.frequency-self.f_slider_offset)/self.f_slider_scale))
         if self.AM_mode == False:
           self.xlate.set_center_freq ( self.usrp_center - ( self.frequency - 
self.tune_offset ))
+          self.fft.set_baseband_freq(self.frequency)
        else:
           self.xlate.set_center_freq( self.usrp_center - (self.frequency - 
self.tune_offset - 7.5e3))
+          self.fft.set_baseband_freq(self.frequency-7.5e3)
 
     # Set power of AM sync carrier
     def am_carrier(self,event):
@@ -751,8 +777,10 @@
                  self.auto_antenna_tune()
                if self.AM_mode:
                  self.xlate.set_center_freq ( self.usrp_center - ( 
self.frequency - self.tune_offset - 7.5e3 ))
+                self.fft.set_baseband_freq(self.frequency-7.5e3)
                else:
                  self.xlate.set_center_freq ( self.usrp_center - ( 
self.frequency - self.tune_offset ))
+                self.fft.set_baseband_freq(self.frequency)
 
         if cmds[0]=='chvolume':
           fd=open("/var/www/cgi-bin/commands/chvolume","r")





reply via email to

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