- peak detect: update of peaks without smooting
- send message of existent peak changes (frequency, pos) - peak manager: added freq message output for channelizer git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@493 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -319,8 +319,15 @@ namespace gr {
|
||||
{
|
||||
if (temp[j].isInRange(peak))
|
||||
{
|
||||
temp[j].merge(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,18 +149,23 @@ namespace jay {
|
||||
return pbh > 0;
|
||||
}
|
||||
|
||||
const Peak& merge(const Peak &other)
|
||||
bool update(const Peak &other)
|
||||
{
|
||||
float beta = 0.5f;
|
||||
float alpha = (1.f-beta);
|
||||
float pos_f = alpha*(float)pos + beta*(float)other.pos;
|
||||
float pbh_f = alpha*(float)pbh + beta*(float)other.pbh;
|
||||
float frequency = alpha*(float)frequency + beta*(float)other.frequency;
|
||||
pos = (int)(pos_f + 0.5f);
|
||||
pbh = (int)(pbh_f + 0.5f);
|
||||
bool changed = false;
|
||||
if (pos != other.pos)
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
if (std::abs(frequency-other.frequency) >= (0.01*1e6))
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
frequency = other.frequency;
|
||||
pos = other.pos;
|
||||
pbh = other.pbh;
|
||||
height_rel = other.height_rel;
|
||||
height_abs = other.height_abs;
|
||||
return *this;
|
||||
return changed;
|
||||
}
|
||||
|
||||
int left() const
|
||||
|
||||
Reference in New Issue
Block a user