summaryrefslogtreecommitdiff
path: root/grc/python/Generator.py
diff options
context:
space:
mode:
authorMarcus Müller <marcus@hostalia.de>2014-08-25 23:14:39 +0200
committerSebastian Koslowski <koslowski@kit.edu>2014-08-26 16:52:15 +0200
commitbcee01bf9bb04eeda82158e564949d79715bfca3 (patch)
tree88ea831e62be1dea542d173ea9d9c25246231a86 /grc/python/Generator.py
parent4abbcf925525035414f03af5366e2eddd49e85f7 (diff)
grc: Generator warning for flowgraphs with a throttle and an external source/sink
The Generator will now issue a warning that it is usually wrong to use any hardware flow control and a throttle block at the same time.
Diffstat (limited to 'grc/python/Generator.py')
-rw-r--r--grc/python/Generator.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index eb24b75732..92f36cf30b 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -59,11 +59,17 @@ class Generator(object):
def write(self):
#do throttle warning
- throttled = any(map(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks()))
- if not throttled and self._generate_options != 'hb':
+ throttling_blocks = filter(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks())
+ if not throttling_blocks and self._generate_options != 'hb':
Messages.send_warning('''\
-This flow graph may not have flow control: no audio or usrp blocks found. \
+This flow graph may not have flow control: no audio or RF hardware blocks found. \
Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
+ if len(throttling_blocks) > 1:
+ keys = set(map(lambda b: b.get_key(), throttling_blocks))
+ if len(keys) > 1 and 'blocks_throttle' in keys:
+ Messages.send_warning('''\
+This flow graph contains a throttle block and another rate limiting block, e.g. a hardware source or sink. \
+This is usually undesired. Consider removing the throttle block.''')
#generate
open(self.get_file_path(), 'w').write(str(self))
if self._generate_options == 'hb':