summaryrefslogtreecommitdiff
path: root/gr-qtgui/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-qtgui/src/lib')
-rw-r--r--gr-qtgui/src/lib/ConstellationDisplayPlot.h1
-rw-r--r--gr-qtgui/src/lib/FrequencyDisplayPlot.cc25
-rw-r--r--gr-qtgui/src/lib/FrequencyDisplayPlot.h5
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.cc8
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.h4
-rw-r--r--gr-qtgui/src/lib/TimeDomainDisplayPlot.h1
-rw-r--r--gr-qtgui/src/lib/Waterfall3DDisplayPlot.h1
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.h1
-rw-r--r--gr-qtgui/src/lib/qtgui.i21
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.cc27
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.h15
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_f.cc31
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_f.h18
-rw-r--r--gr-qtgui/src/lib/spectrumUpdateEvents.h1
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.cc29
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.h6
16 files changed, 120 insertions, 74 deletions
diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.h b/gr-qtgui/src/lib/ConstellationDisplayPlot.h
index 20de2164a..612cd2b39 100644
--- a/gr-qtgui/src/lib/ConstellationDisplayPlot.h
+++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef CONSTELLATION_DISPLAY_PLOT_HPP
#define CONSTELLATION_DISPLAY_PLOT_HPP
+#include <cstdio>
#include <qwt_plot.h>
#include <qwt_painter.h>
#include <qwt_plot_canvas.h>
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
index 63d68b9b3..154c8d234 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc
@@ -117,8 +117,10 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
+ _minYAxis = -120;
+ _maxYAxis = 10;
setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
- set_yaxis(-210, 5);
+ setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis);
setAxisTitle(QwtPlot::yLeft, "Power (dB)");
// Automatically deleted when parent is deleted
@@ -225,7 +227,15 @@ FrequencyDisplayPlot::~FrequencyDisplayPlot()
void
FrequencyDisplayPlot::set_yaxis(double min, double max)
{
- setAxisScale(QwtPlot::yLeft, min, max);
+ // Get the new max/min values for the plot
+ _minYAxis = min;
+ _maxYAxis = max;
+
+ // Set the axis max/min to the new values
+ setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis);
+
+ // Reset the base zoom level to the new axis scale set here
+ _zoomer->setZoomBase();
}
void
@@ -249,17 +259,14 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq,
_startFrequency = startFreq;
_stopFrequency = stopFreq;
_resetXAxisPoints();
-
+
setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency);
setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(2));
setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str()));
((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(2);
// Load up the new base zoom settings
- QwtDoubleRect newSize = _zoomer->zoomBase();
- newSize.setLeft(_startFrequency);
- newSize.setWidth(_stopFrequency-_startFrequency);
- _zoomer->setZoomBase(newSize);
+ _zoomer->setZoomBase();
// Zooms back to the base and clears any other zoom levels
_zoomer->zoom(0);
@@ -362,7 +369,7 @@ void
FrequencyDisplayPlot::ClearMaxData()
{
for(int64_t number = 0; number < _numPoints; number++){
- _maxFFTPoints[number] = -280.0;
+ _maxFFTPoints[number] = _maxYAxis;
}
}
@@ -370,7 +377,7 @@ void
FrequencyDisplayPlot::ClearMinData()
{
for(int64_t number = 0; number < _numPoints; number++){
- _minFFTPoints[number] = 200.0;
+ _minFFTPoints[number] = _minYAxis;
}
}
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/src/lib/FrequencyDisplayPlot.h
index 31f2055b4..5e8282962 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.h
+++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef FREQUENCY_DISPLAY_PLOT_HPP
#define FREQUENCY_DISPLAY_PLOT_HPP
+#include <cstdio>
#include <qwt_plot.h>
#include <qwt_painter.h>
#include <qwt_plot_canvas.h>
@@ -52,7 +53,9 @@ private:
double _startFrequency;
double _stopFrequency;
-
+ double _maxYAxis;
+ double _minYAxis;
+
QwtPlotCurve* _fft_plot_curve;
QwtPlotCurve* _min_fft_plot_curve;
QwtPlotCurve* _max_fft_plot_curve;
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc
index f35062ea0..f196d7c5f 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc
@@ -10,7 +10,8 @@ const long SpectrumGUIClass::MAX_FFT_SIZE;
const long SpectrumGUIClass::MIN_FFT_SIZE;
SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
- const uint64_t fftSize,
+ const uint64_t fftSize,
+ const double newCenterFrequency,
const double newStartFrequency,
const double newStopFrequency)
{
@@ -25,7 +26,7 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
_pendingGUIUpdateEventsCount = 0;
_droppedEntriesCount = 0;
- _centerFrequency = 0;
+ _centerFrequency = newCenterFrequency;
_startFrequency = newStartFrequency;
_stopFrequency = newStopFrequency;
@@ -113,6 +114,9 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
// Draw Blank Display
UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, 1.0, get_highres_clock(), true);
+ // Set up the initial frequency axis settings
+ SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency);
+
// GUI Thread only
qApp->processEvents();
}
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h
index b87b50cab..9a55271df 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.h
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.h
@@ -23,7 +23,9 @@ class SpectrumGUIClass
{
public:
SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize,
- const double newStartFrequency, const double newStopFrequency);
+ const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency);
~SpectrumGUIClass();
void Reset();
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
index 9f0ecfa26..9c6364af2 100644
--- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
+++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef TIME_DOMAIN_DISPLAY_PLOT_HPP
#define TIME_DOMAIN_DISPLAY_PLOT_HPP
+#include <cstdio>
#include <qwt_plot.h>
#include <qwt_painter.h>
#include <qwt_plot_canvas.h>
diff --git a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h
index 8af5f6b54..f46f260e3 100644
--- a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h
+++ b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef WATERFALL_3D_DISPLAY_PLOT_HPP
#define WATERFALL_3D_DISPLAY_PLOT_HPP
+#include <cstdio>
#include <highResTimeFunctions.h>
#include <waterfallGlobalData.h>
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
index d5371a037..fbbb69a5b 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef WATERFALL_DISPLAY_PLOT_HPP
#define WATERFALL_DISPLAY_PLOT_HPP
+#include <cstdio>
#include <qwt_plot.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
diff --git a/gr-qtgui/src/lib/qtgui.i b/gr-qtgui/src/lib/qtgui.i
index 0c2e7a542..d2f734fdf 100644
--- a/gr-qtgui/src/lib/qtgui.i
+++ b/gr-qtgui/src/lib/qtgui.i
@@ -30,7 +30,7 @@
GR_SWIG_BLOCK_MAGIC(qtgui,sink_c)
qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
- float fmin=-0.5, float fmax=0.5,
+ double fc=0, double bw=1.0,
const std::string &name="Display",
bool plotfreq=true, bool plotwaterfall=true,
bool plotwaterfall3d=true, bool plottime=true,
@@ -42,7 +42,7 @@ class qtgui_sink_c : public gr_block
{
private:
friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
@@ -50,7 +50,7 @@ private:
bool use_openGL,
QWidget *parent);
qtgui_sink_c (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
@@ -63,8 +63,7 @@ public:
PyObject* pyqwidget();
void set_frequency_range(const double centerfreq,
- const double startfreq,
- const double stopfreq);
+ const double bandwidth);
void set_time_domain_axis(double min, double max);
void set_constellation_axis(double xmin, double xmax,
double ymin, double ymax);
@@ -79,29 +78,32 @@ public:
GR_SWIG_BLOCK_MAGIC(qtgui,sink_f)
qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
- float fmin=-0.5, float fmax=0.5,
+ double fc=0, double bw=0.0,
const std::string &name="Display",
bool plotfreq=true, bool plotwaterfall=true,
bool plotwaterfall3d=true, bool plottime=true,
bool plotconst=true,
+ bool use_openGL=true,
QWidget *parent=NULL);
class qtgui_sink_f : public gr_block
{
private:
friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
qtgui_sink_f (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
public:
@@ -109,8 +111,7 @@ public:
PyObject* pyqwidget();
void set_frequency_range(const double centerfreq,
- const double startfreq,
- const double stopfreq);
+ const double bandwidth);
void set_time_domain_axis(double min, double max);
void set_constellation_axis(double xmin, double xmax,
double ymin, double ymax);
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc
index 08cfdab76..b1fd60d34 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.cc
+++ b/gr-qtgui/src/lib/qtgui_sink_c.cc
@@ -32,7 +32,7 @@
qtgui_sink_c_sptr
qtgui_make_sink_c (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
@@ -41,7 +41,7 @@ qtgui_make_sink_c (int fftsize, int wintype,
QWidget *parent)
{
return qtgui_sink_c_sptr (new qtgui_sink_c (fftsize, wintype,
- fmin, fmax, name,
+ fc, bw, name,
plotfreq, plotwaterfall,
plotwaterfall3d, plottime,
plotconst,
@@ -50,7 +50,7 @@ qtgui_make_sink_c (int fftsize, int wintype,
}
qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
@@ -62,7 +62,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
gr_make_io_signature (0, 0, 0)),
d_fftsize(fftsize),
d_wintype((gr_firdes::win_type)(wintype)),
- d_fmin(fmin), d_fmax(fmax), d_name(name),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall),
d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime),
d_plotconst(plotconst),
@@ -119,9 +119,15 @@ qtgui_sink_c::initialize(const bool opengl)
d_qApplication = new QApplication(argc, argv);
}
+ if(d_center_freq < 0) {
+ throw std::runtime_error("qtgui_sink_c: Received bad center frequency.\n");
+ }
+
uint64_t maxBufferSize = 32768;
d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize,
- d_fmin, d_fmax);
+ d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
d_main_gui->SetDisplayTitle(d_name);
d_main_gui->SetFFTSize(d_fftsize);
@@ -160,10 +166,13 @@ qtgui_sink_c::pyqwidget()
void
qtgui_sink_c::set_frequency_range(const double centerfreq,
- const double startfreq,
- const double stopfreq)
+ const double bandwidth)
{
- d_main_gui->SetFrequencyRange(centerfreq, startfreq, stopfreq);
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
}
void
@@ -282,7 +291,7 @@ qtgui_sink_c::general_work (int noutput_items,
const timespec currentTime = get_highres_clock();
const timespec lastUpdateGUITime = d_main_gui->GetLastGUIUpdateTime();
- if(diff_timespec(currentTime, lastUpdateGUITime) > 0.25) {
+ if(diff_timespec(currentTime, lastUpdateGUITime) > 0.05) {
if(d_index) {
int filler = std::min(d_fftsize - d_index, noutput_items);
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h
index 0b3ba99e2..1c9d59200 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.h
+++ b/gr-qtgui/src/lib/qtgui_sink_c.h
@@ -35,7 +35,7 @@ class qtgui_sink_c;
typedef boost::shared_ptr<qtgui_sink_c> qtgui_sink_c_sptr;
qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
- float fmin=-0.5, float fmax=0.5,
+ double fc=0, double bandwidth=1.0,
const std::string &name="Spectrum Display",
bool plotfreq=true, bool plotwaterfall=true,
bool plotwaterfall3d=true, bool plottime=true,
@@ -47,7 +47,7 @@ class qtgui_sink_c : public gr_block
{
private:
friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
@@ -55,7 +55,7 @@ private:
bool use_openGL,
QWidget *parent);
qtgui_sink_c (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
@@ -65,13 +65,13 @@ private:
// use opengl to force OpenGL on or off
// this might be necessary for sessions over SSH
- void initialize(const bool opengl);
+ void initialize(const bool opengl=true);
int d_fftsize;
gr_firdes::win_type d_wintype;
std::vector<float> d_window;
- float d_fmin;
- float d_fmax;
+ double d_center_freq;
+ double d_bandwidth;
std::string d_name;
pthread_mutex_t d_pmutex;
@@ -102,8 +102,7 @@ public:
PyObject* pyqwidget();
void set_frequency_range(const double centerfreq,
- const double startfreq,
- const double stopfreq);
+ const double bandwidth);
void set_time_domain_axis(double min, double max);
void set_constellation_axis(double xmin, double xmax,
diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/src/lib/qtgui_sink_f.cc
index 1f76bb359..4c526f09f 100644
--- a/gr-qtgui/src/lib/qtgui_sink_f.cc
+++ b/gr-qtgui/src/lib/qtgui_sink_f.cc
@@ -32,34 +32,37 @@
qtgui_sink_f_sptr
qtgui_make_sink_f (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent)
{
return qtgui_sink_f_sptr (new qtgui_sink_f (fftsize, wintype,
- fmin, fmax, name,
+ fc, bw, name,
plotfreq, plotwaterfall,
plotwaterfall3d, plottime,
plotconst,
+ use_openGL,
parent));
}
qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent)
: gr_block ("sink_f",
gr_make_io_signature (1, 1, sizeof(float)),
gr_make_io_signature (0, 0, 0)),
d_fftsize(fftsize),
d_wintype((gr_firdes::win_type)(wintype)),
- d_fmin(fmin), d_fmax(fmax), d_name(name),
+ d_center_freq(fc), d_bandwidth(bw), d_name(name),
d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall),
d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime),
d_plotconst(plotconst),
@@ -82,7 +85,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype,
buildwindow();
- initialize();
+ initialize(use_openGL);
}
qtgui_sink_f::~qtgui_sink_f()
@@ -104,7 +107,7 @@ void qtgui_sink_f::unlock()
}
void
-qtgui_sink_f::initialize()
+qtgui_sink_f::initialize(const bool opengl)
{
if(qApp != NULL) {
d_qApplication = qApp;
@@ -118,7 +121,9 @@ qtgui_sink_f::initialize()
uint64_t maxBufferSize = 32768;
d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize,
- d_fmin, d_fmax);
+ d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
d_main_gui->SetDisplayTitle(d_name);
d_main_gui->SetFFTSize(d_fftsize);
d_main_gui->SetWindowType((int)d_wintype);
@@ -126,7 +131,8 @@ qtgui_sink_f::initialize()
d_main_gui->OpenSpectrumWindow(d_parent,
d_plotfreq, d_plotwaterfall,
d_plotwaterfall3d, d_plottime,
- d_plotconst);
+ d_plotconst,
+ opengl);
d_object = new qtgui_obj(d_qApplication);
qApp->postEvent(d_object, new qtgui_event(&d_pmutex));
@@ -154,10 +160,13 @@ qtgui_sink_f::pyqwidget()
void
qtgui_sink_f::set_frequency_range(const double centerfreq,
- const double startfreq,
- const double stopfreq)
+ const double bandwidth)
{
- d_main_gui->SetFrequencyRange(centerfreq, startfreq, stopfreq);
+ d_center_freq = centerfreq;
+ d_bandwidth = bandwidth;
+ d_main_gui->SetFrequencyRange(d_center_freq,
+ -d_bandwidth/2.0,
+ d_bandwidth/2.0);
}
void
diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/src/lib/qtgui_sink_f.h
index 31baa1def..4c24b4983 100644
--- a/gr-qtgui/src/lib/qtgui_sink_f.h
+++ b/gr-qtgui/src/lib/qtgui_sink_f.h
@@ -35,38 +35,41 @@ class qtgui_sink_f;
typedef boost::shared_ptr<qtgui_sink_f> qtgui_sink_f_sptr;
qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
- float fmin=-0.5, float fmax=0.5,
+ double fc=0, double bw=1.0,
const std::string &name="Spectrum Display",
bool plotfreq=true, bool plotwaterfall=true,
bool plotwaterfall3d=true, bool plottime=true,
bool plotconst=true,
+ bool use_openGL=true,
QWidget *parent=NULL);
class qtgui_sink_f : public gr_block
{
private:
friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
qtgui_sink_f (int fftsize, int wintype,
- float fmin, float fmax,
+ double fc, double bw,
const std::string &name,
bool plotfreq, bool plotwaterfall,
bool plotwaterfall3d, bool plottime,
bool plotconst,
+ bool use_openGL,
QWidget *parent);
- void initialize();
+ void initialize(const bool opengl=true);
int d_fftsize;
gr_firdes::win_type d_wintype;
std::vector<float> d_window;
- float d_fmin;
- float d_fmax;
+ double d_center_freq;
+ double d_bandwidth;
std::string d_name;
pthread_mutex_t d_pmutex;
@@ -97,8 +100,7 @@ public:
PyObject* pyqwidget();
void set_frequency_range(const double centerfreq,
- const double startfreq,
- const double stopfreq);
+ const double bandwidth);
void set_time_domain_axis(double min, double max);
void set_constellation_axis(double xmin, double xmax,
diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.h b/gr-qtgui/src/lib/spectrumUpdateEvents.h
index a758d884c..75fa27324 100644
--- a/gr-qtgui/src/lib/spectrumUpdateEvents.h
+++ b/gr-qtgui/src/lib/spectrumUpdateEvents.h
@@ -1,6 +1,7 @@
#ifndef SPECTRUM_UPDATE_EVENTS_H
#define SPECTRUM_UPDATE_EVENTS_H
+#include <stdint.h>
#include <QEvent>
#include <QString>
#include <complex>
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc
index f82961191..427e70a27 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/src/lib/spectrumdisplayform.cc
@@ -473,19 +473,29 @@ SpectrumDisplayForm::PowerLineEdit_textChanged( const QString &valueString )
}
void
-SpectrumDisplayForm::SetFrequencyRange(const double newStartFrequency,
- const double newStopFrequency,
- const double newCenterFrequency)
+SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency)
{
- double fdiff = abs(newStartFrequency - newStopFrequency);
+ double fdiff;
+ if(UseRFFrequenciesCheckBox->isChecked()) {
+ fdiff = newCenterFrequency;
+ }
+ else {
+ fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency));
+ }
if(fdiff > 0) {
std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"};
double units10 = floor(log10(fdiff));
- double units3 = floor(units10 / 3.0);
- double units = pow(10, units10);
+ double units3 = std::max(floor(units10 / 3.0), 0.0);
+ double units = pow(10, (units10-fmod(units10, 3.0)));
int iunit = static_cast<int>(units3);
+ _startFrequency = newStartFrequency;
+ _stopFrequency = newStopFrequency;
+ _centerFrequency = newCenterFrequency;
+
_frequencyDisplayPlot->SetFrequencyRange(newStartFrequency,
newStopFrequency,
newCenterFrequency,
@@ -635,12 +645,7 @@ SpectrumDisplayForm::WindowTypeChanged( int newItem )
void
SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag )
{
- if(useRFFlag){
- SetFrequencyRange(_startFrequency, _stopFrequency, _centerFrequency);
- }
- else{
- SetFrequencyRange(_startFrequency, _stopFrequency, 0.0 );
- }
+ SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency);
}
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/src/lib/spectrumdisplayform.h
index a7c5201fe..bf8023209 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.h
+++ b/gr-qtgui/src/lib/spectrumdisplayform.h
@@ -42,9 +42,9 @@ public slots:
void MinHoldResetBtn_clicked();
void MaxHoldResetBtn_clicked();
void PowerLineEdit_textChanged( const QString& valueString );
- void SetFrequencyRange( const double newStartFrequency,
- const double newStopFrequency,
- const double newCenterFrequency );
+ void SetFrequencyRange( const double newCenterFrequency,
+ const double newStartFrequency,
+ const double newStopFrequency );
void closeEvent( QCloseEvent * e );
void WindowTypeChanged( int newItem );
void UseRFFrequenciesCB( bool useRFFlag );