[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 11/16: blocks: more fixups to peak_detector
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 11/16: blocks: more fixups to peak_detector2. |
Date: |
Sun, 26 Apr 2015 23:18:03 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 94292039e47805b87255a0baf8e6c5f33c81b823
Author: Tom Rondeau <address@hidden>
Date: Wed Apr 22 11:48:32 2015 -0400
blocks: more fixups to peak_detector2.
Fixes some issues from setting parameters while running.
---
gr-blocks/examples/CMakeLists.txt | 1 +
gr-blocks/examples/peak_detector2.grc | 788 ++++++++++++++++----------------
gr-blocks/lib/peak_detector2_fb_impl.cc | 83 ++--
gr-blocks/lib/peak_detector2_fb_impl.h | 10 +-
4 files changed, 457 insertions(+), 425 deletions(-)
diff --git a/gr-blocks/examples/CMakeLists.txt
b/gr-blocks/examples/CMakeLists.txt
index bb07cdc..0ecf9d7 100644
--- a/gr-blocks/examples/CMakeLists.txt
+++ b/gr-blocks/examples/CMakeLists.txt
@@ -20,6 +20,7 @@
install(
FILES
matrix_multiplexer.grc
+ peak_detector2.grc
vector_source_with_tags.grc
DESTINATION ${GR_PKG_DATA_DIR}/examples/blocks
COMPONENT "runtime_python"
diff --git a/gr-blocks/examples/peak_detector2.grc
b/gr-blocks/examples/peak_detector2.grc
index 6c62ac5..c49febd 100644
--- a/gr-blocks/examples/peak_detector2.grc
+++ b/gr-blocks/examples/peak_detector2.grc
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='ASCII'?>
-<?grc format='1' created='3.7.7'?>
+<?grc format='1' created='3.7.8'?>
<flow_graph>
<timestamp>Wed Apr 8 18:17:58 2015</timestamp>
<block>
@@ -66,7 +66,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(10, 10)</value>
+ <value>(16, 11)</value>
</param>
<param>
<key>_rotation</key>
@@ -77,7 +77,7 @@
<key>variable</key>
<param>
<key>id</key>
- <value>alpha</value>
+ <value>factor</value>
</param>
<param>
<key>_enabled</key>
@@ -85,7 +85,7 @@
</param>
<param>
<key>value</key>
- <value>0.001</value>
+ <value>0.3</value>
</param>
<param>
<key>alias</key>
@@ -97,7 +97,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(624, 69)</value>
+ <value>(264, 11)</value>
</param>
<param>
<key>_rotation</key>
@@ -108,7 +108,7 @@
<key>variable</key>
<param>
<key>id</key>
- <value>lookahead</value>
+ <value>alpha</value>
</param>
<param>
<key>_enabled</key>
@@ -116,7 +116,7 @@
</param>
<param>
<key>value</key>
- <value>int(samp_rate/1e3/1.1)</value>
+ <value>0.001</value>
</param>
<param>
<key>alias</key>
@@ -128,7 +128,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(424, 69)</value>
+ <value>(440, 11)</value>
</param>
<param>
<key>_rotation</key>
@@ -139,7 +139,7 @@
<key>variable</key>
<param>
<key>id</key>
- <value>factor</value>
+ <value>lookahead</value>
</param>
<param>
<key>_enabled</key>
@@ -147,7 +147,7 @@
</param>
<param>
<key>value</key>
- <value>0.3</value>
+ <value>int(samp_rate/1e3/1.1)</value>
</param>
<param>
<key>alias</key>
@@ -159,7 +159,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(296, 69)</value>
+ <value>(352, 11)</value>
</param>
<param>
<key>_rotation</key>
@@ -190,7 +190,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(48, 101)</value>
+ <value>(176, 11)</value>
</param>
<param>
<key>_rotation</key>
@@ -198,10 +198,10 @@
</param>
</block>
<block>
- <key>analog_sig_source_x</key>
+ <key>qtgui_time_sink_x</key>
<param>
<key>id</key>
- <value>analog_sig_source_x_0</value>
+ <value>qtgui_time_sink_x_0</value>
</param>
<param>
<key>_enabled</key>
@@ -212,338 +212,328 @@
<value>float</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>waveform</key>
- <value>analog.GR_COS_WAVE</value>
- </param>
- <param>
- <key>freq</key>
- <value>1000</value>
+ <key>name</key>
+ <value>""</value>
</param>
<param>
- <key>amp</key>
- <value>1</value>
+ <key>ylabel</key>
+ <value>Amplitude</value>
</param>
<param>
- <key>offset</key>
- <value>0</value>
+ <key>yunit</key>
+ <value>""</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>size</key>
+ <value>512</value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>grid</key>
+ <value>True</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>autoscale</key>
+ <value>False</value>
</param>
<param>
- <key>comment</key>
- <value></value>
+ <key>ymin</key>
+ <value>-1.5</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(24, 184)</value>
+ <key>ymax</key>
+ <value>1.5</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>nconnections</key>
+ <value>3</value>
</param>
- </block>
- <block>
- <key>blocks_add_const_vxx</key>
<param>
- <key>id</key>
- <value>blocks_add_const_vxx_0</value>
+ <key>update_time</key>
+ <value>0.10</value>
</param>
<param>
- <key>_enabled</key>
+ <key>entags</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>const</key>
- <value>0.1</value>
+ <key>gui_hint</key>
+ <value></value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_AUTO</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>tr_level</key>
+ <value>0.0</value>
</param>
<param>
- <key>minoutbuf</key>
+ <key>tr_delay</key>
<value>0</value>
</param>
<param>
- <key>maxoutbuf</key>
+ <key>tr_chan</key>
<value>0</value>
</param>
<param>
- <key>comment</key>
- <value></value>
+ <key>tr_tag</key>
+ <value>""</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(320, 212)</value>
+ <key>ctrlpanel</key>
+ <value>True</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>legend</key>
+ <value>True</value>
</param>
- </block>
- <block>
- <key>blocks_throttle</key>
<param>
- <key>id</key>
- <value>blocks_throttle_0</value>
+ <key>label1</key>
+ <value>Input</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>width1</key>
+ <value>1</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>color1</key>
+ <value>"blue"</value>
</param>
<param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
+ <key>style1</key>
+ <value>1</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>marker1</key>
+ <value>-1</value>
</param>
<param>
- <key>ignoretag</key>
- <value>True</value>
+ <key>alpha1</key>
+ <value>1.0</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>label2</key>
+ <value>Peaks</value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>width2</key>
+ <value>1</value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>color2</key>
+ <value>"red"</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>style2</key>
+ <value>1</value>
</param>
<param>
- <key>comment</key>
- <value></value>
+ <key>marker2</key>
+ <value>-1</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(560, 172)</value>
+ <key>alpha2</key>
+ <value>1.0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>label3</key>
+ <value>Average</value>
</param>
- </block>
- <block>
- <key>blocks_peak_detector2_fb</key>
<param>
- <key>id</key>
- <value>blocks_peak_detector2_fb_0</value>
+ <key>width3</key>
+ <value>1</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>color3</key>
+ <value>"green"</value>
</param>
<param>
- <key>threshold_factor_rise</key>
- <value>factor</value>
+ <key>style3</key>
+ <value>1</value>
</param>
<param>
- <key>look_ahead</key>
- <value>lookahead</value>
+ <key>marker3</key>
+ <value>-1</value>
</param>
<param>
- <key>alpha</key>
- <value>alpha</value>
+ <key>alpha3</key>
+ <value>1.0</value>
</param>
<param>
- <key>alias</key>
+ <key>label4</key>
<value></value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>width4</key>
+ <value>1</value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>color4</key>
+ <value>"black"</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>style4</key>
+ <value>1</value>
</param>
<param>
- <key>comment</key>
- <value></value>
+ <key>marker4</key>
+ <value>-1</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(160, 374)</value>
+ <key>alpha4</key>
+ <value>1.0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>label5</key>
+ <value></value>
</param>
- </block>
- <block>
- <key>blocks_char_to_float</key>
<param>
- <key>id</key>
- <value>blocks_char_to_float_0</value>
+ <key>width5</key>
+ <value>1</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>color5</key>
+ <value>"cyan"</value>
</param>
<param>
- <key>vlen</key>
+ <key>style5</key>
<value>1</value>
</param>
<param>
- <key>scale</key>
- <value>1</value>
+ <key>marker5</key>
+ <value>-1</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>alpha5</key>
+ <value>1.0</value>
</param>
<param>
- <key>affinity</key>
+ <key>label6</key>
<value></value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>width6</key>
+ <value>1</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>color6</key>
+ <value>"magenta"</value>
</param>
<param>
- <key>comment</key>
- <value></value>
+ <key>style6</key>
+ <value>1</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(384, 372)</value>
+ <key>marker6</key>
+ <value>-1</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>alpha6</key>
+ <value>1.0</value>
</param>
- </block>
- <block>
- <key>blocks_file_sink</key>
<param>
- <key>id</key>
- <value>blocks_file_sink_0_0</value>
+ <key>label7</key>
+ <value></value>
</param>
<param>
- <key>_enabled</key>
- <value>False</value>
+ <key>width7</key>
+ <value>1</value>
</param>
<param>
- <key>file</key>
- <value>avg.data</value>
+ <key>color7</key>
+ <value>"yellow"</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>style7</key>
+ <value>1</value>
</param>
<param>
- <key>vlen</key>
+ <key>marker7</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha7</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width8</key>
<value>1</value>
</param>
<param>
- <key>unbuffered</key>
- <value>False</value>
+ <key>color8</key>
+ <value>"dark red"</value>
</param>
<param>
- <key>append</key>
- <value>False</value>
+ <key>style8</key>
+ <value>1</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>marker8</key>
+ <value>-1</value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>alpha8</key>
+ <value>1.0</value>
</param>
<param>
- <key>comment</key>
+ <key>label9</key>
<value></value>
</param>
<param>
- <key>_coordinate</key>
- <value>(824, 438)</value>
+ <key>width9</key>
+ <value>1</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>color9</key>
+ <value>"dark green"</value>
</param>
- </block>
- <block>
- <key>blocks_file_sink</key>
<param>
- <key>id</key>
- <value>blocks_file_sink_0_1</value>
+ <key>style9</key>
+ <value>1</value>
</param>
<param>
- <key>_enabled</key>
- <value>False</value>
+ <key>marker9</key>
+ <value>-1</value>
</param>
<param>
- <key>file</key>
- <value>flag.data</value>
+ <key>alpha9</key>
+ <value>1.0</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>label10</key>
+ <value></value>
</param>
<param>
- <key>vlen</key>
+ <key>width10</key>
<value>1</value>
</param>
<param>
- <key>unbuffered</key>
- <value>False</value>
+ <key>color10</key>
+ <value>"blue"</value>
</param>
<param>
- <key>append</key>
- <value>False</value>
+ <key>style10</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker10</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha10</key>
+ <value>1.0</value>
</param>
<param>
<key>alias</key>
@@ -559,7 +549,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(824, 334)</value>
+ <value>(808, 152)</value>
</param>
<param>
<key>_rotation</key>
@@ -567,34 +557,22 @@
</param>
</block>
<block>
- <key>blocks_file_sink</key>
+ <key>blocks_char_to_float</key>
<param>
<key>id</key>
- <value>blocks_file_sink_0</value>
+ <value>blocks_char_to_float_0</value>
</param>
<param>
<key>_enabled</key>
- <value>False</value>
- </param>
- <param>
- <key>file</key>
- <value>in.data</value>
- </param>
- <param>
- <key>type</key>
- <value>float</value>
+ <value>True</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
<param>
- <key>unbuffered</key>
- <value>False</value>
- </param>
- <param>
- <key>append</key>
- <value>False</value>
+ <key>scale</key>
+ <value>1</value>
</param>
<param>
<key>alias</key>
@@ -605,12 +583,20 @@
<value></value>
</param>
<param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(824, 238)</value>
+ <value>(624, 83)</value>
</param>
<param>
<key>_rotation</key>
@@ -618,342 +604,360 @@
</param>
</block>
<block>
- <key>qtgui_time_sink_x</key>
+ <key>blocks_peak_detector2_fb</key>
<param>
<key>id</key>
- <value>qtgui_time_sink_x_0</value>
+ <value>blocks_peak_detector2_fb_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>threshold_factor_rise</key>
+ <value>factor</value>
</param>
<param>
- <key>name</key>
- <value>""</value>
+ <key>look_ahead</key>
+ <value>lookahead</value>
</param>
<param>
- <key>ylabel</key>
- <value>Amplitude</value>
+ <key>alpha</key>
+ <value>alpha</value>
</param>
<param>
- <key>yunit</key>
- <value>""</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>size</key>
- <value>512</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>srate</key>
- <value>samp_rate</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>grid</key>
- <value>True</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>autoscale</key>
- <value>False</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>ymin</key>
- <value>-1.5</value>
+ <key>_coordinate</key>
+ <value>(408, 83)</value>
</param>
<param>
- <key>ymax</key>
- <value>1.5</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>blocks_file_sink</key>
<param>
- <key>nconnections</key>
- <value>3</value>
+ <key>id</key>
+ <value>blocks_file_sink_0_1</value>
</param>
<param>
- <key>update_time</key>
- <value>0.10</value>
+ <key>_enabled</key>
+ <value>False</value>
</param>
<param>
- <key>entags</key>
- <value>True</value>
+ <key>file</key>
+ <value>flag.data</value>
</param>
<param>
- <key>gui_hint</key>
- <value></value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_AUTO</value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
- <key>tr_slope</key>
- <value>qtgui.TRIG_SLOPE_POS</value>
+ <key>unbuffered</key>
+ <value>False</value>
</param>
<param>
- <key>tr_level</key>
- <value>0.0</value>
+ <key>append</key>
+ <value>False</value>
</param>
<param>
- <key>tr_delay</key>
- <value>0</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>tr_chan</key>
- <value>0</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>tr_tag</key>
- <value>""</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>ctrlpanel</key>
- <value>True</value>
+ <key>_coordinate</key>
+ <value>(808, 51)</value>
</param>
<param>
- <key>legend</key>
- <value>True</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>blocks_file_sink</key>
<param>
- <key>label1</key>
- <value></value>
+ <key>id</key>
+ <value>blocks_file_sink_0_0</value>
</param>
<param>
- <key>width1</key>
- <value>1</value>
+ <key>_enabled</key>
+ <value>False</value>
</param>
<param>
- <key>color1</key>
- <value>"blue"</value>
+ <key>file</key>
+ <value>avg.data</value>
</param>
<param>
- <key>style1</key>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>vlen</key>
<value>1</value>
</param>
<param>
- <key>marker1</key>
- <value>-1</value>
+ <key>unbuffered</key>
+ <value>False</value>
</param>
<param>
- <key>alpha1</key>
- <value>1.0</value>
+ <key>append</key>
+ <value>False</value>
</param>
<param>
- <key>label2</key>
+ <key>alias</key>
<value></value>
</param>
<param>
- <key>width2</key>
- <value>1</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>color2</key>
- <value>"red"</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>style2</key>
- <value>1</value>
+ <key>_coordinate</key>
+ <value>(784, 259)</value>
</param>
<param>
- <key>marker2</key>
- <value>-1</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>blocks_file_sink</key>
<param>
- <key>alpha2</key>
- <value>1.0</value>
+ <key>id</key>
+ <value>blocks_file_sink_0</value>
</param>
<param>
- <key>label3</key>
- <value></value>
+ <key>_enabled</key>
+ <value>False</value>
</param>
<param>
- <key>width3</key>
- <value>1</value>
+ <key>file</key>
+ <value>in.data</value>
</param>
<param>
- <key>color3</key>
- <value>"green"</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>style3</key>
+ <key>vlen</key>
<value>1</value>
</param>
<param>
- <key>marker3</key>
- <value>-1</value>
+ <key>unbuffered</key>
+ <value>False</value>
</param>
<param>
- <key>alpha3</key>
- <value>1.0</value>
+ <key>append</key>
+ <value>False</value>
</param>
<param>
- <key>label4</key>
+ <key>alias</key>
<value></value>
</param>
<param>
- <key>width4</key>
- <value>1</value>
- </param>
- <param>
- <key>color4</key>
- <value>"black"</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>style4</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>marker4</key>
- <value>-1</value>
+ <key>_coordinate</key>
+ <value>(408, 187)</value>
</param>
<param>
- <key>alpha4</key>
- <value>1.0</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
<param>
- <key>label5</key>
- <value></value>
+ <key>id</key>
+ <value>offset</value>
</param>
<param>
- <key>width5</key>
- <value>1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>color5</key>
- <value>"cyan"</value>
+ <key>label</key>
+ <value></value>
</param>
<param>
- <key>style5</key>
- <value>1</value>
+ <key>value</key>
+ <value>0.1</value>
</param>
<param>
- <key>marker5</key>
- <value>-1</value>
+ <key>start</key>
+ <value>-1.5</value>
</param>
<param>
- <key>alpha5</key>
- <value>1.0</value>
+ <key>stop</key>
+ <value>1.5</value>
</param>
<param>
- <key>label6</key>
- <value></value>
+ <key>step</key>
+ <value>0.1</value>
</param>
<param>
- <key>width6</key>
- <value>1</value>
+ <key>widget</key>
+ <value>counter_slider</value>
</param>
<param>
- <key>color6</key>
- <value>"magenta"</value>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
</param>
<param>
- <key>style6</key>
- <value>1</value>
+ <key>min_len</key>
+ <value>200</value>
</param>
<param>
- <key>marker6</key>
- <value>-1</value>
+ <key>gui_hint</key>
+ <value></value>
</param>
<param>
- <key>alpha6</key>
- <value>1.0</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>label7</key>
+ <key>comment</key>
<value></value>
</param>
<param>
- <key>width7</key>
- <value>1</value>
+ <key>_coordinate</key>
+ <value>(16, 235)</value>
</param>
<param>
- <key>color7</key>
- <value>"yellow"</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>analog_sig_source_x</key>
<param>
- <key>style7</key>
- <value>1</value>
+ <key>id</key>
+ <value>analog_sig_source_x_0</value>
</param>
<param>
- <key>marker7</key>
- <value>-1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>alpha7</key>
- <value>1.0</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>label8</key>
- <value></value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>width8</key>
- <value>1</value>
+ <key>waveform</key>
+ <value>analog.GR_SAW_WAVE</value>
</param>
<param>
- <key>color8</key>
- <value>"dark red"</value>
+ <key>freq</key>
+ <value>1000</value>
</param>
<param>
- <key>style8</key>
+ <key>amp</key>
<value>1</value>
</param>
<param>
- <key>marker8</key>
- <value>-1</value>
+ <key>offset</key>
+ <value>offset</value>
</param>
<param>
- <key>alpha8</key>
- <value>1.0</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>label9</key>
+ <key>affinity</key>
<value></value>
</param>
<param>
- <key>width9</key>
- <value>1</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>color9</key>
- <value>"dark green"</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>style9</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>marker9</key>
- <value>-1</value>
+ <key>_coordinate</key>
+ <value>(16, 115)</value>
</param>
<param>
- <key>alpha9</key>
- <value>1.0</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>blocks_throttle</key>
<param>
- <key>label10</key>
- <value></value>
+ <key>id</key>
+ <value>blocks_throttle_0</value>
</param>
<param>
- <key>width10</key>
- <value>1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>color10</key>
- <value>"blue"</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>style10</key>
- <value>1</value>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>marker10</key>
- <value>-1</value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
- <key>alpha10</key>
- <value>1.0</value>
+ <key>ignoretag</key>
+ <value>True</value>
</param>
<param>
<key>alias</key>
@@ -964,12 +968,20 @@
<value></value>
</param>
<param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(672, 712)</value>
+ <value>(224, 147)</value>
</param>
<param>
<key>_rotation</key>
@@ -977,28 +989,28 @@
</param>
</block>
<connection>
- <source_block_id>blocks_peak_detector2_fb_0</source_block_id>
- <sink_block_id>blocks_char_to_float_0</sink_block_id>
+ <source_block_id>blocks_char_to_float_0</source_block_id>
+ <sink_block_id>blocks_file_sink_0_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>blocks_add_const_vxx_0</sink_block_id>
- <source_key>0</source_key>
+ <source_block_id>blocks_peak_detector2_fb_0</source_block_id>
+ <sink_block_id>blocks_file_sink_0_0</sink_block_id>
+ <source_key>1</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blocks_add_const_vxx_0</source_block_id>
- <sink_block_id>blocks_throttle_0</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blocks_throttle_0</source_block_id>
- <sink_block_id>blocks_peak_detector2_fb_0</sink_block_id>
+ <source_block_id>blocks_char_to_float_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
<source_key>0</source_key>
- <sink_key>0</sink_key>
+ <sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>blocks_peak_detector2_fb_0</source_block_id>
@@ -1007,32 +1019,26 @@
<sink_key>2</sink_key>
</connection>
<connection>
- <source_block_id>blocks_char_to_float_0</source_block_id>
- <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>1</sink_key>
- </connection>
- <connection>
<source_block_id>blocks_throttle_0</source_block_id>
- <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <sink_block_id>blocks_peak_detector2_fb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blocks_peak_detector2_fb_0</source_block_id>
- <sink_block_id>blocks_file_sink_0_0</sink_block_id>
- <source_key>1</source_key>
+ <sink_block_id>blocks_char_to_float_0</sink_block_id>
+ <source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blocks_char_to_float_0</source_block_id>
- <sink_block_id>blocks_file_sink_0_1</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>blocks_file_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blocks_add_const_vxx_0</source_block_id>
- <sink_block_id>blocks_file_sink_0</sink_block_id>
+ <source_block_id>analog_sig_source_x_0</source_block_id>
+ <sink_block_id>blocks_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.cc
b/gr-blocks/lib/peak_detector2_fb_impl.cc
index e631768..dc13e66 100644
--- a/gr-blocks/lib/peak_detector2_fb_impl.cc
+++ b/gr-blocks/lib/peak_detector2_fb_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2010,2013,2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -43,17 +43,48 @@ namespace gr {
peak_detector2_fb_impl::peak_detector2_fb_impl(float threshold_factor_rise,
int look_ahead, float alpha)
: sync_block("peak_detector2_fb",
- io_signature::make(1, 1, sizeof(float)),
- io_signature::make2(1, 2, sizeof(char), sizeof(float))),
- d_threshold_factor_rise(threshold_factor_rise),
- d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false)
+ io_signature::make(1, 1, sizeof(float)),
+ io_signature::make2(1, 2, sizeof(char), sizeof(float))),
+ d_avg(0.0f), d_found(false)
{
+ set_threshold_factor_rise(threshold_factor_rise);
+ set_look_ahead(look_ahead);
+ set_alpha(alpha);
}
peak_detector2_fb_impl::~peak_detector2_fb_impl()
{
}
+ void
+ peak_detector2_fb_impl::set_threshold_factor_rise(float thr)
+ {
+ gr::thread::scoped_lock lock(d_setlock);
+ d_threshold_factor_rise = thr;
+ invalidate();
+ }
+
+ void
+ peak_detector2_fb_impl::set_look_ahead(int look)
+ {
+ gr::thread::scoped_lock lock(d_setlock);
+ d_look_ahead = look;
+ invalidate();
+ }
+
+ void
+ peak_detector2_fb_impl::set_alpha(float alpha)
+ {
+ d_alpha = alpha;
+ }
+
+ void
+ peak_detector2_fb_impl::invalidate()
+ {
+ d_found = false;
+ set_output_multiple(1);
+ }
+
int
peak_detector2_fb_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -63,57 +94,49 @@ namespace gr {
char *optr = (char *)output_items[0];
float *sigout;
- //bool DEB=false;
-
- //if (DEB) printf("\nEnter work(): noutput_items= %d \n", noutput_items);
-
if(output_items.size() == 2)
- sigout = (float *)output_items[1];
+ sigout = (float *)output_items[1];
memset(optr, 0, noutput_items*sizeof(char));
- if(d_found==false) { // have not crossed threshold yet
- for(int i=0;i<noutput_items;i++) {
+ gr::thread::scoped_lock lock(d_setlock);
+
+ // have not crossed threshold yet
+ if(d_found==false) {
+ for(int i = 0; i < noutput_items; i++) {
d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
if(output_items.size() == 2)
sigout[i]=d_avg;
if(iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) {
d_found = true;
d_peak_val = -(float)INFINITY;
- //if (DEB) printf("crossed threshold at i=%d with
value=%f\n",i,iptr[i]);
- set_output_multiple(d_look_ahead); // this is done so that the
block eventually returns if there are not enough inputs.
- //if (DEB) printf("output multiple set at %d\n",output_multiple());
- //if (DEB) printf("return %d items\n",i);
+ set_output_multiple(d_look_ahead);
return i;
}
}
- //if (DEB) printf("output multiple is %d\n",output_multiple());
- //if (DEB) printf("returning (below threshold) items
=%d\n",noutput_items);
return noutput_items;
} // end d_found==false
- else if(noutput_items>=d_look_ahead) { // can complete in this call
- //if (DEB) printf("Can complete in this call\n");
- for(int i=0;i<d_look_ahead;i++) {
+
+ // can complete in this call
+ else if(noutput_items >= d_look_ahead) {
+ for(int i = 0; i < d_look_ahead; i++) {
d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
if(output_items.size() == 2)
sigout[i]=d_avg;
if(iptr[i] > d_peak_val) {
d_peak_val = iptr[i];
d_peak_ind =i;
- //if (DEB) printf("peak found at i=%d, val=%f\n",i,d_peak_val);
}
}
optr[d_peak_ind] = 1;
- //if (DEB) printf("PEAK=%f\n",d_peak_val);
- d_found = false; // start searching again
- set_output_multiple(1);
- //if (DEB) printf("output multiple set at %d\n",output_multiple());
- //if (DEB) printf("returning (above threshold and finished searching)
items =%d\n",d_look_ahead);
+
+ // restart the search
+ invalidate();
return d_look_ahead;
} // end can complete in this call
- else { // cannot complete in this call
- //if (DEB) printf("CANNOT BE HERE!!!!!!!!!!!!!!!!!!!!!\n");
- //if (DEB) printf("returning (above threshold, but not enough inputs).
New lookahead=%d\n",d_look_ahead);
+
+ // cannot complete in this call
+ else {
return 0; // ask for more
}
}
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.h
b/gr-blocks/lib/peak_detector2_fb_impl.h
index f5a8ac1..4e16c93 100644
--- a/gr-blocks/lib/peak_detector2_fb_impl.h
+++ b/gr-blocks/lib/peak_detector2_fb_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2013 Free Software Foundation, Inc.
+ * Copyright 2007,2013,2015 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -40,14 +40,16 @@ namespace gr {
float d_avg;
bool d_found;
+ void invalidate();
+
public:
peak_detector2_fb_impl(float threshold_factor_rise,
int look_ahead, float alpha);
~peak_detector2_fb_impl();
- void set_threshold_factor_rise(float thr) { d_threshold_factor_rise =
thr; }
- void set_look_ahead(int look) { d_look_ahead = look; }
- void set_alpha(float alpha) { d_alpha = alpha; }
+ void set_threshold_factor_rise(float thr);
+ void set_look_ahead(int look);
+ void set_alpha(float alpha);
float threshold_factor_rise() { return d_threshold_factor_rise; }
int look_ahead() { return d_look_ahead; }
- [Commit-gnuradio] [gnuradio] 12/16: Merge remote-tracking branch 'tom/ctrlport/fixes1', (continued)
- [Commit-gnuradio] [gnuradio] 12/16: Merge remote-tracking branch 'tom/ctrlport/fixes1', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 06/16: controlport: use proper default return value from prefs get_bool., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 08/16: digital: fix skipped sample handling in burst_shaper, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 05/16: qtgui: improved type checking for range block and simplifies python., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 02/16: controlport: fixed up performance monitor., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 03/16: qtgui: adds Type setting for Range widget., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 01/16: controlport: fixed controlport probes., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 07/16: analog: Power Squelch now emit tags on start/end of bursts, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 09/16: digital: added tag propagation to burst_shaper blocks, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 10/16: blocks: better implementation of peak_detector2. Address #783., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 11/16: blocks: more fixups to peak_detector2.,
git <=