From 2a2411a598c222e2ef82b857c0b53e0a9d1daf3f Mon Sep 17 00:00:00 2001 From: Marcus Leech Date: Sun, 15 Jan 2012 23:49:52 -0500 Subject: core: fix for off-by-one issue in strip chart. Increases buffer size for longer displays. --- gnuradio-core/src/lib/io/gr_oscope_guts.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/io/gr_oscope_guts.cc b/gnuradio-core/src/lib/io/gr_oscope_guts.cc index ce7feca13..f1bdeb9c1 100644 --- a/gnuradio-core/src/lib/io/gr_oscope_guts.cc +++ b/gnuradio-core/src/lib/io/gr_oscope_guts.cc @@ -31,8 +31,7 @@ #include #include -static const int OUTPUT_RECORD_SIZE = 2048; // must be power of 2 - +static const int OUTPUT_RECORD_SIZE = 16384; // Must be power of 2 static inline int wrap_bi (int buffer_index) // wrap buffer index { @@ -139,7 +138,7 @@ gr_oscope_guts::process_sample (const float *channel_data) { for (int i = 0; i < d_nchannels; i++) { - for (int j = OUTPUT_RECORD_SIZE-1; j >= 0; j--) + for (int j = OUTPUT_RECORD_SIZE-1; j > 0; j--) { d_buffer[i][j] = d_buffer[i][j-1]; } -- cgit From 5c4da9040913bc999cb9e698851c9f38abc70038 Mon Sep 17 00:00:00 2001 From: Marcus Leech Date: Mon, 16 Jan 2012 00:15:05 -0500 Subject: core: the burst_tag block can have user-defined keys and values for the tags when a burst is on or off instead of static values. Defaults are the same. Use set_true_tag and set_false_tag to override these. --- gnuradio-core/src/lib/general/gr_burst_tagger.cc | 38 ++++++++++++++++++++---- gnuradio-core/src/lib/general/gr_burst_tagger.h | 11 +++++-- gnuradio-core/src/lib/general/gr_burst_tagger.i | 4 +++ 3 files changed, 45 insertions(+), 8 deletions(-) (limited to 'gnuradio-core/src') diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc index 4b3847b08..bd713d663 100644 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.cc +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.cc @@ -43,10 +43,39 @@ gr_burst_tagger::gr_burst_tagger(size_t itemsize) std::stringstream str; str << name() << unique_id(); - d_key = pmt::pmt_string_to_symbol("burst"); + d_true_key = pmt::pmt_string_to_symbol("burst"); + d_true_value = pmt::PMT_T; + + d_false_key = pmt::pmt_string_to_symbol("burst"); + d_false_value = pmt::PMT_F; + d_id = pmt::pmt_string_to_symbol(str.str()); } +void +gr_burst_tagger::set_true_tag (const std::string &key, bool value) +{ + d_true_key = pmt::pmt_string_to_symbol(key); + if(value == true) { + d_true_value = pmt::PMT_T; + } + else { + d_true_value = pmt::PMT_F; + } +} + +void +gr_burst_tagger::set_false_tag (const std::string &key, bool value) +{ + d_false_key = pmt::pmt_string_to_symbol(key); + if(value == true) { + d_false_value = pmt::PMT_T; + } + else { + d_false_value = pmt::PMT_F; + } +} + gr_burst_tagger::~gr_burst_tagger() { } @@ -66,18 +95,15 @@ gr_burst_tagger::work(int noutput_items, if(trigger[i] > 0) { if(d_state == false) { d_state = true; - pmt::pmt_t value = pmt::PMT_T; - add_item_tag(0, nitems_written(0)+i, d_key, value, d_id); + add_item_tag(0, nitems_written(0)+i, d_true_key, d_true_value, d_id); } } else { if(d_state == true) { d_state = false; - pmt::pmt_t value = pmt::PMT_F; - add_item_tag(0, nitems_written(0)+i, d_key, value, d_id); + add_item_tag(0, nitems_written(0)+i, d_false_key, d_false_value, d_id); } } } - return noutput_items; } diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h index 7547ba9cc..663a146f2 100644 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.h +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h @@ -40,14 +40,21 @@ class GR_CORE_API gr_burst_tagger : public gr_sync_block { size_t d_itemsize; bool d_state; - pmt::pmt_t d_key; + pmt::pmt_t d_true_key; + pmt::pmt_t d_true_value; + + pmt::pmt_t d_false_key; + pmt::pmt_t d_false_value; + pmt::pmt_t d_id; - + friend GR_CORE_API gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize); gr_burst_tagger(size_t itemsize); public: ~gr_burst_tagger(); + void set_true_tag (const std::string &key, bool value); + void set_false_tag (const std::string &key, bool value); int work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.i b/gnuradio-core/src/lib/general/gr_burst_tagger.i index ebf1eea8c..868941fc6 100644 --- a/gnuradio-core/src/lib/general/gr_burst_tagger.i +++ b/gnuradio-core/src/lib/general/gr_burst_tagger.i @@ -28,4 +28,8 @@ class gr_burst_tagger : public gr_sync_block { private: gr_burst_tagger(size_t itemsize); + + public: + void set_true_tag(const std::string &key, bool value); + void set_false_tag(const std::string &key, bool value); }; -- cgit