add knobs for IF and BB gain too
This commit is contained in:
parent
93078a8cae
commit
7a55e7a643
@ -59,6 +59,8 @@ class modes_radio (gr.top_block, pubsub):
|
||||
#now subscribe to set various options via pubsub
|
||||
self.subscribe("freq", self.set_freq)
|
||||
self.subscribe("gain", self.set_gain)
|
||||
self.subscribe("bb_gain", self.set_bb_gain)
|
||||
self.subscribe("if_gain", self.set_if_gain)
|
||||
self.subscribe("rate", self.set_rate)
|
||||
self.subscribe("rate", self._rx_path.set_rate)
|
||||
self.subscribe("threshold", self._rx_path.set_threshold)
|
||||
@ -66,6 +68,8 @@ class modes_radio (gr.top_block, pubsub):
|
||||
|
||||
self.publish("freq", self.get_freq)
|
||||
self.publish("gain", self.get_gain)
|
||||
self.publish("bb_gain", self.get_bb_gain)
|
||||
self.publish("if_gain", self.get_if_gain)
|
||||
self.publish("rate", self.get_rate)
|
||||
self.publish("threshold", self._rx_path.get_threshold)
|
||||
self.publish("pmf", self._rx_path.get_pmf)
|
||||
@ -107,6 +111,10 @@ class modes_radio (gr.top_block, pubsub):
|
||||
help="set receive frequency in Hz [default=%default]", metavar="FREQ")
|
||||
group.add_option("-g", "--gain", type="int", default=None,
|
||||
help="set RF gain", metavar="dB")
|
||||
group.add_option("-i", "--if_gain", type="int", default=None,
|
||||
help="set IF gain", metavar="dB")
|
||||
group.add_option("-b", "--bb_gain", type="int", default=None,
|
||||
help="set BB gain", metavar="dB")
|
||||
|
||||
#RX path args
|
||||
group.add_option("-r", "--rate", type="eng_float", default=4e6,
|
||||
@ -129,9 +137,21 @@ class modes_radio (gr.top_block, pubsub):
|
||||
def set_gain(self, gain):
|
||||
if self.live_source():
|
||||
self._u.set_gain(gain)
|
||||
print "Gain is %f" % self.get_gain()
|
||||
print "RF Gain is %f" % self.get_gain()
|
||||
return self.get_gain()
|
||||
|
||||
def set_bb_gain(self, bb_gain):
|
||||
if self.live_source():
|
||||
self._u.set_bb_gain(bb_gain)
|
||||
print "BB Gain is %f" % _bb_gain
|
||||
return self.get_bb_gain()
|
||||
|
||||
def set_if_gain(self, if_gain):
|
||||
if self.live_source():
|
||||
self._u.set_if_gain(if_gain)
|
||||
print "IF Gain is %f" % if_gain
|
||||
return self.get_if_gain()
|
||||
|
||||
def set_rate(self, rate):
|
||||
if(rate < 4e6 and self._rate > 4e6):
|
||||
raise NotImplementedError("Lowering rate <4e6Msps not currently supported.")
|
||||
@ -157,6 +177,12 @@ class modes_radio (gr.top_block, pubsub):
|
||||
def get_gain(self):
|
||||
return self._u.get_gain() if self.live_source() else 0
|
||||
|
||||
def get_bb_gain(self):
|
||||
return self._u.get_bb_gain() if self.live_source() else 0
|
||||
|
||||
def get_if_gain(self):
|
||||
return self._u.get_if_gain() if self.live_source() else 0
|
||||
|
||||
def get_rate(self):
|
||||
return self._u.get_rate() if self.live_source() else self._rate
|
||||
|
||||
@ -206,7 +232,15 @@ class modes_radio (gr.top_block, pubsub):
|
||||
if options.gain is None:
|
||||
options.gain = 34
|
||||
self._u.set_gain(options.gain)
|
||||
print "Gain is %i" % self._u.get_gain()
|
||||
print "RF Gain is %i" % self._u.get_gain()
|
||||
if options.bb_gain is None:
|
||||
options.bb_gain = 34
|
||||
self._u.set_bb_gain(options.bb_gain)
|
||||
print "BB Gain is %i" % options.bb_gain
|
||||
if options.if_gain is None:
|
||||
options.if_gain = 34
|
||||
self._u.set_if_gain(options.if_gain)
|
||||
print "Gain is %i" % options.if_gain
|
||||
|
||||
#Note: this should only come into play if using an RTLSDR.
|
||||
# lpfiltcoeffs = gr.firdes.low_pass(1, 5*3.2e6, 1.6e6, 300e3)
|
||||
|
Loading…
Reference in New Issue
Block a user