Skip to content

Commit

Permalink
Frequency scanner: set device frequency for both Rx and MIMO devices
Browse files Browse the repository at this point in the history
  • Loading branch information
f4exb committed Dec 14, 2023
1 parent 5ed6f06 commit c5e9da7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions plugins/channelrx/freqscanner/freqscanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit c5e9da7

Please sign in to comment.