- cleaned up from debug output
- fixed peak change mechanism git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@506 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -78,17 +78,21 @@ namespace gr {
|
||||
|
||||
void message_debug_impl::set_msg(pmt::pmt_t msg)
|
||||
{
|
||||
if (pmt::is_pair(msg))
|
||||
{
|
||||
print_pair(msg);
|
||||
}
|
||||
else if (pmt::is_dict(msg))
|
||||
if (pmt::is_dict(msg))
|
||||
{
|
||||
pmt::pmt_t items = pmt::dict_items(msg);
|
||||
for (int i = 0; i < pmt::length(items); i++)
|
||||
try
|
||||
{
|
||||
pmt::pmt_t pair = pmt::nth(i, items);
|
||||
print_pair(pair);
|
||||
size_t len_items = pmt::length(items);
|
||||
for (int i=0; i < len_items; i++)
|
||||
{
|
||||
pmt::pmt_t pair = pmt::nth(i, items);
|
||||
print_pair(pair);
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
print_pair(msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -278,8 +278,8 @@ namespace gr {
|
||||
|
||||
if (!intersection)
|
||||
{
|
||||
peak.height_rel = m_pXds[peak.pos];
|
||||
peak.height_abs = m_pXs[peak.pos];
|
||||
peak.heightUpdate_rel(m_pXds, nitems_per_block);
|
||||
peak.heightUpdate_abs(m_pXs, nitems_per_block);
|
||||
m_peakList.push_back(peak);
|
||||
}
|
||||
}
|
||||
@@ -313,14 +313,14 @@ namespace gr {
|
||||
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))
|
||||
{
|
||||
temp[j].update(peak);
|
||||
temp[j].setState(1);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,9 @@ namespace jay {
|
||||
, pbh(_pbh)
|
||||
, frequency(_frequency)
|
||||
, height_rel(_height_rel)
|
||||
, height_rel_last(_height_rel)
|
||||
, height_abs(_height_abs)
|
||||
, height_abs_last(_height_abs)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -59,6 +61,8 @@ namespace jay {
|
||||
int pbh;
|
||||
float height_rel;
|
||||
float height_abs;
|
||||
float height_rel_last;
|
||||
float height_abs_last;
|
||||
float frequency;
|
||||
|
||||
bool isInRange(const Peak &other) const
|
||||
@@ -92,10 +96,11 @@ namespace jay {
|
||||
pos = newPos;
|
||||
}
|
||||
|
||||
if (std::fabs(height_rel-newHeight) >= 3.0f)
|
||||
height_rel = newHeight;
|
||||
if (std::fabs(height_rel_last-newHeight) >= 1.0f)
|
||||
{
|
||||
isModified = true;
|
||||
height_rel = newHeight;
|
||||
height_rel_last = height_rel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,14 +123,16 @@ namespace jay {
|
||||
if (pos != newPos)
|
||||
{
|
||||
isModified = true;
|
||||
height_abs = newHeight;
|
||||
pos = newPos;
|
||||
}
|
||||
|
||||
if (std::fabs(height_abs-newHeight) >= 3.0f)
|
||||
height_abs = newHeight;
|
||||
if (std::fabs(height_abs_last-newHeight) >= 1.0f)
|
||||
{
|
||||
isModified = true;
|
||||
height_rel = newHeight;
|
||||
height_abs_last = height_abs;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,12 +201,14 @@ namespace jay {
|
||||
|
||||
bool update(const Peak &other)
|
||||
{
|
||||
if (std::fabs(height_rel-other.height_rel) >= 3.0f)
|
||||
if (std::fabs(height_rel_last-other.height_rel) >= 1.0f)
|
||||
{
|
||||
height_rel_last = other.height_rel;
|
||||
isModified = true;
|
||||
}
|
||||
if (std::fabs(height_abs-other.height_abs) >= 3.0f)
|
||||
if (std::fabs(height_abs-other.height_abs) >= 1.0f)
|
||||
{
|
||||
height_abs_last = other.height_abs;
|
||||
isModified = true;
|
||||
}
|
||||
if (pos != other.pos)
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace gr {
|
||||
// Check pair for data
|
||||
if (pmt::symbol_to_string(key) == std::string("gain"))
|
||||
{
|
||||
float gain_dB = pmt::to_float(val) - 40.f;
|
||||
float gain_dB = pmt::to_float(val) - 50.f;
|
||||
m_gain_target = std::pow(10.f, gain_dB/10);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user