Only allow optimized FFT window sizes in project editor

This commit is contained in:
Alex Spataru 2024-08-05 22:57:17 -05:00
parent 6fe62803f4
commit e52a9f9455
2 changed files with 21 additions and 16 deletions

View File

@ -201,17 +201,22 @@ Widgets.Window {
// FFT max frequency // FFT max frequency
// //
Label { Label {
text: qsTr("FFT Samples:") text: qsTr("FFT Window Size:")
visible: root.fftSamplesVisible visible: root.fftSamplesVisible
} TextField { } ComboBox {
id: fftSamples id: fftSamples
Layout.fillWidth: true Layout.fillWidth: true
visible: root.fftSamplesVisible visible: root.fftSamplesVisible
text: Cpp_Project_Model.datasetFFTSamples(group, dataset) model: [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]
onTextChanged: Cpp_Project_Model.setDatasetFFTSamples(group, dataset, parseInt(text)) onCurrentValueChanged: Cpp_Project_Model.setDatasetFFTSamples(group, dataset, currentValue)
validator: IntValidator {
bottom: 8 property int actualValue: Cpp_Project_Model.datasetFFTSamples(group, dataset)
top: 40 * 1000 Component.onCompleted: {
var index = model.indexOf(actualValue)
if (index !== -1)
fftSamples.currentIndex = index
else
fftSamples.currentIndex = 7
} }
} }

View File

@ -51,17 +51,13 @@ IO::Drivers::Serial::Serial()
setParity(parityList().indexOf(tr("None"))); setParity(parityList().indexOf(tr("None")));
setFlowControl(flowControlList().indexOf(tr("None"))); setFlowControl(flowControlList().indexOf(tr("None")));
// clang-format off
// Build serial devices list and refresh it every second // Build serial devices list and refresh it every second
connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout1Hz, connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout1Hz, this,
this, &IO::Drivers::Serial::refreshSerialDevices); &IO::Drivers::Serial::refreshSerialDevices);
// Update connect button status when user selects a serial device // Update connect button status when user selects a serial device
connect(this, &IO::Drivers::Serial::portIndexChanged, connect(this, &IO::Drivers::Serial::portIndexChanged, this,
this, &IO::Drivers::Serial::configurationChanged); &IO::Drivers::Serial::configurationChanged);
// clang-format on
} }
/** /**
@ -295,7 +291,11 @@ quint8 IO::Drivers::Serial::flowControlIndex() const
*/ */
StringList IO::Drivers::Serial::portList() const StringList IO::Drivers::Serial::portList() const
{ {
if (m_portList.count() > 0)
return m_portList; return m_portList;
else
return StringList{tr("Select port")};
} }
/** /**