discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] gain slider issues


From: Eric Hill Matlis
Subject: Re: [Discuss-gnuradio] gain slider issues
Date: Fri, 27 Oct 2006 10:34:59 -0400 (EDT)

Thanks Chuck!

That works nicely.  Much appreciated.

eric

************************************
Eric H. Matlis, Ph.D.
Aerospace & Mechanical Engineering Dept.
120 Hessert Center for Aerospace Research
University of Notre Dame
Notre Dame, IN 46556-5684
Phone: (574) 631-6054
Fax:   (574) 631-8355

On Thu, 26 Oct 2006, Charles Swiger wrote:

On Thu, 2006-10-26 at 16:00 -0400, Eric Hill Matlis wrote:
I'm having some python coding issues with a slider I'm trying to
implement.  The code is based on usrp_wfm_rcv_pll.py, which uses the
powermate to adjust either frequency or volume.  I would like to replace
the volume slider with a gain slider, which exists in the original but
which is not controlled by the powermate.

My code is below, and the symptoms are that while the new gain slider
moves, the value shown does not update until I click the powermate button
to switch to frequency control.  Any suggestions?


Hi Eric - All you need is to put an "update_status_bar()" in the
knob rotate handler. Change this:


     def on_rotate (self, event):
         self.rot += event.delta
         if (self.state == "FREQ"):
             if self.rot >= 3:
                 self.set_freq(self.freq + .001e6)
                 self.rot -= 3
             elif self.rot <=-3:
                 self.set_freq(self.freq - .001e6)
                 self.rot += 3
         else:
             step = self.subdev.gain_range()[2]
             if self.rot >= 3:
                 self.set_gain(self.gain + step)
                 self.rot -= 3
             elif self.rot <=-3:
                 self.set_gain(self.gain - step)
                 self.rot += 3


To this:

   def on_rotate (self, event):
       self.rot += event.delta
       if (self.state == "FREQ"):
           if self.rot >= 3:
               self.set_freq(self.freq + .001e6)
               self.rot -= 3
           elif self.rot <=-3:
               self.set_freq(self.freq - .001e6)
               self.rot += 3
       else:
           step = self.subdev.gain_range()[2]
           if self.rot >= 3:
               self.set_gain(self.gain + step)
               self.rot -= 3
           elif self.rot <=-3:
               self.set_gain(self.gain - step)
               self.rot += 3
           self.update_status_bar ()



Then it works, and will update the gain displayed in the status bar on
every call to on_rotate() when gain is being adjusted.


--Chuck








reply via email to

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