[Peak Manager]
- added debug prefix. If debug prefix is empty - no debug output git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@532 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -27,13 +27,14 @@ class peak_manager(gr.basic_block):
|
||||
"""
|
||||
docstring for block peak_manager
|
||||
"""
|
||||
def __init__(self, numPeaksMax):
|
||||
def __init__(self, numPeaksMax, debugPrefix):
|
||||
gr.basic_block.__init__(self,
|
||||
name="peak_manager",
|
||||
in_sig=None,
|
||||
out_sig=None)
|
||||
|
||||
self.numPeaksMax = numPeaksMax
|
||||
self.debugPrefix = debugPrefix
|
||||
self.peak_dict = {}
|
||||
self.ports_avail = []
|
||||
self.ports_used = []
|
||||
@@ -113,7 +114,8 @@ class peak_manager(gr.basic_block):
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("gain"), pmt.from_float(1.0))
|
||||
portname = peakEntry['port_name']
|
||||
self.message_port_pub(pmt.intern(portname), msg_dict)
|
||||
print ("Updated peak #{} at {:0.6f} MHz on port {}".format(id, freq_MHz, portname))
|
||||
if len(self.debugPrefix) > 0:
|
||||
print ("{}: Updated peak #{} at {:0.6f} MHz on port {}".format(self.debugPrefix, id, freq_MHz, portname))
|
||||
else:
|
||||
peakEntry = self.peak_add(peak_key, peakMsg)
|
||||
if peakEntry is not None:
|
||||
@@ -123,14 +125,16 @@ class peak_manager(gr.basic_block):
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("gain"), pmt.from_float(1.0))
|
||||
portname = peakEntry['port_name']
|
||||
self.message_port_pub(pmt.intern(portname), msg_dict)
|
||||
print ("New peak #{} at {:0.6f} MHz on port {}".format(id, freq_MHz, portname))
|
||||
if len(self.debugPrefix) > 0:
|
||||
print ("{}: New peak #{} at {:0.6f} MHz on port {}".format(self.debugPrefix, id, freq_MHz, portname))
|
||||
else:
|
||||
if peakEntry is not None:
|
||||
pair = pmt.cons(pmt.intern("gain"), pmt.from_float(0.0))
|
||||
portname = peakEntry['port_name']
|
||||
self.message_port_pub(pmt.intern(portname), pair)
|
||||
if self.peak_del(peak_key):
|
||||
print ("Lost peak #{} at {:0.2f} MHz on port {}".format(id, freq_MHz, portname))
|
||||
if len(self.debugPrefix) > 0:
|
||||
print ("{}: Lost peak #{} at {:0.6f} MHz on port {}".format(self.debugPrefix, id, freq_MHz, portname))
|
||||
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user