summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Balister2011-04-29 14:51:07 -0400
committerPhilip Balister2011-10-23 22:05:29 -0400
commit639e14e2a563215eae3f0e5608091d816bfb6f9c (patch)
treecf9dbcd8b98f5cfeb15eb7869e18a8fd286f053c
parentead053858d4f8e2c3f258c09f65f6fe59d404deb (diff)
downloadgnuradio-639e14e2a563215eae3f0e5608091d816bfb6f9c.tar.gz
gnuradio-639e14e2a563215eae3f0e5608091d816bfb6f9c.tar.bz2
gnuradio-639e14e2a563215eae3f0e5608091d816bfb6f9c.zip
qtqui-sink : Do not run the FFT unless updating the display.
Signed-off-by: Philip Balister <philip@opensdr.com>
-rw-r--r--gr-qtgui/include/qtgui_sink_c.h3
-rw-r--r--gr-qtgui/lib/qtgui_sink_c.cc12
2 files changed, 15 insertions, 0 deletions
diff --git a/gr-qtgui/include/qtgui_sink_c.h b/gr-qtgui/include/qtgui_sink_c.h
index b04706b14..28c0f1372 100644
--- a/gr-qtgui/include/qtgui_sink_c.h
+++ b/gr-qtgui/include/qtgui_sink_c.h
@@ -29,6 +29,7 @@
#include <gr_firdes.h>
#include <gri_fft.h>
#include <qapplication.h>
+#include <gruel/high_res_timer.h>
#include "SpectrumGUIClass.h"
class qtgui_sink_c;
@@ -78,6 +79,8 @@ private:
double d_center_freq;
double d_bandwidth;
std::string d_name;
+ gruel::high_res_timer_type d_last_update;
+ bool d_update_active;
bool d_shift;
gri_fft_complex *d_fft;
diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc
index 965be0773..625ddbdf6 100644
--- a/gr-qtgui/lib/qtgui_sink_c.cc
+++ b/gr-qtgui/lib/qtgui_sink_c.cc
@@ -125,6 +125,9 @@ qtgui_sink_c::initialize()
// initialize update time to 10 times a second
set_update_time(0.1);
+
+ d_last_update = gruel::high_res_timer_now();
+ d_update_active = false;
}
@@ -270,6 +273,14 @@ qtgui_sink_c::general_work (int noutput_items,
unsigned int datasize = noutput_items - i;
unsigned int resid = d_fftsize-d_index;
+ if (!d_update_active && (gruel::high_res_timer_now() - d_last_update) < d_update_time) {
+ consume_each(noutput_items);
+ return noutput_items;
+ } else {
+ d_last_update = gruel::high_res_timer_now();
+ d_update_active = true;
+ }
+
// If we have enough input for one full FFT, do it
if(datasize >= resid) {
const gruel::high_res_timer_type currentTime = gruel::high_res_timer_now();
@@ -284,6 +295,7 @@ qtgui_sink_c::general_work (int noutput_items,
d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize,
NULL, 0, (float*)d_residbuf, d_fftsize,
currentTime, true);
+ d_update_active = false;
}
// Otherwise, copy what we received into the residbuf for next time
else {