Fixed bug tuning with sdrplay and rtlsdr

This commit is contained in:
Ryzerth 2021-02-15 13:18:21 +01:00
parent cc9da905a6
commit b4d06697b4
3 changed files with 6 additions and 6 deletions

View File

@ -147,7 +147,7 @@ private:
_this->freq = freq;
if (_this->running) {
// SET PLUTO FREQ HERE
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", round(_this->freq));
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", round(freq));
}
spdlog::info("PlutoSDRSourceModule '{0}': Tune: {1}!", _this->name, freq);
}

View File

@ -281,7 +281,7 @@ private:
static void tune(double freq, void* ctx) {
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
if (_this->running) {
rtlsdr_set_center_freq(_this->openDev, _this->freq);
rtlsdr_set_center_freq(_this->openDev, freq);
}
_this->freq = freq;
spdlog::info("RTLSDRSourceModule '{0}': Tune: {1}!", _this->name, freq);

View File

@ -189,7 +189,7 @@ private:
_this->openDevParams->devParams->fsFreq.fsHz = 8000000;
_this->openDevParams->rxChannelA->tunerParams.bwType = sdrplay_api_BW_8_000;
_this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = _this->freq;
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = 0;
_this->openDevParams->rxChannelA->tunerParams.gain.gRdB = 30;
_this->openDevParams->rxChannelA->tunerParams.gain.LNAstate = 0;
_this->openDevParams->rxChannelA->ctrlParams.agc.enable = sdrplay_api_AGC_DISABLE;
//_this->openDevParams->devParams->
@ -221,7 +221,7 @@ private:
static void tune(double freq, void* ctx) {
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)ctx;
if (_this->running) {
_this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = _this->freq;
_this->openDevParams->rxChannelA->tunerParams.rfFreq.rfHz = freq;
sdrplay_api_Update(_this->openDev.dev, _this->openDev.tuner, sdrplay_api_Update_Tuner_Frf, sdrplay_api_Update_Ext1_None);
}
_this->freq = freq;
@ -299,8 +299,8 @@ private:
SDRPlaySourceModule* _this = (SDRPlaySourceModule*)cbContext;
if (!_this->running) { return; }
for (int i = 0; i < numSamples; i++) {
_this->stream.writeBuf[i].i = (float)xi[i] / 32768.0f;
_this->stream.writeBuf[i].q = (float)xq[i] / 32768.0f;
_this->stream.writeBuf[i].i = (float)xq[i] / 32768.0f;
_this->stream.writeBuf[i].q = (float)xi[i] / 32768.0f;
}
_this->stream.swap(numSamples);
}