1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00

Fix filtering of Freq Scanner from list of channels.

This commit is contained in:
srcejon 2023-09-29 09:38:15 +01:00
parent e9066fe2a4
commit b3d3ca43ca
3 changed files with 5 additions and 13 deletions

View File

@ -243,16 +243,12 @@ bool FreqScanner::handleMessage(const Message& cmd)
} }
else if (MsgStartScan::match(cmd)) else if (MsgStartScan::match(cmd))
{ {
qInfo() << "FreqScanner::handleMessage: StartScan";
startScan(); startScan();
return true; return true;
} }
else if (MsgStopScan::match(cmd)) else if (MsgStopScan::match(cmd))
{ {
qInfo() << "FreqScanner::handleMessage: StopScan";
stopScan(); stopScan();
return true; return true;
@ -295,12 +291,10 @@ void FreqScanner::initScan()
if (m_centerFrequency != m_stepStartFrequency) if (m_centerFrequency != m_stepStartFrequency)
{ {
qInfo() << "******************** Setting frequency to " << m_stepStartFrequency;
if (!ChannelWebAPIUtils::setCenterFrequency(getDeviceSetIndex(), m_stepStartFrequency)) { if (!ChannelWebAPIUtils::setCenterFrequency(getDeviceSetIndex(), m_stepStartFrequency)) {
qWarning() << "Scanner failed to set frequency" << m_stepStartFrequency; qWarning() << "Freq Scanner failed to set frequency" << m_stepStartFrequency;
} }
m_minFFTStartTime = QDateTime::currentDateTime().addMSecs(m_settings.m_tuneTime); m_minFFTStartTime = QDateTime::currentDateTime().addMSecs(m_settings.m_tuneTime);
qInfo() << "m_minFFTStartTime" << m_minFFTStartTime.toString("ss.z");
} }
m_scanResults.clear(); m_scanResults.clear();
@ -343,7 +337,6 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
m_stepStartFrequency = frequencies.front() + m_scannerSampleRate / 2 - m_settings.m_channelBandwidth + m_settings.m_channelBandwidth / 2; m_stepStartFrequency = frequencies.front() + m_scannerSampleRate / 2 - m_settings.m_channelBandwidth + m_settings.m_channelBandwidth / 2;
m_stepStopFrequency = frequencies.back(); m_stepStopFrequency = frequencies.back();
qInfo() << "START_SCAN: Scanning from " << frequencies.front() << "to" << frequencies.back();
initScan(); initScan();
} }
} }
@ -476,7 +469,7 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
} }
} }
//qInfo() << "Tuning to active freq:" << frequency << "m_centerFrequency" << m_centerFrequency << "nextCenterFrequency" << nextCenterFrequency << "offset: " << offset << "deviceset: R" << m_scanDeviceSetIndex << ":" << m_scanChannelIndex; //qDebug() << "Tuning to active freq:" << frequency << "m_centerFrequency" << m_centerFrequency << "nextCenterFrequency" << nextCenterFrequency << "offset: " << offset << "deviceset: R" << m_scanDeviceSetIndex << ":" << m_scanChannelIndex;
ChannelWebAPIUtils::setFrequencyOffset(m_scanDeviceSetIndex, m_scanChannelIndex, offset); ChannelWebAPIUtils::setFrequencyOffset(m_scanDeviceSetIndex, m_scanChannelIndex, offset);
@ -513,7 +506,7 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
{ {
// For RTL SDR, setCenterFrequency takes ~50ms, which means tuneTime can be 0 // For RTL SDR, setCenterFrequency takes ~50ms, which means tuneTime can be 0
if (!ChannelWebAPIUtils::setCenterFrequency(getDeviceSetIndex(), nextCenterFrequency)) { if (!ChannelWebAPIUtils::setCenterFrequency(getDeviceSetIndex(), nextCenterFrequency)) {
qWarning() << "Scanner failed to set frequency" << nextCenterFrequency; qWarning() << "Freq Scanner failed to set frequency" << nextCenterFrequency;
} }
m_minFFTStartTime = QDateTime::currentDateTime().addMSecs(m_settings.m_tuneTime); m_minFFTStartTime = QDateTime::currentDateTime().addMSecs(m_settings.m_tuneTime);
} }

View File

@ -364,7 +364,6 @@ public:
fftSize = pow(2.0, floor(log2(basebandSampleRate / binBW))); fftSize = pow(2.0, floor(log2(basebandSampleRate / binBW)));
fftSize = std::min(maxFFTSize, fftSize); fftSize = std::min(maxFFTSize, fftSize);
scannerSampleRate = binBW * fftSize; scannerSampleRate = binBW * fftSize;
qInfo() << "binsPerChannel:" << binsPerChannel << "fftSize:" << fftSize << "scannerSampleRate:" << scannerSampleRate;
} }
static const char * const m_channelIdURI; static const char * const m_channelIdURI;

View File

@ -209,8 +209,8 @@ void FreqScannerGUI::updateChannelsList(const QList<FreqScannerSettings::Availab
for (const auto& channel : channels) for (const auto& channel : channels)
{ {
// Add channels in this device set, other than ourself // Add channels in this device set, other than ourself (Don't use ChannelGUI::getDeviceSetIndex()/getIndex() as not valid when this is first called)
if ((channel.m_deviceSetIndex == getDeviceSetIndex()) && (channel.m_channelIndex != getIndex())) if ((channel.m_deviceSetIndex == m_freqScanner->getDeviceSetIndex()) && (channel.m_channelIndex != m_freqScanner->getIndexInDeviceSet()))
{ {
QString name = QString("R%1:%2").arg(channel.m_deviceSetIndex).arg(channel.m_channelIndex); QString name = QString("R%1:%2").arg(channel.m_deviceSetIndex).arg(channel.m_channelIndex);
ui->channels->addItem(name); ui->channels->addItem(name);