[Peak Detector]
- send peak width change messages git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@536 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -285,7 +285,7 @@ namespace gr {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
float freq_shift_Hz = m_bandwidth * (float)(pos-m_vlen/2)/m_vlen;
|
float freq_shift_Hz = m_bandwidth * (float)(pos-m_vlen/2)/m_vlen;
|
||||||
Peak peak(m_peak_id++, pos, m_fcenter, freq_shift_Hz);
|
Peak peak(m_peak_id++, pos, m_bandwidth/m_vlen, m_fcenter, freq_shift_Hz);
|
||||||
peak.height_rel = m_pXds[pos];
|
peak.height_rel = m_pXds[pos];
|
||||||
addToListByPos(peaks, peak);
|
addToListByPos(peaks, peak);
|
||||||
numPeaksClimbed++;
|
numPeaksClimbed++;
|
||||||
|
|||||||
@@ -31,21 +31,22 @@ namespace jay {
|
|||||||
struct Peak
|
struct Peak
|
||||||
{
|
{
|
||||||
Peak()
|
Peak()
|
||||||
: Peak(0, 0, 0, 0.0, 0.0, 0.0, 0.0)
|
: Peak(0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
Peak(uint64_t _id, int _pos, float fcenter, float frequency)
|
Peak(uint64_t _id, int _pos, float bandwidth, float fcenter, float frequency)
|
||||||
: Peak(_id, _pos, 0, fcenter, frequency, 0.0, 0.0)
|
: Peak(_id, _pos, 0, bandwidth, fcenter, frequency, 0.0, 0.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
Peak(uint64_t _id, int _pos, int _pbh, float _fcenter, float _frequency, float _height_rel, float _height_abs)
|
Peak(uint64_t _id, int _pos, int _pbh, float _frequency_resolution, float _fcenter, float _frequency, float _height_rel, float _height_abs)
|
||||||
: id(_id)
|
: id(_id)
|
||||||
, isModified(false)
|
, isModified(false)
|
||||||
, state(0)
|
, state(0)
|
||||||
, pos(_pos)
|
, pos(_pos)
|
||||||
, pbh(_pbh)
|
, pbh(_pbh)
|
||||||
|
, frequency_resolution(_frequency_resolution)
|
||||||
, fcenter(_fcenter)
|
, fcenter(_fcenter)
|
||||||
, frequency(_frequency)
|
, frequency(_frequency)
|
||||||
, height_rel(_height_rel)
|
, height_rel(_height_rel)
|
||||||
@@ -64,6 +65,7 @@ namespace jay {
|
|||||||
float height_abs;
|
float height_abs;
|
||||||
float height_rel_last;
|
float height_rel_last;
|
||||||
float height_abs_last;
|
float height_abs_last;
|
||||||
|
float frequency_resolution;
|
||||||
float fcenter;
|
float fcenter;
|
||||||
float frequency;
|
float frequency;
|
||||||
|
|
||||||
@@ -217,6 +219,10 @@ namespace jay {
|
|||||||
{
|
{
|
||||||
isModified = true;
|
isModified = true;
|
||||||
}
|
}
|
||||||
|
if (pbh != other.pbh)
|
||||||
|
{
|
||||||
|
isModified = true;
|
||||||
|
}
|
||||||
fcenter = other.fcenter;
|
fcenter = other.fcenter;
|
||||||
frequency = other.frequency;
|
frequency = other.frequency;
|
||||||
pos = other.pos;
|
pos = other.pos;
|
||||||
@@ -241,6 +247,7 @@ namespace jay {
|
|||||||
pmt::pmt_t dict = pmt::make_dict();
|
pmt::pmt_t dict = pmt::make_dict();
|
||||||
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("id")), pmt::from_long(id));
|
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("id")), pmt::from_long(id));
|
||||||
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("pos")), pmt::from_long(pos));
|
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("pos")), pmt::from_long(pos));
|
||||||
|
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("pbh_Hz")), pmt::from_float((float)pbh*frequency_resolution));
|
||||||
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("freq_abs_Hz")), pmt::from_float(fcenter + frequency));
|
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("freq_abs_Hz")), pmt::from_float(fcenter + frequency));
|
||||||
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("freq_rel_Hz")), pmt::from_float(frequency));
|
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("freq_rel_Hz")), pmt::from_float(frequency));
|
||||||
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("level_abs")), pmt::from_float(height_abs));
|
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("level_abs")), pmt::from_float(height_abs));
|
||||||
|
|||||||
Reference in New Issue
Block a user