Enforce minimum FFT sample size

This commit is contained in:
Alex Spataru 2021-10-19 01:24:19 -05:00
parent e92aa3cce7
commit 7333519f60
3 changed files with 3 additions and 2 deletions

View File

@ -193,7 +193,7 @@ Widgets.Window {
text: Cpp_JSON_Editor.datasetFFTSamples(group, dataset) text: Cpp_JSON_Editor.datasetFFTSamples(group, dataset)
onTextChanged: Cpp_JSON_Editor.setDatasetFFTSamples(group, dataset, parseInt(text)) onTextChanged: Cpp_JSON_Editor.setDatasetFFTSamples(group, dataset, parseInt(text))
validator: IntValidator { validator: IntValidator {
bottom: 128 bottom: 8
top: 40 * 1000 top: 40 * 1000
} }
} }

View File

@ -38,6 +38,7 @@ Dataset::Dataset(QObject *parent)
, m_max("0") , m_max("0")
, m_min("0") , m_min("0")
, m_alarm("0") , m_alarm("0")
, m_fftSamples(8)
{ {
} }

View File

@ -93,7 +93,7 @@ FFTPlot::FFTPlot(const int index)
if (dataset) if (dataset)
{ {
// Calculate FFT size // Calculate FFT size
int size = dataset->fftSamples(); int size = qMax(8, dataset->fftSamples());
// Ensure that FFT size is valid // Ensure that FFT size is valid
while (m_transformer.setSize(size) != QFourierTransformer::FixedSize) while (m_transformer.setSize(size) != QFourierTransformer::FixedSize)