- added and modified
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@505 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -94,15 +94,12 @@ class peak_manager(gr.basic_block):
|
||||
if pmt.is_integer(val):
|
||||
value = pmt.to_long(val)
|
||||
peakMsg[key_str] = value
|
||||
# print("{}={}".format(key_str, value))
|
||||
elif pmt.is_real(val):
|
||||
value = pmt.to_float(val)
|
||||
peakMsg[key_str] = value
|
||||
# print("{}={}".format(key_str, value))
|
||||
elif pmt.is_bool(val):
|
||||
value = pmt.to_bool(val)
|
||||
peakMsg[key_str] = value
|
||||
# print("{}={}".format(key_str, value))
|
||||
|
||||
id = peakMsg['id']
|
||||
freq_MHz = peakMsg['freq_Hz']*1e-6
|
||||
@@ -114,20 +111,20 @@ class peak_manager(gr.basic_block):
|
||||
if peakEntry is not None:
|
||||
portname = peakEntry['port_name']
|
||||
print("Update " + peak_key + "(" + portname + ")")
|
||||
pair = pmt.cons(pmt.intern("freq"), pmt.from_float(peakMsg['freq_Hz']))
|
||||
self.message_port_pub(pmt.intern(portname), pair)
|
||||
pair = pmt.cons(pmt.intern("gain"), pmt.from_float(-peakMsg['height']))
|
||||
self.message_port_pub(pmt.intern(portname), pair)
|
||||
msg_dict = pmt.make_dict()
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq"), pmt.from_double(peakMsg['freq_Hz']))
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("gain"), pmt.from_double(-peakMsg['height']))
|
||||
self.message_port_pub(pmt.intern(portname), msg_dict)
|
||||
else:
|
||||
print ("New peak #{} at {:0.2f} MHz".format(id, freq_MHz))
|
||||
peakEntry = self.peak_add(peak_key, peakMsg)
|
||||
if peakEntry is not None:
|
||||
portname = peakEntry['port_name']
|
||||
print("Added " + peak_key + "(" + portname + ")")
|
||||
pair = pmt.cons(pmt.intern("freq"), pmt.from_float(peakMsg['freq_Hz']))
|
||||
self.message_port_pub(pmt.intern(portname), pair)
|
||||
pair = pmt.cons(pmt.intern("gain"), pmt.from_float(-peakMsg['height']))
|
||||
self.message_port_pub(pmt.intern(portname), pair)
|
||||
msg_dict = pmt.make_dict()
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq"), pmt.from_double(peakMsg['freq_Hz']))
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("gain"), pmt.from_double(-peakMsg['height']))
|
||||
self.message_port_pub(pmt.intern(portname), msg_dict)
|
||||
else:
|
||||
if peakEntry is not None:
|
||||
print ("Lost peak #{} at {:0.2f} MHz".format(id, freq_MHz))
|
||||
|
||||
Reference in New Issue
Block a user