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

RTL-SDR bias tee. Implements #533

This commit is contained in:
f4exb 2020-06-27 06:13:48 +02:00
parent eea1e1da0f
commit e62b0c7836
6 changed files with 49 additions and 4 deletions

View File

@ -449,6 +449,12 @@ void RTLSDRGui::on_sampleRateMode_toggled(bool checked)
displaySampleRate(); displaySampleRate();
} }
void RTLSDRGui::on_biasT_stateChanged(int state)
{
m_settings.m_biasTee = (state == Qt::Checked);
sendSettings();
}
void RTLSDRGui::updateHardware() void RTLSDRGui::updateHardware()
{ {
if (m_doApplySettings) if (m_doApplySettings)

View File

@ -97,6 +97,7 @@ private slots:
void on_record_toggled(bool checked); void on_record_toggled(bool checked);
void on_transverter_clicked(); void on_transverter_clicked();
void on_sampleRateMode_toggled(bool checked); void on_sampleRateMode_toggled(bool checked);
void on_biasT_stateChanged(int state);
void openDeviceSettingsDialog(const QPoint& p); void openDeviceSettingsDialog(const QPoint& p);
void openFileRecordDialog(const QPoint& p); void openFileRecordDialog(const QPoint& p);
void updateHardware(); void updateHardware();

View File

@ -243,7 +243,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="corrLabel"> <widget class="QLabel" name="corrLabel">
<property name="text"> <property name="text">
<string>Auto corr</string> <string>Auto</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -260,7 +260,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="5"> <item row="0" column="6">
<widget class="QComboBox" name="fcPos"> <widget class="QComboBox" name="fcPos">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -291,14 +291,14 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="0" column="5">
<widget class="QLabel" name="fcPosLabel"> <widget class="QLabel" name="fcPosLabel">
<property name="text"> <property name="text">
<string>Fp</string> <string>Fp</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="6"> <item row="0" column="7">
<widget class="TransverterButton" name="transverter"> <widget class="TransverterButton" name="transverter">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -317,6 +317,19 @@
</property> </property>
</widget> </widget>
</item> </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>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -562,6 +562,20 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
} }
} }
if ((m_settings.m_biasTee != settings.m_biasTee) || force)
{
reverseAPIKeys.append("biasTee");
if(m_dev != 0)
{
if (rtlsdr_set_bias_tee(m_dev, settings.m_biasTee ? 1 : 0) != 0) {
qCritical("RTLSDRInput::applySettings: rtlsdr_set_bias_tee() failed");
} else {
qDebug("RTLSDRInput::applySettings: rtlsdr_set_bias_tee() to %d", settings.m_biasTee ? 1 : 0);
}
}
}
if (settings.m_useReverseAPI) if (settings.m_useReverseAPI)
{ {
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) || bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
@ -676,6 +690,9 @@ void RTLSDRInput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("rfBandwidth")) { if (deviceSettingsKeys.contains("rfBandwidth")) {
settings.m_rfBandwidth = response.getRtlSdrSettings()->getRfBandwidth(); settings.m_rfBandwidth = response.getRtlSdrSettings()->getRfBandwidth();
} }
if (deviceSettingsKeys.contains("biasTee")) {
settings.m_biasTee = response.getRtlSdrSettings()->getBiasTee() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) { if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getRtlSdrSettings()->getFileRecordName(); settings.m_fileRecordName = *response.getRtlSdrSettings()->getFileRecordName();
} }
@ -708,6 +725,7 @@ void RTLSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
response.getRtlSdrSettings()->setLowSampleRate(settings.m_lowSampleRate ? 1 : 0); response.getRtlSdrSettings()->setLowSampleRate(settings.m_lowSampleRate ? 1 : 0);
response.getRtlSdrSettings()->setNoModMode(settings.m_noModMode ? 1 : 0); response.getRtlSdrSettings()->setNoModMode(settings.m_noModMode ? 1 : 0);
response.getRtlSdrSettings()->setOffsetTuning(settings.m_offsetTuning ? 1 : 0); response.getRtlSdrSettings()->setOffsetTuning(settings.m_offsetTuning ? 1 : 0);
response.getRtlSdrSettings()->setBiasTee(settings.m_biasTee ? 1 : 0);
response.getRtlSdrSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency); response.getRtlSdrSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getRtlSdrSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0); response.getRtlSdrSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
response.getRtlSdrSettings()->setRfBandwidth(settings.m_rfBandwidth); response.getRtlSdrSettings()->setRfBandwidth(settings.m_rfBandwidth);
@ -870,6 +888,9 @@ void RTLSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("rfBandwidth") || force) { if (deviceSettingsKeys.contains("rfBandwidth") || force) {
swgRtlSdrSettings->setRfBandwidth(settings.m_rfBandwidth); swgRtlSdrSettings->setRfBandwidth(settings.m_rfBandwidth);
} }
if (deviceSettingsKeys.contains("biasTee") || force) {
swgRtlSdrSettings->setBiasTee(settings.m_biasTee ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) { if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgRtlSdrSettings->setFileRecordName(new QString(settings.m_fileRecordName)); swgRtlSdrSettings->setFileRecordName(new QString(settings.m_fileRecordName));
} }

View File

@ -43,6 +43,7 @@ void RTLSDRSettings::resetToDefaults()
m_rfBandwidth = 2500 * 1000; // Hz m_rfBandwidth = 2500 * 1000; // Hz
m_fileRecordName = ""; m_fileRecordName = "";
m_offsetTuning = false; m_offsetTuning = false;
m_biasTee = false;
m_useReverseAPI = false; m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888; m_reverseAPIPort = 8888;
@ -72,6 +73,7 @@ QByteArray RTLSDRSettings::serialize() const
s.writeU32(18, m_reverseAPIPort); s.writeU32(18, m_reverseAPIPort);
s.writeU32(19, m_reverseAPIDeviceIndex); s.writeU32(19, m_reverseAPIDeviceIndex);
s.writeBool(20, m_iqOrder); s.writeBool(20, m_iqOrder);
s.writeBool(21, m_biasTee);
return s.final(); return s.final();
} }
@ -119,6 +121,7 @@ bool RTLSDRSettings::deserialize(const QByteArray& data)
d.readU32(19, &utmp, 0); d.readU32(19, &utmp, 0);
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
d.readBool(20, &m_iqOrder, true); d.readBool(20, &m_iqOrder, true);
d.readBool(21, &m_biasTee, false);
return true; return true;
} }

View File

@ -44,6 +44,7 @@ struct RTLSDRSettings {
quint32 m_rfBandwidth; //!< RF filter bandwidth in Hz quint32 m_rfBandwidth; //!< RF filter bandwidth in Hz
QString m_fileRecordName; QString m_fileRecordName;
bool m_offsetTuning; bool m_offsetTuning;
bool m_biasTee;
bool m_useReverseAPI; bool m_useReverseAPI;
QString m_reverseAPIAddress; QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort; uint16_t m_reverseAPIPort;