Peak Manager

- renamed ports to status[0..N]
- emiut gain messages 

PekaDetect
- emit peak messages also on peak height changes

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@499 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-05-29 09:58:23 +00:00
parent b665890f9e
commit a50f613991
4 changed files with 123 additions and 60 deletions
+19 -15
View File
@@ -293,6 +293,7 @@ namespace gr {
{
Peak &peak = m_peakHistory[j];
peak.heightUpdate_rel(m_pXds, nitems_per_block);
peak.heightUpdate_abs(m_pXs, nitems_per_block);
if (peak.height_rel >= (m_peak_height_min-10.f))
{
@@ -300,46 +301,49 @@ namespace gr {
}
else
{
// Output OFF-tags
pmt::pmt_t dict = peak.msg(0);
peak.setState(0);
// Output tags
pmt::pmt_t dict = peak.msg();
message_port_pub(m_msg_port_out, dict);
add_item_tag(DATA, nitems_written(DATA) + k, pmt::string_to_symbol(std::string("peak")), dict, m_tag_id);
}
}
for (int i = 0; i < m_peakList.size(); i++)
{
Peak &peak = m_peakList[i];
peak.heightUpdate_rel(m_pXds, nitems_per_block);
peak.heightUpdate_abs(m_pXs, nitems_per_block);
bool found = false;
for (int j=0; j < temp.size(); j++)
{
if (temp[j].isInRange(peak))
{
bool changed = temp[j].update(peak);
found = true;
if (changed)
{
pmt::pmt_t dict = temp[j].msg(1);
message_port_pub(m_msg_port_out, dict);
add_item_tag(DATA, nitems_written(DATA) + k, pmt::string_to_symbol(std::string("peak")), dict, m_tag_id);
}
break;
}
}
if (!found)
{
peak.setState(1);
temp.push_back(peak);
// Output ON-tags
pmt::pmt_t dict = peak.msg(1);
message_port_pub(m_msg_port_out, dict);
add_item_tag(DATA, nitems_written(DATA) + k, pmt::string_to_symbol(std::string("peak")), dict, m_tag_id);
}
}
for (int j=0; j < temp.size(); j++)
{
Peak &peak = temp[j];
if (peak.isModified)
{
pmt::pmt_t dict = peak.msg();
message_port_pub(m_msg_port_out, dict);
add_item_tag(DATA, nitems_written(DATA) + k, pmt::string_to_symbol(std::string("peak")), dict, m_tag_id);
}
}
m_peakHistory.clear();
m_peakHistory = temp;