made siggen cooperate with sinks without bw range

soapy_support
Marcus Müller 7 years ago committed by Dimitri Stolnikov
parent 84249efbea
commit 20a5986ca0
  1. 23
      apps/osmocom_siggen
  2. 44
      apps/osmocom_siggen_base.py

@ -164,16 +164,19 @@ class app_gui(pubsub):
)
freq_hbox.AddSpacer(5)
forms.slider(
parent=self.panel, sizer=freq_hbox,
proportion=2,
ps=self.tb,
key=osmocom_siggen.TX_FREQ_KEY,
minimum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].start(),
maximum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].stop(),
num_steps=101,
)
freq_hbox.AddSpacer(3)
try:
forms.slider(
parent=self.panel, sizer=freq_hbox,
proportion=2,
ps=self.tb,
key=osmocom_siggen.TX_FREQ_KEY,
minimum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].start(),
maximum=self.tb[osmocom_siggen.FREQ_RANGE_KEY].stop(),
num_steps=101,
)
freq_hbox.AddSpacer(3)
except:
pass
corr_hbox.AddSpacer(3)
forms.text_box(

@ -218,22 +218,40 @@ class top_block(gr.top_block, pubsub):
print 'Supported sample rates %d-%d step %d.' % (rates.start(), rates.stop(), rates.step())
# Set the antenna
if self._verbose:
print "setting antenna..."
if(options.antenna):
ant = self._sink.set_antenna(options.antenna, 0)
if self._verbose:
print "Set antenna to:", ant
try:
self.publish(FREQ_RANGE_KEY, self._sink.get_freq_range)
except:
print "Couldn't publish %s" % FREQ_RANGE_KEY
self.publish(FREQ_RANGE_KEY, self._sink.get_freq_range)
for name in self.get_gain_names():
self.publish(GAIN_RANGE_KEY(name), (lambda self=self,name=name: self._sink.get_gain_range(name)))
self.publish(BWIDTH_RANGE_KEY, self._sink.get_bandwidth_range)
try:
for name in self.get_gain_names():
self.publish(GAIN_RANGE_KEY(name), (lambda self=self,name=name: self._sink.get_gain_range(name)))
except:
print "Couldn't publish %s" % FREQ_RANGE_KEY
for name in self.get_gain_names():
self.publish(GAIN_KEY(name), (lambda self=self,name=name: self._sink.get_gain(name)))
try:
self.publish(BWIDTH_RANGE_KEY, self._sink.get_bandwidth_range)
except:
if self._verbose:
print "Couldn't publish %s" % BWIDTH_RANGE_KEY
self.publish(BWIDTH_KEY, self._sink.get_bandwidth)
try:
for name in self.get_gain_names():
self.publish(GAIN_KEY(name), (lambda self=self,name=name: self._sink.get_gain(name)))
except:
if self._verbose:
print "Couldn't publish GAIN_KEYs"
try:
self.publish(BWIDTH_KEY, self._sink.get_bandwidth)
except:
if self._verbose:
print "Couldn't publish %s" % BWIDTH_KEY
def get_gain_names(self):
return self._sink.get_gain_names()
@ -273,7 +291,13 @@ class top_block(gr.top_block, pubsub):
print "Set " + name + " gain to:", gain
def set_bandwidth(self, bw):
clipped_bw = self[BWIDTH_RANGE_KEY].clip(bw)
try:
clipped_bw = self[BWIDTH_RANGE_KEY].clip(bw)
except:
if self._verbose:
print "couldn't clip bandwidth"
return
if self._sink.get_bandwidth() != clipped_bw:
bw = self._sink.set_bandwidth(clipped_bw)

Loading…
Cancel
Save