diff options
-rw-r--r-- | gr-audio/grc/audio_sink.xml | 1 | ||||
-rw-r--r-- | gr-audio/grc/audio_source.xml | 1 | ||||
-rw-r--r-- | gr-uhd/grc/gen_uhd_usrp_blocks.py | 1 | ||||
-rw-r--r-- | grc/blocks/gr_throttle.xml | 1 | ||||
-rw-r--r-- | grc/python/Block.py | 3 | ||||
-rw-r--r-- | grc/python/Generator.py | 4 | ||||
-rw-r--r-- | grc/python/block.dtd | 3 |
7 files changed, 11 insertions, 3 deletions
diff --git a/gr-audio/grc/audio_sink.xml b/gr-audio/grc/audio_sink.xml index 26e199d61..4a88a7fa2 100644 --- a/gr-audio/grc/audio_sink.xml +++ b/gr-audio/grc/audio_sink.xml @@ -8,6 +8,7 @@ <name>Audio Sink</name> <key>audio_sink</key> <category>Sinks</category> + <throttle>1</throttle> <import>from gnuradio import audio</import> <make>audio.sink($samp_rate, $device_name, $ok_to_block)</make> <param> diff --git a/gr-audio/grc/audio_source.xml b/gr-audio/grc/audio_source.xml index 59b375244..d56e9153a 100644 --- a/gr-audio/grc/audio_source.xml +++ b/gr-audio/grc/audio_source.xml @@ -8,6 +8,7 @@ <name>Audio Source</name> <key>audio_source</key> <category>Sources</category> + <throttle>1</throttle> <import>from gnuradio import audio</import> <make>audio.source($samp_rate, $device_name, $ok_to_block)</make> <param> diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py index b6bc5fb79..7116dad3b 100644 --- a/gr-uhd/grc/gen_uhd_usrp_blocks.py +++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py @@ -23,6 +23,7 @@ MAIN_TMPL = """\ <block> <name>UHD: USRP $sourk.title()</name> <key>uhd_usrp_$(sourk)</key> + <throttle>1</throttle> <import>from gnuradio import uhd</import> <make>uhd.usrp_$(sourk)( device_addr=\$dev_addr, diff --git a/grc/blocks/gr_throttle.xml b/grc/blocks/gr_throttle.xml index ab8506f55..dc825f167 100644 --- a/grc/blocks/gr_throttle.xml +++ b/grc/blocks/gr_throttle.xml @@ -7,6 +7,7 @@ <block> <name>Throttle</name> <key>gr_throttle</key> + <throttle>1</throttle> <import>from gnuradio import gr</import> <make>gr.throttle($type.size*$vlen, $samples_per_second)</make> <param> diff --git a/grc/python/Block.py b/grc/python/Block.py index 4baf36dc6..967a27ce9 100644 --- a/grc/python/Block.py +++ b/grc/python/Block.py @@ -46,6 +46,7 @@ class Block(_Block, _GUIBlock): self._var_make = n.find('var_make') self._checks = n.findall('check') self._callbacks = n.findall('callback') + self._throttle = n.find('throttle') or '' #build the block _Block.__init__( self, @@ -54,6 +55,8 @@ class Block(_Block, _GUIBlock): ) _GUIBlock.__init__(self) + def throttle(self): return bool(self._throttle) + def validate(self): """ Validate this block. diff --git a/grc/python/Generator.py b/grc/python/Generator.py index 2a2dfdd49..2a6fe51d5 100644 --- a/grc/python/Generator.py +++ b/grc/python/Generator.py @@ -57,8 +57,8 @@ class Generator(object): def write(self): #do throttle warning - all_keys = ' '.join(map(lambda b: b.get_key(), self._flow_graph.get_enabled_blocks())) - if ('usrp' not in all_keys) and ('uhd' not in all_keys) and ('audio' not in all_keys) and ('throttle' not in all_keys) and self._generate_options != 'hb': + throttled = any(map(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks())) + if not throttled and self._generate_options != 'hb': Messages.send_warning('''\ This flow graph may not have flow control: no audio or usrp blocks found. \ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') diff --git a/grc/python/block.dtd b/grc/python/block.dtd index 7c6c39811..41a744d07 100644 --- a/grc/python/block.dtd +++ b/grc/python/block.dtd @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Top level element. A block contains a name, ...parameters list, and list of IO ports. --> -<!ELEMENT block (name, key, category?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?)> +<!ELEMENT block (name, key, category?, throttle?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?)> <!-- Sub level elements. --> @@ -53,3 +53,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <!ELEMENT value (#PCDATA)> <!ELEMENT callback (#PCDATA)> <!ELEMENT optional (#PCDATA)> +<!ELEMENT throttle (#PCDATA)> |