1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

hackrfinput - add auto bandpass filter selection

Add button to auto select the bandpass filter based on the sample rate. It matches the automatic selection done by libhackrf when sample rate is changed.
This commit is contained in:
FuzzyCheese 2021-03-19 23:50:56 -05:00
parent c59a394111
commit be85e680e0
6 changed files with 66 additions and 29 deletions

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->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();
}

View File

@ -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);

View File

@ -215,6 +215,13 @@
<property name="bottomMargin">
<number>2</number>
</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">
<widget class="ButtonSwitch" name="dcOffset">
<property name="toolTip">
@ -235,40 +242,17 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="corrLabel">
<item row="0" column="3">
<widget class="ButtonSwitch" name="autoBBF">
<property name="toolTip">
<string>Bandpass Filter auto select</string>
</property>
<property name="text">
<string>Auto</string>
<string>BBF</string>
</property>
</widget>
</item>
<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">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -281,7 +265,33 @@
</property>
</spacer>
</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">
<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">
<property name="maximumSize">
<size>

View File

@ -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;
}

View File

@ -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;

View File

@ -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.
<h3>4: Bias tee</h3>