Change gain on the fly.
This commit is contained in:
parent
a528f375f7
commit
c878d80e28
@ -139,7 +139,7 @@ class mainwindow(QtGui.QMainWindow):
|
||||
|
||||
#hook up parameter-changed signals so we can change gain, rate, etc. while running
|
||||
self.ui.combo_rate.currentIndexChanged['QString'].connect(self.update_sample_rate)
|
||||
# self.ui.
|
||||
self.ui.line_gain.editingFinished.connect(self.update_gain)
|
||||
|
||||
#hook up live data text box update signal
|
||||
self.live_data_changed_signal.connect(self.on_append_live_data)
|
||||
@ -153,6 +153,10 @@ class mainwindow(QtGui.QMainWindow):
|
||||
if self.running:
|
||||
self._radio.set_rate(int(float(rate)*1e6))
|
||||
|
||||
def update_gain(self):
|
||||
if self.running:
|
||||
self._radio.set_gain(float(self.ui.line_gain.text()))
|
||||
|
||||
############ widget update functions for non-mapped widgets ############
|
||||
def update_heading_widget(self, index):
|
||||
if index.model() is not None:
|
||||
|
@ -110,13 +110,17 @@ class modes_radio (gr.top_block, pubsub):
|
||||
parser.add_option_group(group)
|
||||
|
||||
def live_source(self):
|
||||
return self._options.source is 'uhd' or self._options.source is 'osmocom'
|
||||
return self._options.source=="uhd" or self._options.source=="osmocom"
|
||||
|
||||
def set_freq(self, freq):
|
||||
return self._u.set_center_freq(freq, 0) if self.live_source() else 0
|
||||
|
||||
def set_gain(self, gain):
|
||||
return self._u.set_gain(gain) if self.live_source() else 0
|
||||
if self.live_source():
|
||||
self._u.set_gain(gain)
|
||||
print "Gain is %f" % self.get_gain()
|
||||
|
||||
return self.get_gain()
|
||||
|
||||
def set_rate(self, rate):
|
||||
self._rx_path.set_rate(rate)
|
||||
@ -126,13 +130,13 @@ class modes_radio (gr.top_block, pubsub):
|
||||
self._rx_path.set_threshold(threshold)
|
||||
|
||||
def get_freq(self, freq):
|
||||
return self._u.get_center_freq(freq, 0) if live_source() else 1090e6
|
||||
return self._u.get_center_freq(freq, 0) if self.live_source() else 1090e6
|
||||
|
||||
def get_gain(self, gain):
|
||||
return self._u.get_gain() if live_source() else 0
|
||||
def get_gain(self):
|
||||
return self._u.get_gain() if self.live_source() else 0
|
||||
|
||||
def get_rate(self, rate):
|
||||
return self._u.get_rate() if live_source() else self._rate
|
||||
def get_rate(self):
|
||||
return self._u.get_rate() if self.live_source() else self._rate
|
||||
|
||||
def _setup_source(self, options):
|
||||
if options.source == "uhd":
|
||||
|
Loading…
Reference in New Issue
Block a user