summaryrefslogtreecommitdiff
path: root/gr-qtgui/src
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
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')
-rw-r--r--gr-qtgui/src/lib/ConstellationDisplayPlot.cc35
-rw-r--r--gr-qtgui/src/lib/ConstellationDisplayPlot.h5
-rw-r--r--gr-qtgui/src/lib/FrequencyDisplayPlot.cc37
-rw-r--r--gr-qtgui/src/lib/FrequencyDisplayPlot.h4
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.cc15
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.h5
-rw-r--r--gr-qtgui/src/lib/TimeDomainDisplayPlot.cc35
-rw-r--r--gr-qtgui/src/lib/TimeDomainDisplayPlot.h5
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.cc66
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.h2
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.cc12
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.h4
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_f.cc12
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_f.h4
-rw-r--r--gr-qtgui/src/lib/spectrumUpdateEvents.cc8
-rw-r--r--gr-qtgui/src/lib/spectrumUpdateEvents.h4
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.ccbin26651 -> 27120 bytes
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.h6
18 files changed, 114 insertions, 145 deletions
diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc
index 80bf4503f..4e6d6da18 100644
--- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc
+++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc
@@ -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();
}
}
diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.h b/gr-qtgui/src/lib/ConstellationDisplayPlot.h
index 99ae566e0..a441a8bfe 100644
--- a/gr-qtgui/src/lib/ConstellationDisplayPlot.h
+++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.h
@@ -24,7 +24,8 @@ public:
void PlotNewData(const double* realDataPoints,
const double* imagDataPoints,
- const int64_t numDataPoints);
+ const int64_t numDataPoints,
+ const double timeInterval);
virtual void replot();
@@ -55,8 +56,6 @@ private:
int64_t _numPoints;
int64_t _penSize;
-
- double _displayIntervalTime;
};
#endif /* CONSTELLATION_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
index 5e74dce40..6f09bbc88 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
@@ -101,8 +101,6 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
resize(parent->width(), parent->height());
- _displayIntervalTime = (1.0/10.0); // 1/10 of a second between updates
-
_useCenterFrequencyFlag = false;
_numPoints = 1024;
@@ -299,8 +297,6 @@ FrequencyDisplayPlot::GetStopFrequency() const
void
FrequencyDisplayPlot::replot()
{
- const timespec startTime = get_highres_clock();
-
_markerNoiseFloorAmplitude->setYValue(_noiseFloorAmplitude);
// Make sure to take into account the start frequency
@@ -313,14 +309,6 @@ FrequencyDisplayPlot::replot()
_markerPeakAmplitude->setYValue(_peakAmplitude);
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
@@ -332,13 +320,15 @@ FrequencyDisplayPlot::resizeSlot( QSize *s )
void
FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDataPoints,
const double noiseFloorAmplitude, const double peakFrequency,
- const double peakAmplitude)
+ const double peakAmplitude, const double timeInterval)
{
- if(numDataPoints > 0){
-
- if(numDataPoints != _numPoints){
+ // Only update plot if there is data and if the time interval has elapsed
+ if((numDataPoints > 0) &&
+ (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
+
+ if(numDataPoints != _numPoints) {
_numPoints = numDataPoints;
-
+
delete[] _dataPoints;
delete[] _minFFTPoints;
delete[] _maxFFTPoints;
@@ -351,12 +341,12 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat
_fft_plot_curve->setRawData(_xAxisPoints, _dataPoints, _numPoints);
_min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints);
_max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints);
-
+
_resetXAxisPoints();
ClearMaxData();
ClearMinData();
}
-
+
memcpy(_dataPoints, dataPoints, numDataPoints*sizeof(double));
for(int64_t point = 0; point < numDataPoints; point++){
if(dataPoints[point] < _minFFTPoints[point]){
@@ -372,14 +362,9 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat
_peakAmplitude = peakAmplitude;
SetUpperIntensityLevel(_peakAmplitude);
- }
- // 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();
}
}
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/src/lib/FrequencyDisplayPlot.h
index 785efe694..c78e1667e 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.h
+++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.h
@@ -30,7 +30,7 @@ public:
void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
const double noiseFloorAmplitude, const double peakFrequency,
- const double peakAmplitude);
+ const double peakAmplitude, const double timeInterval);
void ClearMaxData();
void ClearMinData();
@@ -86,8 +86,6 @@ private:
timespec _lastReplot;
bool _useCenterFrequencyFlag;
-
- double _displayIntervalTime;
};
#endif /* FREQUENCY_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc
index 4cb71a31a..8c1b36703 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc
@@ -111,7 +111,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
timespec_reset(&_lastGUIUpdateTime);
// Draw Blank Display
- UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, 1.0, get_highres_clock(), true);
+ UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, get_highres_clock(), true);
// Set up the initial frequency axis settings
SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency);
@@ -220,7 +220,6 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag,
const uint64_t realTimeDomainDataSize,
const float* complexTimeDomainData,
const uint64_t complexTimeDomainDataSize,
- const double timePerFFT,
const timespec timestamp,
const bool lastOfMultipleFFTUpdateFlag)
{
@@ -277,7 +276,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag,
const timespec currentTime = get_highres_clock();
const timespec lastUpdateGUITime = GetLastGUIUpdateTime();
- if((diff_timespec(currentTime, lastUpdateGUITime) > (4*timePerFFT)) &&
+ if((diff_timespec(currentTime, lastUpdateGUITime) > (4*_updateTime)) &&
(GetPendingGUIUpdateEvents() > 0) && !timespec_empty(&lastUpdateGUITime)) {
// Do not update the display if too much data is pending to be displayed
_droppedEntriesCount++;
@@ -290,7 +289,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag,
_realTimeDomainPoints,
_imagTimeDomainPoints,
timeDomainBufferSize,
- timePerFFT, timestamp,
+ timestamp,
repeatDataFlag,
lastOfMultipleFFTUpdateFlag,
currentTime,
@@ -460,4 +459,12 @@ SpectrumGUIClass::SetFrequencyAxis(double min, double max)
_spectrumDisplayForm->SetFrequencyAxis(min, max);
}
+void
+SpectrumGUIClass::SetUpdateTime(double t)
+{
+ _updateTime = t;
+ _spectrumDisplayForm->SetUpdateTime(_updateTime);
+}
+
+
#endif /* SPECTRUM_GUI_CLASS_CPP */
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h
index d8dcb2769..17d3a54c1 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.h
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.h
@@ -47,7 +47,7 @@ public:
void UpdateWindow(const bool, const std::complex<float>*,
const uint64_t, const float*,
const uint64_t, const float*,
- const uint64_t, const double,
+ const uint64_t,
const timespec, const bool);
float GetPowerValue()const;
@@ -79,6 +79,8 @@ public:
void SetConstellationPenSize(int size);
void SetFrequencyAxis(double min, double max);
+ void SetUpdateTime(double t);
+
protected:
private:
@@ -98,6 +100,7 @@ private:
unsigned int _pendingGUIUpdateEventsCount;
int _droppedEntriesCount;
bool _fftBuffersCreatedFlag;
+ double _updateTime;
SpectrumDisplayForm* _spectrumDisplayForm;
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();
}
}
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
index 8d98abac6..88f97cb80 100644
--- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
+++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
@@ -21,7 +21,8 @@ public:
TimeDomainDisplayPlot(QWidget*);
virtual ~TimeDomainDisplayPlot();
- void PlotNewData(const double* realDataPoints, const double* imagDataPoints, const int64_t numDataPoints);
+ void PlotNewData(const double* realDataPoints, const double* imagDataPoints,
+ const int64_t numDataPoints, const double timeInterval);
void SetImaginaryDataVisible(const bool);
@@ -54,8 +55,6 @@ private:
timespec _lastReplot;
int64_t _numPoints;
-
- double _displayIntervalTime;
};
#endif /* TIME_DOMAIN_DISPLAY_PLOT_HPP */
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
index b23612524..3d173cfe3 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
@@ -224,8 +224,6 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
resize(parent->width(), parent->height());
_numPoints = 1024;
- _displayIntervalTime = (1.0/5.0); // 1/5 of a second between updates
-
_waterfallData = new WaterfallData(_startFrequency, _stopFrequency, _numPoints, 200);
QPalette palette;
@@ -370,50 +368,46 @@ WaterfallDisplayPlot::GetStopFrequency() const
void
WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
- const int64_t numDataPoints,
- const double timePerFFT,
- const timespec timestamp,
- const int droppedFrames)
+ const int64_t numDataPoints,
+ const double timePerFFT,
+ const timespec timestamp,
+ const int droppedFrames)
{
if(numDataPoints > 0){
if(numDataPoints != _numPoints){
_numPoints = numDataPoints;
-
+
Reset();
-
+
d_spectrogram->invalidateCache();
d_spectrogram->itemChanged();
-
+
if(isVisible()){
replot();
}
-
+
_lastReplot = get_highres_clock();
}
- _waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames);
- _waterfallData->IncrementNumLinesToUpdate();
-
- QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft);
- timeScale->SetSecondsPerLine(timePerFFT);
- timeScale->SetZeroTime(timestamp);
-
- ((WaterfallZoomer*)_zoomer)->SetSecondsPerLine(timePerFFT);
- ((WaterfallZoomer*)_zoomer)->SetZeroTime(timestamp);
- }
-
- // Allow at least a 50% duty cycle
- if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){
-
- d_spectrogram->invalidateCache();
- d_spectrogram->itemChanged();
-
- // Only update when window is visible
- if(isVisible()){
+ if(diff_timespec(get_highres_clock(), _lastReplot) > timePerFFT) {
+ //FIXME: We may want to average the data between these updates to smooth display
+ _waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames);
+ _waterfallData->IncrementNumLinesToUpdate();
+
+ QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft);
+ timeScale->SetSecondsPerLine(timePerFFT);
+ timeScale->SetZeroTime(timestamp);
+
+ ((WaterfallZoomer*)_zoomer)->SetSecondsPerLine(timePerFFT);
+ ((WaterfallZoomer*)_zoomer)->SetZeroTime(timestamp);
+
+ d_spectrogram->invalidateCache();
+ d_spectrogram->itemChanged();
+
replot();
- }
- _lastReplot = get_highres_clock();
+ _lastReplot = get_highres_clock();
+ }
}
}
@@ -432,8 +426,6 @@ WaterfallDisplayPlot::SetIntensityRange(const double minIntensity,
void
WaterfallDisplayPlot::replot()
{
- const timespec startTime = get_highres_clock();
-
QwtTimeScaleDraw* timeScale = (QwtTimeScaleDraw*)axisScaleDraw(QwtPlot::yLeft);
timeScale->initiateUpdate();
@@ -455,14 +447,6 @@ WaterfallDisplayPlot::replot()
}
QwtPlot::replot();
-
- double differenceTime = (diff_timespec(get_highres_clock(), startTime));
-
- // Require at least a 5% duty cycle
- differenceTime *= 19.0;
- if(differenceTime > (1.0/5.0)){
- _displayIntervalTime = differenceTime;
- }
}
void
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
index 18e10aae9..a5ccaec40 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
@@ -73,8 +73,6 @@ private:
int64_t _numPoints;
- double _displayIntervalTime;
-
int _intensityColorMapType;
QColor _userDefinedLowIntensityColor;
QColor _userDefinedHighIntensityColor;
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc
index 7340141a6..fefa98704 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.cc
+++ b/gr-qtgui/src/lib/qtgui_sink_c.cc
@@ -145,6 +145,9 @@ qtgui_sink_c::initialize(const bool opengl)
d_plotconst,
opengl);
+ // initialize update time to 10 times a second
+ set_update_time(0.1);
+
d_object = new qtgui_obj(d_qApplication);
qApp->postEvent(d_object, new qtgui_event(&d_pmutex));
}
@@ -208,6 +211,13 @@ qtgui_sink_c::set_frequency_axis(double min, double max)
}
void
+qtgui_sink_c::set_update_time(double t)
+{
+ d_update_time = t;
+ d_main_gui->SetUpdateTime(d_update_time);
+}
+
+void
qtgui_sink_c::fft(const gr_complex *data_in, int size)
{
if (d_window.size()) {
@@ -300,7 +310,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,
- 1.0/4.0, currentTime, true);
+ currentTime, true);
}
// Otherwise, copy what we received into the residbuf for next time
else {
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h
index 91c6b03e6..1f6c28473 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.h
+++ b/gr-qtgui/src/lib/qtgui_sink_c.h
@@ -86,6 +86,8 @@ private:
bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst;
+ double d_update_time;
+
QWidget *d_parent;
SpectrumGUIClass *d_main_gui;
@@ -111,6 +113,8 @@ public:
void set_constellation_pen_size(int size);
void set_frequency_axis(double min, double max);
+ void set_update_time(double t);
+
QApplication *d_qApplication;
qtgui_obj *d_object;
diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/src/lib/qtgui_sink_f.cc
index 6fbb2f381..a088e28e9 100644
--- a/gr-qtgui/src/lib/qtgui_sink_f.cc
+++ b/gr-qtgui/src/lib/qtgui_sink_f.cc
@@ -140,6 +140,9 @@ qtgui_sink_f::initialize(const bool opengl)
d_plotconst,
opengl);
+ // initialize update time to 10 times a second
+ set_update_time(100);
+
d_object = new qtgui_obj(d_qApplication);
qApp->postEvent(d_object, new qtgui_event(&d_pmutex));
}
@@ -202,6 +205,13 @@ qtgui_sink_f::set_frequency_axis(double min, double max)
}
void
+qtgui_sink_f::set_update_time(double t)
+{
+ d_update_time = t;
+ d_main_gui->SetUpdateTime(d_update_time);
+}
+
+void
qtgui_sink_f::fft(const float *data_in, int size)
{
if (d_window.size()) {
@@ -295,7 +305,7 @@ qtgui_sink_f::general_work (int noutput_items,
d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize,
(float*)d_residbuf, d_fftsize, NULL, 0,
- 1.0/4.0, currentTime, true);
+ currentTime, true);
}
// Otherwise, copy what we received into the residbuf for next time
else {
diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/src/lib/qtgui_sink_f.h
index 47c928d17..f603da7b6 100644
--- a/gr-qtgui/src/lib/qtgui_sink_f.h
+++ b/gr-qtgui/src/lib/qtgui_sink_f.h
@@ -84,6 +84,8 @@ private:
bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst;
+ double d_update_time;
+
QWidget *d_parent;
SpectrumGUIClass *d_main_gui;
@@ -109,6 +111,8 @@ public:
void set_constellation_pen_size(int size);
void set_frequency_axis(double min, double max);
+ void set_update_time(double t);
+
QApplication *d_qApplication;
qtgui_obj *d_object;
diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.cc b/gr-qtgui/src/lib/spectrumUpdateEvents.cc
index 2da37d350..350e3eeb2 100644
--- a/gr-qtgui/src/lib/spectrumUpdateEvents.cc
+++ b/gr-qtgui/src/lib/spectrumUpdateEvents.cc
@@ -8,7 +8,6 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex<float>* fftPoints,
const double* realTimeDomainPoints,
const double* imagTimeDomainPoints,
const uint64_t numTimeDomainDataPoints,
- const double timePerFFT,
const timespec dataTimestamp,
const bool repeatDataFlag,
const bool lastOfMultipleUpdateFlag,
@@ -44,7 +43,6 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex<float>* fftPoints,
numTimeDomainDataPoints*sizeof(double));
}
_dataTimestamp = dataTimestamp;
- _timePerFFT = timePerFFT;
_repeatDataFlag = repeatDataFlag;
_lastOfMultipleUpdateFlag = lastOfMultipleUpdateFlag;
_eventGeneratedTimestamp = generatedTimestamp;
@@ -87,12 +85,6 @@ SpectrumUpdateEvent::getNumTimeDomainDataPoints() const
return _numTimeDomainDataPoints;
}
-double
-SpectrumUpdateEvent::getTimePerFFT() const
-{
- return _timePerFFT;
-}
-
timespec
SpectrumUpdateEvent::getDataTimestamp() const
{
diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.h b/gr-qtgui/src/lib/spectrumUpdateEvents.h
index 75fa27324..9c46d4bf3 100644
--- a/gr-qtgui/src/lib/spectrumUpdateEvents.h
+++ b/gr-qtgui/src/lib/spectrumUpdateEvents.h
@@ -10,14 +10,13 @@
class SpectrumUpdateEvent:public QEvent{
public:
- SpectrumUpdateEvent(const std::complex<float>* fftPoints, const uint64_t numFFTDataPoints, const double* realTimeDomainPoints, const double* imagTimeDomainPoints, const uint64_t numTimeDomainDataPoints, const double timePerFFT, const timespec dataTimestamp, const bool repeatDataFlag, const bool lastOfMultipleUpdateFlag, const timespec generatedTimestamp, const int droppedFFTFrames);
+ SpectrumUpdateEvent(const std::complex<float>* fftPoints, const uint64_t numFFTDataPoints, const double* realTimeDomainPoints, const double* imagTimeDomainPoints, const uint64_t numTimeDomainDataPoints, const timespec dataTimestamp, const bool repeatDataFlag, const bool lastOfMultipleUpdateFlag, const timespec generatedTimestamp, const int droppedFFTFrames);
~SpectrumUpdateEvent();
const std::complex<float>* getFFTPoints()const;
const double* getRealTimeDomainPoints()const;
const double* getImagTimeDomainPoints()const;
uint64_t getNumFFTDataPoints()const;
uint64_t getNumTimeDomainDataPoints()const;
- double getTimePerFFT()const;
timespec getDataTimestamp()const;
bool getRepeatDataFlag()const;
bool getLastOfMultipleUpdateFlag()const;
@@ -32,7 +31,6 @@ private:
double* _imagDataTimeDomainPoints;
uint64_t _numFFTDataPoints;
uint64_t _numTimeDomainDataPoints;
- double _timePerFFT;
timespec _dataTimestamp;
bool _repeatDataFlag;
bool _lastOfMultipleUpdateFlag;
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc
index 141fc0e33..0170f7862 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/src/lib/spectrumdisplayform.cc
Binary files differ
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/src/lib/spectrumdisplayform.h
index b596b0495..bf2af7033 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.h
+++ b/gr-qtgui/src/lib/spectrumdisplayform.h
@@ -13,6 +13,7 @@ class SpectrumGUIClass;
#include <TimeDomainDisplayPlot.h>
#include <ConstellationDisplayPlot.h>
#include <QValidator>
+#include <QTimer>
#include <vector>
class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
@@ -70,9 +71,11 @@ public slots:
double ymin, double ymax);
void SetConstellationPenSize(int size);
void SetFrequencyAxis(double min, double max);
+ void SetUpdateTime(double t);
private slots:
void newFrequencyData( const SpectrumUpdateEvent* );
+ void UpdateGuiTimer();
protected:
@@ -110,6 +113,9 @@ private:
int d_plot_waterfall3d;
int d_plot_time;
int d_plot_constellation;
+
+ QTimer *displayTimer;
+ double d_update_time;
};
#endif /* SPECTRUM_DISPLAY_FORM_H */