diff --git a/plugins/samplesource/hackrfinput/hackrfinput.cpp b/plugins/samplesource/hackrfinput/hackrfinput.cpp index a5d414529..e41a455bd 100644 --- a/plugins/samplesource/hackrfinput/hackrfinput.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinput.cpp @@ -375,6 +375,12 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force) qDebug("HackRFInput::applySettings: sample rate set to %llu S/s", settings.m_devSampleRate); m_hackRFThread->setSamplerate(settings.m_devSampleRate); } + rc = (hackrf_error) hackrf_set_baseband_filter_bandwidth(m_dev, m_settings.m_bandwidth); // restore baseband bandwidth filter. libhackrf automatically sets baseband filter when sample rate is set. + if (rc != HACKRF_SUCCESS) { + qDebug("HackRFInput::applySettings: Restore baseband filter failed: %s", hackrf_error_name(rc)); + } else { + qDebug() << "HackRFInput:applySettings: Baseband BW filter restored to " << m_settings.m_bandwidth << " Hz"; + } } } } diff --git a/plugins/samplesource/hackrfinput/hackrfinputgui.cpp b/plugins/samplesource/hackrfinput/hackrfinputgui.cpp index 22a463025..dda1e7139 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputgui.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinputgui.cpp @@ -246,6 +246,7 @@ void HackRFInputGui::displaySettings() ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); ui->dcOffset->setChecked(m_settings.m_dcBlock); ui->iqImbalance->setChecked(m_settings.m_iqCorrection); + ui->autoBBF->setChecked(m_settings.m_autoBBF); displaySampleRate(); @@ -313,10 +314,23 @@ void HackRFInputGui::on_iqImbalance_toggled(bool checked) sendSettings(); } +void HackRFInputGui::on_autoBBF_toggled(bool checked) +{ + m_settings.m_autoBBF = checked; + if(checked){ + m_settings.m_bandwidth = hackrf_compute_baseband_filter_bw(m_settings.m_devSampleRate); + ui->bbFilter->blockSignals(true); + displaySettings(); + ui->bbFilter->blockSignals(false); + sendSettings(); + } +} + void HackRFInputGui::on_bbFilter_currentIndexChanged(int index) { int newBandwidth = HackRFBandwidths::getBandwidth(index); m_settings.m_bandwidth = newBandwidth * 1000; + ui->autoBBF->setChecked(false); sendSettings(); } @@ -346,6 +360,13 @@ void HackRFInputGui::on_sampleRate_changed(quint64 value) m_settings.m_devSampleRate <<= m_settings.m_log2Decim; } + if(m_settings.m_autoBBF){ + m_settings.m_bandwidth = hackrf_compute_baseband_filter_bw(m_settings.m_devSampleRate); + ui->bbFilter->blockSignals(true); + displaySettings(); + ui->bbFilter->blockSignals(false); + } + displayFcTooltip(); sendSettings(); } diff --git a/plugins/samplesource/hackrfinput/hackrfinputgui.h b/plugins/samplesource/hackrfinput/hackrfinputgui.h index 6abc95eaf..758837920 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputgui.h +++ b/plugins/samplesource/hackrfinput/hackrfinputgui.h @@ -88,6 +88,7 @@ private slots: void on_LOppm_valueChanged(int value); void on_dcOffset_toggled(bool checked); void on_iqImbalance_toggled(bool checked); + void on_autoBBF_toggled(bool checked); void on_biasT_stateChanged(int state); void on_decim_currentIndexChanged(int index); void on_fcPos_currentIndexChanged(int index); diff --git a/plugins/samplesource/hackrfinput/hackrfinputgui.ui b/plugins/samplesource/hackrfinput/hackrfinputgui.ui index 109107500..65d063e37 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputgui.ui +++ b/plugins/samplesource/hackrfinput/hackrfinputgui.ui @@ -215,6 +215,13 @@ 2 + + + + Auto + + + @@ -235,40 +242,17 @@ - - + + + + Bandpass Filter auto select + - Auto + BBF - - - Activate antenna bias tee - - - Qt::RightToLeft - - - Bias T - - - - - - - Extra LNA +14dB - - - Qt::RightToLeft - - - RF Amp - - - - Qt::Horizontal @@ -281,7 +265,33 @@ + + + + Activate antenna bias tee + + + Qt::RightToLeft + + + Bias T + + + + + + Extra LNA +14dB + + + Qt::RightToLeft + + + RF Amp + + + + diff --git a/plugins/samplesource/hackrfinput/hackrfinputsettings.cpp b/plugins/samplesource/hackrfinput/hackrfinputsettings.cpp index e6d837589..e7b14f65c 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputsettings.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinputsettings.cpp @@ -39,6 +39,7 @@ void HackRFInputSettings::resetToDefaults() m_vgaGain = 16; m_dcBlock = false; m_iqCorrection = false; + m_autoBBF = true; m_devSampleRate = 2400000; m_transverterMode = false; m_transverterDeltaFrequency = 0; @@ -71,6 +72,7 @@ QByteArray HackRFInputSettings::serialize() const s.writeBool(18, m_transverterMode); s.writeS64(19, m_transverterDeltaFrequency); s.writeBool(20, m_iqOrder); + s.writeBool(21, m_autoBBF); return s.final(); } @@ -117,6 +119,7 @@ bool HackRFInputSettings::deserialize(const QByteArray& data) d.readBool(18, &m_transverterMode, false); d.readS64(19, &m_transverterDeltaFrequency, 0); d.readBool(20, &m_iqOrder, true); + d.readBool(21, &m_autoBBF, true); return true; } diff --git a/plugins/samplesource/hackrfinput/hackrfinputsettings.h b/plugins/samplesource/hackrfinput/hackrfinputsettings.h index e9e095c43..de756e03e 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputsettings.h +++ b/plugins/samplesource/hackrfinput/hackrfinputsettings.h @@ -40,6 +40,7 @@ struct HackRFInputSettings { bool m_lnaExt; bool m_dcBlock; bool m_iqCorrection; + bool m_autoBBF; bool m_transverterMode; qint64 m_transverterDeltaFrequency; bool m_iqOrder; diff --git a/plugins/samplesource/hackrfinput/readme.md b/plugins/samplesource/hackrfinput/readme.md index f21ed46b0..f256e06e9 100644 --- a/plugins/samplesource/hackrfinput/readme.md +++ b/plugins/samplesource/hackrfinput/readme.md @@ -44,6 +44,7 @@ These buttons control the local DSP auto correction options: - **DC**: auto remove DC component - **IQ**: auto make I/Q balance. The DC correction must be enabled for this to be effective. + - **BBF**: auto select bandpass filter setting. Compute best value depending on sample rate.

4: Bias tee