Fixes the replotting update. It's now based on a QTimer so it's in the event buffer...
[debian/gnuradio] / gr-qtgui / src / lib / ConstellationDisplayPlot.cc
index 80bf4503f50fb3edb6ca17a06d01c931cf8b1201..4e6d6da18eaa1c2f229bf59d2ebd92f1f5b3c59c 100644 (file)
@@ -39,8 +39,6 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent)
 
   resize(parent->width(), parent->height());
 
-  _displayIntervalTime = (1.0/10.0); // 1/10 of a second between updates
-
   _numPoints = 1024;
   _penSize = 5;
   _realDataPoints = new double[_numPoints];
@@ -148,19 +146,9 @@ ConstellationDisplayPlot::set_axis(double xmin, double xmax,
   set_yaxis(ymin, ymax);
 }
 
-void ConstellationDisplayPlot::replot(){
-
-  const timespec startTime = get_highres_clock();
-  
+void ConstellationDisplayPlot::replot()
+{
   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
@@ -171,10 +159,12 @@ ConstellationDisplayPlot::resizeSlot( QSize *s )
 
 void ConstellationDisplayPlot::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 +175,12 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints,
       
       _plot_curve->setRawData(_realDataPoints, _imagDataPoints, _numPoints);
     }
+
     memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double));
     memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double));
 
-  }
-
-  // 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();
-    }
+    replot();
+    
     _lastReplot = get_highres_clock();
   }
 }