1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

Merge pull request #812 from FuzzyCheese/dev

hackrfinput - Add auto bandpass filter selection
This commit is contained in:
Edouard Griffiths 2021-03-20 10:33:16 +01:00 committed by GitHub
commit c03e08c76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 29 deletions

View File

@ -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); qDebug("HackRFInput::applySettings: sample rate set to %llu S/s", settings.m_devSampleRate);
m_hackRFThread->setSamplerate(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";
}
} }
} }
} }

View File

@ -246,6 +246,7 @@ void HackRFInputGui::displaySettings()
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
ui->dcOffset->setChecked(m_settings.m_dcBlock); ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqCorrection); ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
ui->autoBBF->setChecked(m_settings.m_autoBBF);
displaySampleRate(); displaySampleRate();
@ -313,10 +314,23 @@ void HackRFInputGui::on_iqImbalance_toggled(bool checked)
sendSettings(); 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) void HackRFInputGui::on_bbFilter_currentIndexChanged(int index)
{ {
int newBandwidth = HackRFBandwidths::getBandwidth(index); int newBandwidth = HackRFBandwidths::getBandwidth(index);
m_settings.m_bandwidth = newBandwidth * 1000; m_settings.m_bandwidth = newBandwidth * 1000;
ui->autoBBF->setChecked(false);
sendSettings(); sendSettings();
} }
@ -346,6 +360,13 @@ void HackRFInputGui::on_sampleRate_changed(quint64 value)
m_settings.m_devSampleRate <<= m_settings.m_log2Decim; 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(); displayFcTooltip();
sendSettings(); sendSettings();
} }

View File

@ -88,6 +88,7 @@ private slots:
void on_LOppm_valueChanged(int value); void on_LOppm_valueChanged(int value);
void on_dcOffset_toggled(bool checked); void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked); void on_iqImbalance_toggled(bool checked);
void on_autoBBF_toggled(bool checked);
void on_biasT_stateChanged(int state); void on_biasT_stateChanged(int state);
void on_decim_currentIndexChanged(int index); void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index); void on_fcPos_currentIndexChanged(int index);

View File

@ -215,6 +215,13 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item row="0" column="0">
<widget class="QLabel" name="corrLabel">
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="ButtonSwitch" name="dcOffset"> <widget class="ButtonSwitch" name="dcOffset">
<property name="toolTip"> <property name="toolTip">
@ -235,40 +242,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="3">
<widget class="QLabel" name="corrLabel"> <widget class="ButtonSwitch" name="autoBBF">
<property name="toolTip">
<string>Bandpass Filter auto select</string>
</property>
<property name="text"> <property name="text">
<string>Auto</string> <string>BBF</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="0" column="4">
<widget class="QCheckBox" name="biasT">
<property name="toolTip">
<string>Activate antenna bias tee</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Bias T</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QCheckBox" name="lnaExt">
<property name="toolTip">
<string>Extra LNA +14dB</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>RF Amp</string>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -281,7 +265,33 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="5">
<widget class="QCheckBox" name="biasT">
<property name="toolTip">
<string>Activate antenna bias tee</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Bias T</string>
</property>
</widget>
</item>
<item row="0" column="6"> <item row="0" column="6">
<widget class="QCheckBox" name="lnaExt">
<property name="toolTip">
<string>Extra LNA +14dB</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>RF Amp</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="TransverterButton" name="transverter"> <widget class="TransverterButton" name="transverter">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>

View File

@ -39,6 +39,7 @@ void HackRFInputSettings::resetToDefaults()
m_vgaGain = 16; m_vgaGain = 16;
m_dcBlock = false; m_dcBlock = false;
m_iqCorrection = false; m_iqCorrection = false;
m_autoBBF = true;
m_devSampleRate = 2400000; m_devSampleRate = 2400000;
m_transverterMode = false; m_transverterMode = false;
m_transverterDeltaFrequency = 0; m_transverterDeltaFrequency = 0;
@ -71,6 +72,7 @@ QByteArray HackRFInputSettings::serialize() const
s.writeBool(18, m_transverterMode); s.writeBool(18, m_transverterMode);
s.writeS64(19, m_transverterDeltaFrequency); s.writeS64(19, m_transverterDeltaFrequency);
s.writeBool(20, m_iqOrder); s.writeBool(20, m_iqOrder);
s.writeBool(21, m_autoBBF);
return s.final(); return s.final();
} }
@ -117,6 +119,7 @@ bool HackRFInputSettings::deserialize(const QByteArray& data)
d.readBool(18, &m_transverterMode, false); d.readBool(18, &m_transverterMode, false);
d.readS64(19, &m_transverterDeltaFrequency, 0); d.readS64(19, &m_transverterDeltaFrequency, 0);
d.readBool(20, &m_iqOrder, true); d.readBool(20, &m_iqOrder, true);
d.readBool(21, &m_autoBBF, true);
return true; return true;
} }

View File

@ -40,6 +40,7 @@ struct HackRFInputSettings {
bool m_lnaExt; bool m_lnaExt;
bool m_dcBlock; bool m_dcBlock;
bool m_iqCorrection; bool m_iqCorrection;
bool m_autoBBF;
bool m_transverterMode; bool m_transverterMode;
qint64 m_transverterDeltaFrequency; qint64 m_transverterDeltaFrequency;
bool m_iqOrder; bool m_iqOrder;

View File

@ -44,6 +44,7 @@ These buttons control the local DSP auto correction options:
- **DC**: auto remove DC component - **DC**: auto remove DC component
- **IQ**: auto make I/Q balance. The DC correction must be enabled for this to be effective. - **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.
<h3>4: Bias tee</h3> <h3>4: Bias tee</h3>