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
//
Label {
text: qsTr("FFT Samples:")
text: qsTr("FFT Window Size:")
visible: root.fftSamplesVisible
} TextField {
} ComboBox {
id: fftSamples
Layout.fillWidth: true
visible: root.fftSamplesVisible
text: Cpp_Project_Model.datasetFFTSamples(group, dataset)
onTextChanged: Cpp_Project_Model.setDatasetFFTSamples(group, dataset, parseInt(text))
validator: IntValidator {
bottom: 8
top: 40 * 1000
model: [8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]
onCurrentValueChanged: Cpp_Project_Model.setDatasetFFTSamples(group, dataset, currentValue)
property int actualValue: Cpp_Project_Model.datasetFFTSamples(group, dataset)
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")));
setFlowControl(flowControlList().indexOf(tr("None")));
// clang-format off
// Build serial devices list and refresh it every second
connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout1Hz,
this, &IO::Drivers::Serial::refreshSerialDevices);
connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout1Hz, this,
&IO::Drivers::Serial::refreshSerialDevices);
// Update connect button status when user selects a serial device
connect(this, &IO::Drivers::Serial::portIndexChanged,
this, &IO::Drivers::Serial::configurationChanged);
// clang-format on
connect(this, &IO::Drivers::Serial::portIndexChanged, this,
&IO::Drivers::Serial::configurationChanged);
}
/**
@ -295,7 +291,11 @@ quint8 IO::Drivers::Serial::flowControlIndex() const
*/
StringList IO::Drivers::Serial::portList() const
{
if (m_portList.count() > 0)
return m_portList;
else
return StringList{tr("Select port")};
}
/**