summaryrefslogtreecommitdiff
path: root/gr-qtgui/lib
diff options
context:
space:
mode:
authorJosh Blum2011-06-07 22:39:07 -0400
committerTom Rondeau2011-06-07 22:39:07 -0400
commiteae515a2356a140e4407945eed21e56b90bb98d9 (patch)
tree98755d38a2fa4b7bed41a38e446b6618252f8cb2 /gr-qtgui/lib
parent1418dccc89f554202e33d4d743c910407e8710a6 (diff)
downloadgnuradio-eae515a2356a140e4407945eed21e56b90bb98d9.tar.gz
gnuradio-eae515a2356a140e4407945eed21e56b90bb98d9.tar.bz2
gnuradio-eae515a2356a140e4407945eed21e56b90bb98d9.zip
qtgui: removed most of the functions in highResTimeFunctions.h
Diffstat (limited to 'gr-qtgui/lib')
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.cc4
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.cc4
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.cc8
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc22
-rw-r--r--gr-qtgui/lib/highResTimeFunctions.h27
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_c.cc5
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_f.cc4
7 files changed, 24 insertions, 50 deletions
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc
index 77550de81..cecfc1d29 100644
--- a/gr-qtgui/lib/ConstellationDisplayPlot.cc
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc
@@ -58,7 +58,7 @@ protected:
ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent)
: QwtPlot(parent)
{
- highres_timespec_reset(_lastReplot);
+ _lastReplot = 0;
resize(parent->width(), parent->height());
@@ -183,7 +183,7 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints,
const double timeInterval)
{
if((numDataPoints > 0) &&
- (diff_highres_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
+ (get_highres_clock() - _lastReplot > timeInterval*gruel::high_res_timer_tps())) {
if(numDataPoints != _numPoints){
_numPoints = numDataPoints;
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index 6b3fa175b..5db32c6f1 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -120,7 +120,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
_startFrequency = 0;
_stopFrequency = 4000;
- highres_timespec_reset(_lastReplot);
+ _lastReplot = 0;
resize(parent->width(), parent->height());
@@ -362,7 +362,7 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat
{
// Only update plot if there is data and if the time interval has elapsed
if((numDataPoints > 0) &&
- (diff_highres_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
+ (get_highres_clock() - _lastReplot > timeInterval*gruel::high_res_timer_tps())) {
if(numDataPoints != _numPoints) {
_numPoints = numDataPoints;
diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
index fda58d78e..002e944ea 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -54,7 +54,7 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
_windowType = 5;
- highres_timespec_reset(_lastGUIUpdateTime);
+ _lastGUIUpdateTime = 0;
_windowOpennedFlag = false;
_fftBuffersCreatedFlag = false;
@@ -123,7 +123,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
qApp->postEvent(_spectrumDisplayForm,
new QEvent(QEvent::Type(QEvent::User+3)));
- highres_timespec_reset(_lastGUIUpdateTime);
+ _lastGUIUpdateTime = 0;
// Draw Blank Display
UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, get_highres_clock(), true);
@@ -286,8 +286,8 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag,
const highres_timespec currentTime = get_highres_clock();
const highres_timespec lastUpdateGUITime = GetLastGUIUpdateTime();
- if((diff_highres_timespec(currentTime, lastUpdateGUITime) > (4*_updateTime)) &&
- (GetPendingGUIUpdateEvents() > 0) && !highres_timespec_empty(lastUpdateGUITime)) {
+ if((currentTime - lastUpdateGUITime > (4*_updateTime)*gruel::high_res_timer_tps()) &&
+ (GetPendingGUIUpdateEvents() > 0) && lastUpdateGUITime != 0) {
// Do not update the display if too much data is pending to be displayed
_droppedEntriesCount++;
}
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index cc7ab14a3..90386281a 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -110,7 +110,7 @@ class TimeScaleData
public:
TimeScaleData()
{
- highres_timespec_reset(_zeroTime);
+ _zeroTime = 0;
_secondsPerLine = 1.0;
}
@@ -160,15 +160,15 @@ public:
virtual QwtText label(double value) const
{
- highres_timespec lineTime = highres_timespec_add(GetZeroTime(), -value*GetSecondsPerLine());
- unsigned long milliseconds = lineTime*1000/gruel::high_res_timer_tps();
- std::string time_str = pt::to_simple_string(pt::from_time_t(milliseconds/1000));
+ double secs = GetZeroTime()/double(gruel::high_res_timer_tps()) - (value * GetSecondsPerLine());
+ std::string time_str = pt::to_simple_string(pt::from_time_t(time_t(secs)));
// lops off the YYYY-mmm-DD part of the string
size_t ind = time_str.find(" ");
if(ind != std::string::npos)
time_str = time_str.substr(ind);
- return QwtText(QString("").sprintf("%s.%03ld", time_str.c_str(), milliseconds%1000));
+ return QwtText(QString("").sprintf("%s.%03ld", time_str.c_str(),
+ long(std::fmod(secs*1000, 1000))));
}
virtual void initiateUpdate()
@@ -213,15 +213,15 @@ protected:
using QwtPlotZoomer::trackerText;
virtual QwtText trackerText( const QwtDoublePoint& p ) const
{
- highres_timespec lineTime = highres_timespec_add(GetZeroTime(), -p.y()*GetSecondsPerLine());
- unsigned long milliseconds = lineTime*1000/gruel::high_res_timer_tps();
- std::string time_str = pt::to_simple_string(pt::from_time_t(milliseconds/1000));
+ double secs = GetZeroTime()/double(gruel::high_res_timer_tps()) - (p.y() * GetSecondsPerLine());
+ std::string time_str = pt::to_simple_string(pt::from_time_t(time_t(secs)));
// lops off the YYYY-mmm-DD part of the string
size_t ind = time_str.find(" ");
if(ind != std::string::npos)
time_str = time_str.substr(ind);
- QString yLabel(QString("").sprintf("%s.%03ld", time_str.c_str(), milliseconds%1000));
+ QString yLabel(QString("").sprintf("%s.%03ld", time_str.c_str(),
+ long(std::fmod(secs*1000, 1000))));
QwtText t(QString("%1 %2, %3").
arg(p.x(), 0, 'f', GetFrequencyPrecision()).
@@ -256,7 +256,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
setAxisTitle(QwtPlot::yLeft, "Time");
setAxisScaleDraw(QwtPlot::yLeft, new QwtTimeScaleDraw());
- highres_timespec_reset(_lastReplot);
+ _lastReplot = 0;
d_spectrogram = new PlotWaterfall(_waterfallData, "Waterfall Display");
@@ -410,7 +410,7 @@ WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
_lastReplot = get_highres_clock();
}
- if(diff_highres_timespec(get_highres_clock(), _lastReplot) > timePerFFT) {
+ if(get_highres_clock() - _lastReplot > timePerFFT*gruel::high_res_timer_tps()) {
//FIXME: We may want to average the data between these updates to smooth display
_waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames);
_waterfallData->IncrementNumLinesToUpdate();
diff --git a/gr-qtgui/lib/highResTimeFunctions.h b/gr-qtgui/lib/highResTimeFunctions.h
index 18cf66ede..6b3844901 100644
--- a/gr-qtgui/lib/highResTimeFunctions.h
+++ b/gr-qtgui/lib/highResTimeFunctions.h
@@ -23,41 +23,14 @@
#ifndef HIGH_RES_TIME_FUNCTIONS_H
#define HIGH_RES_TIME_FUNCTIONS_H
-#include <cmath>
#include <gruel/high_res_timer.h>
typedef gruel::high_res_timer_type highres_timespec;
-static inline void
-highres_timespec_reset(highres_timespec &ret)
-{
- ret = 0;
-}
-
-static inline highres_timespec
-highres_timespec_add(const highres_timespec &t1, double t)
-{
- return t1 + t*gruel::high_res_timer_tps();
-}
-
-static inline double
-diff_highres_timespec(const highres_timespec &t1,
- const highres_timespec &t0)
-{
- return std::abs(double(t1 - t0)/gruel::high_res_timer_tps());
-}
-
static inline highres_timespec
get_highres_clock()
{
return gruel::high_res_timer_now();
}
-static inline bool
-highres_timespec_empty(const highres_timespec &t)
-{
- return t == 0;
-}
-
-
#endif /* HIGH_RES_TIME_FUNCTIONS_H */
diff --git a/gr-qtgui/lib/qtgui_time_sink_c.cc b/gr-qtgui/lib/qtgui_time_sink_c.cc
index 79b74f938..3d5786da1 100644
--- a/gr-qtgui/lib/qtgui_time_sink_c.cc
+++ b/gr-qtgui/lib/qtgui_time_sink_c.cc
@@ -94,7 +94,7 @@ qtgui_time_sink_c::initialize()
// initialize update time to 10 times a second
set_update_time(0.1);
- highres_timespec_reset(d_last_time);
+ d_last_time = 0;
}
@@ -171,7 +171,8 @@ qtgui_time_sink_c::general_work (int noutput_items,
}
// Update the plot if its time
- if(diff_highres_timespec(d_current_time, d_last_time) > d_update_time) {
+ //if(diff_highres_timespec(d_current_time, d_last_time) > d_update_time) {
+ if(get_highres_clock() - d_last_time > d_update_time) {
d_last_time = d_current_time;
d_qApplication->postEvent(d_main_gui,
new TimeUpdateEvent(d_residbufs, d_size));
diff --git a/gr-qtgui/lib/qtgui_time_sink_f.cc b/gr-qtgui/lib/qtgui_time_sink_f.cc
index 20caedac7..8fd867340 100644
--- a/gr-qtgui/lib/qtgui_time_sink_f.cc
+++ b/gr-qtgui/lib/qtgui_time_sink_f.cc
@@ -94,7 +94,7 @@ qtgui_time_sink_f::initialize()
// initialize update time to 10 times a second
set_update_time(0.1);
- highres_timespec_reset(d_last_time);
+ d_last_time = 0;
}
@@ -170,7 +170,7 @@ qtgui_time_sink_f::general_work (int noutput_items,
}
// Update the plot if its time
- if(diff_highres_timespec(d_current_time, d_last_time) > d_update_time) {
+ if(get_highres_clock() - d_last_time > d_update_time) {
d_last_time = d_current_time;
d_qApplication->postEvent(d_main_gui,
new TimeUpdateEvent(d_residbufs, d_size));