1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-04 06:54:39 -04:00

HackRF: suppression of Rx to Tx link frequency. Synchronization of Tx to Rx device center frequency.

This commit is contained in:
f4exb
2019-03-30 20:44:55 +01:00
parent 7fed61c3b9
commit 64b198e507
284 changed files with 441 additions and 416 deletions
@@ -309,6 +309,20 @@ bool HackRFInput::handleMessage(const Message& message)
return true;
}
else if (DeviceHackRFShared::MsgSynchronizeFrequency::match(message))
{
DeviceHackRFShared::MsgSynchronizeFrequency& freqMsg = (DeviceHackRFShared::MsgSynchronizeFrequency&) message;
qint64 centerFrequency = DeviceSampleSource::calculateCenterFrequency(
freqMsg.getFrequency(),
0,
m_settings.m_log2Decim,
(DeviceSampleSource::fcPos_t) m_settings.m_fcPos,
m_settings.m_devSampleRate);
qDebug("HackRFInput::handleMessage: MsgSynchronizeFrequency: centerFrequency: %lld Hz", centerFrequency);
setCenterFrequency(centerFrequency);
return true;
}
else
{
return false;
@@ -348,9 +362,6 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force) {
reverseAPIKeys.append("iqCorrection");
}
if ((m_settings.m_linkTxFrequency != settings.m_linkTxFrequency) || force) {
reverseAPIKeys.append("linkTxFrequency");
}
if ((m_settings.m_dcBlock != settings.m_dcBlock) ||
(m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
@@ -397,21 +408,6 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) // forward delta to buddy if necessary
{
reverseAPIKeys.append("centerFrequency");
if (m_settings.m_linkTxFrequency && (m_deviceAPI->getSinkBuddies().size() > 0))
{
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsg = DeviceHackRFShared::MsgConfigureFrequencyDelta::create(
settings.m_centerFrequency - m_settings.m_centerFrequency);
if (buddy->getSampleSinkGUIMessageQueue())
{
DeviceHackRFShared::MsgConfigureFrequencyDelta *deltaMsgToGUI = new DeviceHackRFShared::MsgConfigureFrequencyDelta(*deltaMsg);
buddy->getSampleSinkGUIMessageQueue()->push(deltaMsgToGUI);
}
buddy->getSampleSinkInputMessageQueue()->push(deltaMsg);
}
}
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
@@ -561,8 +557,7 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
<< " m_devSampleRate: " << m_settings.m_devSampleRate
<< " m_biasT: " << m_settings.m_biasT
<< " m_lnaExt: " << m_settings.m_lnaExt
<< " m_dcBlock: " << m_settings.m_dcBlock
<< " m_linkTxFrequency: " << m_settings.m_linkTxFrequency;
<< " m_dcBlock: " << m_settings.m_dcBlock;
return true;
}
@@ -626,9 +621,6 @@ int HackRFInput::webapiSettingsPutPatch(
if (deviceSettingsKeys.contains("iqCorrection")) {
settings.m_iqCorrection = response.getHackRfInputSettings()->getIqCorrection() != 0;
}
if (deviceSettingsKeys.contains("linkTxFrequency")) {
settings.m_linkTxFrequency = response.getHackRfInputSettings()->getLinkTxFrequency() != 0;
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getHackRfInputSettings()->getFileRecordName();
}
@@ -672,7 +664,6 @@ void HackRFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& res
response.getHackRfInputSettings()->setLnaExt(settings.m_lnaExt ? 1 : 0);
response.getHackRfInputSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
response.getHackRfInputSettings()->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
response.getHackRfInputSettings()->setLinkTxFrequency(settings.m_linkTxFrequency ? 1 : 0);
if (response.getHackRfInputSettings()->getFileRecordName()) {
*response.getHackRfInputSettings()->getFileRecordName() = settings.m_fileRecordName;
@@ -767,9 +758,6 @@ void HackRFInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("iqCorrection") || force) {
swgHackRFInputSettings->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
}
if (deviceSettingsKeys.contains("linkTxFrequency") || force) {
swgHackRFInputSettings->setLinkTxFrequency(settings.m_linkTxFrequency ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgHackRFInputSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
@@ -276,12 +276,6 @@ void HackRFInputGui::on_iqImbalance_toggled(bool checked)
sendSettings();
}
void HackRFInputGui::on_linkTxFreq_toggled(bool checked)
{
m_settings.m_linkTxFrequency = checked;
sendSettings();
}
void HackRFInputGui::on_bbFilter_currentIndexChanged(int index)
{
int newBandwidth = HackRFBandwidths::getBandwidth(index);
@@ -88,7 +88,6 @@ private slots:
void on_LOppm_valueChanged(int value);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);
void on_linkTxFreq_toggled(bool checked);
void on_biasT_stateChanged(int state);
void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index);
@@ -253,7 +253,7 @@
</property>
</widget>
</item>
<item row="0" column="5">
<item row="0" column="4">
<widget class="QCheckBox" name="biasT">
<property name="toolTip">
<string>Activate antenna bias tee</string>
@@ -266,7 +266,7 @@
</property>
</widget>
</item>
<item row="0" column="6">
<item row="0" column="5">
<widget class="QCheckBox" name="lnaExt">
<property name="toolTip">
<string>Extra LNA +14dB</string>
@@ -292,20 +292,6 @@
</property>
</spacer>
</item>
<item row="0" column="4">
<widget class="ButtonSwitch" name="linkTxFreq">
<property name="toolTip">
<string>Toggle Tx frequency link</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/link.png</normaloff>:/link.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -32,7 +32,7 @@
const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
QString("HackRF Input"),
QString("4.5.2"),
QString("4.5.3"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -39,7 +39,6 @@ void HackRFInputSettings::resetToDefaults()
m_dcBlock = false;
m_iqCorrection = false;
m_devSampleRate = 2400000;
m_linkTxFrequency = false;
m_fileRecordName = "";
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
@@ -62,7 +61,6 @@ QByteArray HackRFInputSettings::serialize() const
s.writeBool(10, m_dcBlock);
s.writeBool(11, m_iqCorrection);
s.writeU64(12, m_devSampleRate);
s.writeBool(13, m_linkTxFrequency);
s.writeBool(14, m_useReverseAPI);
s.writeString(15, m_reverseAPIAddress);
s.writeU32(16, m_reverseAPIPort);
@@ -98,7 +96,6 @@ bool HackRFInputSettings::deserialize(const QByteArray& data)
d.readBool(10, &m_dcBlock, false);
d.readBool(11, &m_iqCorrection, false);
d.readU64(12, &m_devSampleRate, 2400000U);
d.readBool(13, &m_linkTxFrequency, false);
d.readBool(14, &m_useReverseAPI, false);
d.readString(15, &m_reverseAPIAddress, "127.0.0.1");
d.readU32(16, &uintval, 0);
@@ -39,7 +39,6 @@ struct HackRFInputSettings {
bool m_lnaExt;
bool m_dcBlock;
bool m_iqCorrection;
bool m_linkTxFrequency;
QString m_fileRecordName;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
+7 -15
View File
@@ -24,12 +24,12 @@ This is the center frequency of reception in kHz.
<h4>1.2: Start/Stop</h4>
Device start / stop button.
Device start / stop button.
- Blue triangle icon: device is ready and can be started
- Green square icon: device is running and can be stopped
- Red square icon: an error occurred. In the case the device was accidentally disconnected you may click on the icon, plug back in and start again.
If you have the Tx open in another tab and it is running then it will be stopped automatically before the Rx starts. In a similar manner the Rx will be stopped before the Tx is started from the Tx tab.
The settings on Rx or Tx tab are reapplied on start so these settings can be considered independent.
@@ -40,7 +40,7 @@ Record baseband I/Q stream toggle button
<h4>1.4: Baseband sample rate</h4>
Baseband I/Q sample rate in kS/s. This is the device sample rate (4) divided by the decimation factor (6).
Baseband I/Q sample rate in kS/s. This is the device sample rate (4) divided by the decimation factor (6).
<h3>2: Local Oscillator correction</h3>
@@ -53,21 +53,13 @@ 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.
<h3>3A: Link Tx frequency</h3>
Use this button to toggle the device Tx frequency link.
When active (button lit) and a tab is opened for the Tx part of the same device this option will activate the link of the Tx frequency to the Rx frequency. Thus when changing the Rx frequency the Tx frequency will vary by the same amount. This facilitates the split operation or repeater operation. You can also set the Tx frequency so that it follows exactly the Rx frequency (simplex).
The amount of shift is simply set by changing the frequency in the Tx tab.
<h3>4: Bias tee</h3>
Use this checkbox to toggle the +5V power supply on the antenna connector.
<h3>5:RF amp</h3>
Use this checkbox to toggle the extra low noise amplifier (LNA). This gives an additional gain of 14 dB.
Use this checkbox to toggle the extra low noise amplifier (LNA). This gives an additional gain of 14 dB.
<h3>6: Device sample rate</h3>
@@ -89,10 +81,10 @@ The device stream from the HackRF is decimated to obtain the baseband stream. Po
<h3>8: Baseband center frequency position relative the the HackRF Rx center frequency</h3>
- **Cen**: the decimation operation takes place around the HackRF Rx center frequency Fs
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
With SR as the sample rate before decimation Fc is calculated as:
With SR as the sample rate before decimation Fc is calculated as:
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.