1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

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

View File

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

View File

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