diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-03-23 14:36:51 -0700 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-03-23 14:36:51 -0700 |
commit | fce06576a937bf16f12b012e2739e07ad8860f67 (patch) | |
tree | f3f83c08fa2b90fd2d8bbeb2e006b4ea56a72658 | |
parent | f042e44d18c481e7e2ca37895afbd6ecf42061a3 (diff) |
qtgui: fixes issue #767.
If FFT Size is set to 2048 and the half-width is selected for the
float graph type, then this would cause the x-axis display to show
-fs/2 to +fs/2 instead of the correct 0 to +fs/2. The problem was the
default numpoints was 1024, so with half 2048, the resetting of the
x-axis call was never hitting. Setting to 0 to force updates during
the first display.
Also puts protections around the allowable FFT sizes.
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.cc | 3 | ||||
-rw-r--r-- | gr-qtgui/lib/freq_sink_c_impl.cc | 5 | ||||
-rw-r--r-- | gr-qtgui/lib/freq_sink_f_impl.cc | 5 |
3 files changed, 9 insertions, 4 deletions
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 41050edfc2..384ec8d633 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -90,7 +90,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) d_start_frequency = -1; d_stop_frequency = 1; - d_numPoints = 1024; + d_numPoints = 0; d_min_fft_data = new double[d_numPoints]; d_max_fft_data = new double[d_numPoints]; d_xdata = new double[d_numPoints]; @@ -287,7 +287,6 @@ FrequencyDisplayPlot::setFrequencyRange(const double centerfreq, else startFreq = (centerfreq - bandwidth/2.0f) / units; - d_xdata_multiplier = units; bool reset = false; diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc index fa8e38dd9f..adc1f76857 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -198,7 +198,10 @@ namespace gr { void freq_sink_c_impl::set_fft_size(const int fftsize) { - d_main_gui->setFFTSize(fftsize); + if((fftsize > 16) && (fftsize < 16384)) + d_main_gui->setFFTSize(fftsize); + else + throw std::runtime_error("freq_sink: FFT size must be > 16 and < 16384."); } int diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc index 1df915b32c..1e01208b27 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -197,7 +197,10 @@ namespace gr { void freq_sink_f_impl::set_fft_size(const int fftsize) { - d_main_gui->setFFTSize(fftsize); + if((fftsize > 16) && (fftsize < 16384)) + d_main_gui->setFFTSize(fftsize); + else + throw std::runtime_error("freq_sink: FFT size must be > 16 and < 16384."); } int |