summaryrefslogtreecommitdiff
path: root/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
diff options
context:
space:
mode:
authorTom Rondeau2010-05-01 19:06:13 -0400
committerTom Rondeau2010-05-01 19:06:13 -0400
commit6606af991b15174cbdbaca738669a21461b0fbe6 (patch)
tree1fc38aa738e8dccc675ac3da0938fbd3e992eca2 /gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
parentf1b71c9525dd56e2c296a2bca4b2db9ed1a320ce (diff)
downloadgnuradio-6606af991b15174cbdbaca738669a21461b0fbe6.tar.gz
gnuradio-6606af991b15174cbdbaca738669a21461b0fbe6.tar.bz2
gnuradio-6606af991b15174cbdbaca738669a21461b0fbe6.zip
Fixes the replotting update. It's now based on a QTimer so it's in the event buffer as opposed to a best effort based on a hand-made timer. The interval between GUI updates is settable through the qtsink_X objects with set_update_time(newtime). This update makes the plotting much more stable. It also fixes the time scale of the waterfall plot to actually mean the right thing.
Diffstat (limited to 'gr-qtgui/src/lib/TimeDomainDisplayPlot.cc')
-rw-r--r--gr-qtgui/src/lib/TimeDomainDisplayPlot.cc35
1 files changed, 11 insertions, 24 deletions
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
index cb18b4418..708ac1661 100644
--- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc
@@ -32,13 +32,12 @@ protected:
}
};
-TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){
+TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent)
+{
timespec_reset(&_lastReplot);
resize(parent->width(), parent->height());
- _displayIntervalTime = (1.0/10.0); // 1/10 of a second between updates
-
_numPoints = 1024;
_realDataPoints = new double[_numPoints];
_imagDataPoints = new double[_numPoints];
@@ -114,7 +113,8 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){
legendDisplay->setItemMode(QwtLegend::CheckableItem);
insertLegend(legendDisplay);
- connect(this, SIGNAL( legendChecked(QwtPlotItem *, bool ) ), this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) ));
+ connect(this, SIGNAL( legendChecked(QwtPlotItem *, bool ) ),
+ this, SLOT( LegendEntryChecked(QwtPlotItem *, bool ) ));
}
TimeDomainDisplayPlot::~TimeDomainDisplayPlot(){
@@ -143,17 +143,7 @@ TimeDomainDisplayPlot::set_xaxis(double min, double max)
void TimeDomainDisplayPlot::replot()
{
- const timespec startTime = get_highres_clock();
-
QwtPlot::replot();
-
- double differenceTime = (diff_timespec(get_highres_clock(), startTime));
-
- differenceTime *= 99.0;
- // Require at least a 10% duty cycle
- if(differenceTime > (1.0/10.0)){
- _displayIntervalTime = differenceTime;
- }
}
void
@@ -164,10 +154,12 @@ TimeDomainDisplayPlot::resizeSlot( QSize *s )
void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints,
const double* imagDataPoints,
- const int64_t numDataPoints)
+ const int64_t numDataPoints,
+ const double timeInterval)
{
- if(numDataPoints > 0){
-
+ if((numDataPoints > 0) &&
+ (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
+
if(numDataPoints != _numPoints){
_numPoints = numDataPoints;
@@ -185,17 +177,12 @@ void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints,
_resetXAxisPoints();
}
+
memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double));
memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double));
- }
+ replot();
- // Allow at least a 50% duty cycle
- if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){
- // Only replot the screen if it is visible
- if(isVisible()){
- replot();
- }
_lastReplot = get_highres_clock();
}
}