Fix crash and tidy up UI.

This commit is contained in:
srcejon 2023-10-13 08:54:43 +01:00
parent 51ddd77aa3
commit 515e19f20b
3 changed files with 12 additions and 8 deletions

View File

@ -101,9 +101,12 @@ bool FreqScannerGUI::handleMessage(const Message& message)
DSPSignalNotification& notif = (DSPSignalNotification&) message;
m_deviceCenterFrequency = notif.getCenterFrequency();
m_basebandSampleRate = notif.getSampleRate();
ui->deltaFrequency->setValueRange(true, 7, 0, m_basebandSampleRate/2);
ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2));
ui->channelBandwidth->setValueRange(true, 7, 0, m_basebandSampleRate);
if (m_basebandSampleRate != 0)
{
ui->deltaFrequency->setValueRange(true, 7, 0, m_basebandSampleRate/2);
ui->deltaFrequencyLabel->setToolTip(tr("Range %1 %L2 Hz").arg(QChar(0xB1)).arg(m_basebandSampleRate/2));
ui->channelBandwidth->setValueRange(true, 7, 0, m_basebandSampleRate);
}
if (m_channelMarker.getBandwidth() == 0) {
m_channelMarker.setBandwidth(m_basebandSampleRate);
}
@ -363,7 +366,7 @@ void FreqScannerGUI::onMenuDialogCalled(const QPoint &p)
setTitleColor(m_settings.m_rgbColor);
QList<QString> settingsKeys({
"m_rgbColor",
"rgbColor",
"title",
"useReverseAPI",
"reverseAPIAddress",

View File

@ -313,12 +313,12 @@
<widget class="QLabel" name="tuneTimeText">
<property name="minimumSize">
<size>
<width>45</width>
<width>54</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>100 ms</string>
<string>1000 ms</string>
</property>
</widget>
</item>

View File

@ -171,8 +171,9 @@ Real FreqScannerSink::peakPower(int bin) const
// Skip bin between halfway between channels
// Then skip first and last bins, to avoid spectral leakage (particularly at DC)
int startBin = bin - m_binsPerChannel/2 + 1 + 1;
Real maxMagSq = m_magSq[startBin];
for (int i = 1; i < m_binsPerChannel - 2 - 1; i++) {
Real maxMagSq = std::numeric_limits<Real>::min();
for (int i = 0; i < m_binsPerChannel - 2 - 1; i++)
{
int idx = startBin + i;
if ((idx < 0) || (idx >= m_fftSize)) {
continue;