diff options
Diffstat (limited to 'grc')
-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 |
4 files changed, 8 insertions, 3 deletions
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)> |