[Peak Manager]
- adaptions to new messages from Peak Detector git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@530 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -100,7 +100,7 @@ class peak_manager(gr.basic_block):
|
||||
peakMsg[key_str] = value
|
||||
|
||||
id = peakMsg['id']
|
||||
freq_MHz = peakMsg['freq_Hz']*1e-6
|
||||
freq_MHz = peakMsg['freq_abs_Hz']*1e-6
|
||||
|
||||
peak_key = 'peak' + str(id)
|
||||
peakEntry = self.peak_get(peak_key)
|
||||
@@ -108,20 +108,22 @@ class peak_manager(gr.basic_block):
|
||||
if peakMsg['state'] == 1:
|
||||
if peakEntry is not None:
|
||||
msg_dict = pmt.make_dict()
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq"), pmt.from_float(peakMsg['freq_Hz']))
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq_rel_Hz"), pmt.from_float(peakMsg['freq_rel_Hz']))
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq_abs_Hz"), pmt.from_float(peakMsg['freq_abs_Hz']))
|
||||
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.2f} MHz on port {}".format(id, freq_MHz, portname))
|
||||
print ("Updated peak #{} at {:0.6f} MHz on port {}".format(id, freq_MHz, portname))
|
||||
else:
|
||||
peakEntry = self.peak_add(peak_key, peakMsg)
|
||||
if peakEntry is not None:
|
||||
msg_dict = pmt.make_dict()
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq"), pmt.from_float(peakMsg['freq_Hz']))
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq_rel_Hz"), pmt.from_float(peakMsg['freq_rel_Hz']))
|
||||
msg_dict = pmt.dict_add(msg_dict, pmt.intern("freq_abs_Hz"), pmt.from_float(peakMsg['freq_abs_Hz']))
|
||||
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.2f} MHz on port {}".format(id, freq_MHz, portname))
|
||||
print ("New peak #{} at {:0.6f} MHz on port {}".format(id, freq_MHz, portname))
|
||||
else:
|
||||
if peakEntry is not None:
|
||||
pair = pmt.cons(pmt.intern("gain"), pmt.from_float(0.0))
|
||||
|
||||
Reference in New Issue
Block a user