[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:
2019-06-01 10:12:03 +00:00
parent a4626e99fc
commit d6390820da
2 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -285,7 +285,7 @@ namespace gr {
else
{
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];
addToListByPos(peaks, peak);
numPeaksClimbed++;
+11 -4
View File
@@ -31,21 +31,22 @@ namespace jay {
struct 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(_id, _pos, 0, fcenter, frequency, 0.0, 0.0)
Peak(uint64_t _id, int _pos, float bandwidth, float fcenter, float frequency)
: 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)
, isModified(false)
, state(0)
, pos(_pos)
, pbh(_pbh)
, frequency_resolution(_frequency_resolution)
, fcenter(_fcenter)
, frequency(_frequency)
, height_rel(_height_rel)
@@ -64,6 +65,7 @@ namespace jay {
float height_abs;
float height_rel_last;
float height_abs_last;
float frequency_resolution;
float fcenter;
float frequency;
@@ -217,6 +219,10 @@ namespace jay {
{
isModified = true;
}
if (pbh != other.pbh)
{
isModified = true;
}
fcenter = other.fcenter;
frequency = other.frequency;
pos = other.pos;
@@ -241,6 +247,7 @@ namespace jay {
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("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_rel_Hz")), pmt::from_float(frequency));
dict = pmt::dict_add(dict, pmt::string_to_symbol(std::string("level_abs")), pmt::from_float(height_abs));