From c5e9da7004aef85f5964547b389a482bd6c343ca Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 13 Dec 2023 22:18:45 +0100 Subject: [PATCH] Frequency scanner: set device frequency for both Rx and MIMO devices --- plugins/channelrx/freqscanner/freqscanner.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/channelrx/freqscanner/freqscanner.cpp b/plugins/channelrx/freqscanner/freqscanner.cpp index d11326f5e7..39a597dd98 100644 --- a/plugins/channelrx/freqscanner/freqscanner.cpp +++ b/plugins/channelrx/freqscanner/freqscanner.cpp @@ -35,7 +35,8 @@ #include "device/deviceset.h" #include "dsp/dspengine.h" #include "dsp/dspcommands.h" -#include "dsp/morsedemod.h" +#include "dsp/devicesamplesource.h" +#include "dsp/devicesamplemimo.h" #include "device/deviceapi.h" #include "feature/feature.h" #include "settings/serializable.h" @@ -293,10 +294,17 @@ void FreqScanner::stopScan() void FreqScanner::setDeviceCenterFrequency(qint64 frequency) { - // For RTL SDR, ChannelWebAPIUtils::setCenterFrequency takes ~50ms, which means tuneTime can be 0 - if (!ChannelWebAPIUtils::setCenterFrequency(getDeviceSetIndex(), frequency)) { - qWarning() << "Freq Scanner failed to set frequency" << frequency; + DSPDeviceSourceEngine* deviceSourceEngine = getDeviceAPI()->getDeviceSourceEngine(); + DSPDeviceMIMOEngine *deviceMIMOEngine = getDeviceAPI()->getDeviceMIMOEngine(); + + if (deviceSourceEngine) // Rx device + { + // For RTL SDR, setCenterFrequency takes ~50ms, which means tuneTime can be 0 + getDeviceAPI()->getSampleSource()->setCenterFrequency(frequency); + } else if (deviceMIMOEngine) { // MIMO device - I/Q stream is the same as this channel + getDeviceAPI()->getSampleMIMO()->setSourceCenterFrequency(frequency, m_settings.m_streamIndex); } + m_minFFTStartTime = QDateTime::currentDateTime().addMSecs(m_settings.m_tuneTime); }