diff options
author | Volker Schroer <3470424+dl1ksv@users.noreply.github.com> | 2022-01-11 12:55:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 06:55:15 -0500 |
commit | fdecbb9b105fa452bd9352709e537dc45b900db4 (patch) | |
tree | a2de9664d8487ab9c65b68df4bfc47ed24991dcc /gr-qtgui/lib/sink_c_impl.cc | |
parent | 5277c1ead928720ffc1e9b159c513aa269810802 (diff) |
qtgui: bounds checking and pow of 2 check for freq/waterfall sinks
* qtgui: freq_sink waterfall_sink sink: Add bounds checking to GRC bindings
In addition:
fftsize starts in the runtime gui of the f/c sink with 512.
Adjust it to 32 , as in freq_sink_f/c
Check inside the sink_(f/c) block, if the fftsize is valid, to avoid core dump.
Signed-off-by: Volker Schroer <3470424+dl1ksv@users.noreply.github.com>
* qtgui: freq_sink waterfall_sink sink: Add power-of-two check to GRC bindings
Signed-off-by: Volker Schroer <3470424+dl1ksv@users.noreply.github.com>
Diffstat (limited to 'gr-qtgui/lib/sink_c_impl.cc')
-rw-r--r-- | gr-qtgui/lib/sink_c_impl.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc index 8fe6a067c4..9ecb06d9c6 100644 --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -142,8 +142,18 @@ QWidget* sink_c_impl::qwidget() { return d_main_gui.qwidget(); } void sink_c_impl::set_fft_size(const int fftsize) { - d_fftsize = fftsize; - d_main_gui.setFFTSize(fftsize); + if ((fftsize >= d_main_gui.MIN_FFT_SIZE) && (fftsize <= d_main_gui.MAX_FFT_SIZE)) { + d_fftsize = fftsize; + d_main_gui.setFFTSize(fftsize); + } else { + GR_LOG_INFO( + d_logger, + fmt::format("FFT size must be >= {} and <= {}.\nSo falling back to {}.", + d_main_gui.MIN_FFT_SIZE, + d_main_gui.MAX_FFT_SIZE, + d_main_gui.DEFAULT_FFT_SIZE)); + d_main_gui.setFFTSize(d_main_gui.DEFAULT_FFT_SIZE); + } } int sink_c_impl::fft_size() const { return d_fftsize; } |