From b31033c0a2a1020f372e1c3289bbba885e2071a3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 1 Oct 2015 03:18:20 +0200 Subject: [PATCH] Added DC block and IQ correction buttons to BladeRF --- plugins/samplesource/airspy/airspygui.cpp | 2 + plugins/samplesource/bladerf/bladerfgui.cpp | 15 +++++++ plugins/samplesource/bladerf/bladerfgui.h | 2 + plugins/samplesource/bladerf/bladerfgui.ui | 40 ++++++++++++++++++- plugins/samplesource/bladerf/bladerfinput.cpp | 12 ++++++ 5 files changed, 69 insertions(+), 2 deletions(-) diff --git a/plugins/samplesource/airspy/airspygui.cpp b/plugins/samplesource/airspy/airspygui.cpp index 2fa3ed1ba..d3cd1db63 100644 --- a/plugins/samplesource/airspy/airspygui.cpp +++ b/plugins/samplesource/airspy/airspygui.cpp @@ -140,6 +140,8 @@ void AirspyGui::displaySettings() ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex); ui->biasT->setChecked(m_settings.m_biasT); + ui->dcOffset->setChecked(m_settings.m_dcBlock); + ui->iqImbalance->setChecked(m_settings.m_iqCorrection); ui->decimText->setText(tr("%1").arg(1<decim->setValue(m_settings.m_log2Decim); diff --git a/plugins/samplesource/bladerf/bladerfgui.cpp b/plugins/samplesource/bladerf/bladerfgui.cpp index fe8994fb3..c05f12d19 100644 --- a/plugins/samplesource/bladerf/bladerfgui.cpp +++ b/plugins/samplesource/bladerf/bladerfgui.cpp @@ -114,6 +114,9 @@ void BladerfGui::displaySettings() { ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); + ui->dcOffset->setChecked(m_settings.m_dcBlock); + ui->iqImbalance->setChecked(m_settings.m_iqCorrection); + ui->samplerateText->setText(tr("%1k").arg(m_settings.m_devSampleRate / 1000)); unsigned int sampleRateIndex = BladerfSampleRates::getRateIndex(m_settings.m_devSampleRate); ui->samplerate->setValue(sampleRateIndex); @@ -151,6 +154,18 @@ void BladerfGui::on_centerFrequency_changed(quint64 value) sendSettings(); } +void BladerfGui::on_dcOffset_toggled(bool checked) +{ + m_settings.m_dcBlock = checked; + sendSettings(); +} + +void BladerfGui::on_iqImbalance_toggled(bool checked) +{ + m_settings.m_iqCorrection = checked; + sendSettings(); +} + void BladerfGui::on_samplerate_valueChanged(int value) { int newrate = BladerfSampleRates::getRate(value); diff --git a/plugins/samplesource/bladerf/bladerfgui.h b/plugins/samplesource/bladerf/bladerfgui.h index a26597fc3..6e09a3f7e 100644 --- a/plugins/samplesource/bladerf/bladerfgui.h +++ b/plugins/samplesource/bladerf/bladerfgui.h @@ -62,6 +62,8 @@ private: private slots: void on_centerFrequency_changed(quint64 value); + void on_dcOffset_toggled(bool checked); + void on_iqImbalance_toggled(bool checked); void on_samplerate_valueChanged(int value); void on_bandwidth_valueChanged(int value); void on_decim_valueChanged(int value); diff --git a/plugins/samplesource/bladerf/bladerfgui.ui b/plugins/samplesource/bladerf/bladerfgui.ui index 7f64317a4..8dd0f675c 100644 --- a/plugins/samplesource/bladerf/bladerfgui.ui +++ b/plugins/samplesource/bladerf/bladerfgui.ui @@ -6,8 +6,8 @@ 0 0 - 198 - 280 + 247 + 308 @@ -96,6 +96,37 @@ + + + + + + Automatic IQ imbalance correction + + + IQ imbalance + + + + + + + Automatic DC offset removal + + + DC offset + + + + + + + Auto corr + + + + + @@ -606,6 +637,11 @@
gui/valuedial.h
1 + + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
diff --git a/plugins/samplesource/bladerf/bladerfinput.cpp b/plugins/samplesource/bladerf/bladerfinput.cpp index 2541a3b15..18b252aea 100644 --- a/plugins/samplesource/bladerf/bladerfinput.cpp +++ b/plugins/samplesource/bladerf/bladerfinput.cpp @@ -177,6 +177,18 @@ bool BladerfInput::applySettings(const BladeRFSettings& settings, bool force) qDebug() << "BladerfInput::applySettings: m_dev: " << m_dev; + if (m_settings.m_dcBlock != settings.m_dcBlock) + { + m_settings.m_dcBlock = settings.m_dcBlock; + DSPEngine::instance()->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection); + } + + if (m_settings.m_iqCorrection != settings.m_iqCorrection) + { + m_settings.m_iqCorrection = settings.m_iqCorrection; + DSPEngine::instance()->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection); + } + if ((m_settings.m_lnaGain != settings.m_lnaGain) || force) { m_settings.m_lnaGain = settings.m_lnaGain;