mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-25 03:32:29 -04:00
RTLSDR: DC offset and IQ imbalance buttons. Standard device ID in plugin
This commit is contained in:
parent
3cc73fbf61
commit
df2077caa7
@ -62,6 +62,18 @@ void RTLSDRGui::setCenterFrequency(qint64 centerFrequency)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RTLSDRGui::on_dcOffset_toggled(bool checked)
|
||||||
|
{
|
||||||
|
m_settings.m_dcBlock = checked;
|
||||||
|
sendSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RTLSDRGui::on_iqImbalance_toggled(bool checked)
|
||||||
|
{
|
||||||
|
m_settings.m_iqImbalance = checked;
|
||||||
|
sendSettings();
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray RTLSDRGui::serialize() const
|
QByteArray RTLSDRGui::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
@ -115,6 +127,8 @@ void RTLSDRGui::handleSourceMessages()
|
|||||||
void RTLSDRGui::displaySettings()
|
void RTLSDRGui::displaySettings()
|
||||||
{
|
{
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
|
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||||
|
ui->iqImbalance->setChecked(m_settings.m_iqImbalance);
|
||||||
ui->samplerateText->setText(tr("%1k").arg(m_settings.m_devSampleRate / 1000));
|
ui->samplerateText->setText(tr("%1k").arg(m_settings.m_devSampleRate / 1000));
|
||||||
unsigned int sampleRateIndex = RTLSDRSampleRates::getRateIndex(m_settings.m_devSampleRate);
|
unsigned int sampleRateIndex = RTLSDRSampleRates::getRateIndex(m_settings.m_devSampleRate);
|
||||||
ui->samplerate->setValue(sampleRateIndex);
|
ui->samplerate->setValue(sampleRateIndex);
|
||||||
|
@ -44,6 +44,8 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_centerFrequency_changed(quint64 value);
|
void on_centerFrequency_changed(quint64 value);
|
||||||
|
void on_dcOffset_toggled(bool checked);
|
||||||
|
void on_iqImbalance_toggled(bool checked);
|
||||||
void on_decim_valueChanged(int value);
|
void on_decim_valueChanged(int value);
|
||||||
void on_ppm_valueChanged(int value);
|
void on_ppm_valueChanged(int value);
|
||||||
void on_gain_valueChanged(int value);
|
void on_gain_valueChanged(int value);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>198</width>
|
<width>247</width>
|
||||||
<height>173</height>
|
<height>189</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -36,7 +36,7 @@
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -96,6 +96,80 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_ppm">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSlider" name="ppm">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-99</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="ppmText">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="ppmLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>LO ppm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_corr">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="ButtonSwitch" name="dcOffset">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Automatic DC offset removal</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>DC offset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="ButtonSwitch" name="iqImbalance">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Automatic IQ imbalance correction</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>IQ imbalance</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="corrLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto corr</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_4">
|
<widget class="Line" name="line_4">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -104,10 +178,26 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_rate">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="samplerateText">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>1024k</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSlider" name="samplerate">
|
<widget class="QSlider" name="samplerate">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -125,7 +215,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_12">
|
<widget class="QLabel" name="samplerateLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -137,8 +227,38 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_decim">
|
||||||
|
<property name="text">
|
||||||
|
<string>Dec.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSlider" name="decim">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="samplerateText">
|
<widget class="QLabel" name="decimText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
@ -146,7 +266,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>1024k</string>
|
<string>16</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -163,12 +283,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_gain">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="gainLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -225,110 +345,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_1">
|
<layout class="QHBoxLayout" name="horizontalLayout_direct">
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSlider" name="ppm">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-99</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="ppmText">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_10">
|
|
||||||
<property name="text">
|
|
||||||
<string>ppm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,0,0">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_decim">
|
|
||||||
<property name="text">
|
|
||||||
<string>Dec.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSlider" name="decim">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="decimText">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>16</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox">
|
<widget class="QCheckBox" name="checkBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -297,6 +297,18 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
|
||||||
|
{
|
||||||
|
m_settings.m_dcBlock = settings.m_dcBlock;
|
||||||
|
DSPEngine::instance()->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqImbalance);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_settings.m_iqImbalance != settings.m_iqImbalance) || force)
|
||||||
|
{
|
||||||
|
m_settings.m_iqImbalance = settings.m_iqImbalance;
|
||||||
|
DSPEngine::instance()->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqImbalance);
|
||||||
|
}
|
||||||
|
|
||||||
if (forwardChange)
|
if (forwardChange)
|
||||||
{
|
{
|
||||||
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);
|
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);
|
||||||
|
@ -15,6 +15,8 @@ const PluginDescriptor RTLSDRPlugin::m_pluginDescriptor = {
|
|||||||
QString("https://github.com/f4exb/sdrangel")
|
QString("https://github.com/f4exb/sdrangel")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const QString RTLSDRPlugin::m_deviceTypeID = RTLSDR_DEVICE_TYPE_ID;
|
||||||
|
|
||||||
RTLSDRPlugin::RTLSDRPlugin(QObject* parent) :
|
RTLSDRPlugin::RTLSDRPlugin(QObject* parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
@ -29,7 +31,7 @@ void RTLSDRPlugin::initPlugin(PluginAPI* pluginAPI)
|
|||||||
{
|
{
|
||||||
m_pluginAPI = pluginAPI;
|
m_pluginAPI = pluginAPI;
|
||||||
|
|
||||||
m_pluginAPI->registerSampleSource("org.osmocom.sdr.samplesource.rtl-sdr", this);
|
m_pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInterface::SampleSourceDevices RTLSDRPlugin::enumSampleSources()
|
PluginInterface::SampleSourceDevices RTLSDRPlugin::enumSampleSources()
|
||||||
@ -47,10 +49,10 @@ PluginInterface::SampleSourceDevices RTLSDRPlugin::enumSampleSources()
|
|||||||
|
|
||||||
if(rtlsdr_get_device_usb_strings((uint32_t)i, vendor, product, serial) != 0)
|
if(rtlsdr_get_device_usb_strings((uint32_t)i, vendor, product, serial) != 0)
|
||||||
continue;
|
continue;
|
||||||
QString displayedName(QString("RTL-SDR #%1 (%2 #%3)").arg(i + 1).arg(product).arg(serial));
|
QString displayedName(QString("RTL-SDR #%1 %2").arg(i).arg(serial));
|
||||||
|
|
||||||
result.append(SampleSourceDevice(displayedName,
|
result.append(SampleSourceDevice(displayedName,
|
||||||
"org.osmocom.sdr.samplesource.rtl-sdr",
|
m_deviceTypeID,
|
||||||
QString(serial),
|
QString(serial),
|
||||||
i));
|
i));
|
||||||
}
|
}
|
||||||
@ -59,7 +61,7 @@ PluginInterface::SampleSourceDevices RTLSDRPlugin::enumSampleSources()
|
|||||||
|
|
||||||
PluginGUI* RTLSDRPlugin::createSampleSourcePluginGUI(const QString& sourceId)
|
PluginGUI* RTLSDRPlugin::createSampleSourcePluginGUI(const QString& sourceId)
|
||||||
{
|
{
|
||||||
if(sourceId == "org.osmocom.sdr.samplesource.rtl-sdr") {
|
if(sourceId == m_deviceTypeID) {
|
||||||
RTLSDRGui* gui = new RTLSDRGui(m_pluginAPI);
|
RTLSDRGui* gui = new RTLSDRGui(m_pluginAPI);
|
||||||
m_pluginAPI->setInputGUI(gui);
|
m_pluginAPI->setInputGUI(gui);
|
||||||
return gui;
|
return gui;
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "plugin/plugininterface.h"
|
#include "plugin/plugininterface.h"
|
||||||
|
|
||||||
|
#define RTLSDR_DEVICE_TYPE_ID "sdrangel.samplesource.rtlsdr"
|
||||||
|
|
||||||
class RTLSDRPlugin : public QObject, public PluginInterface {
|
class RTLSDRPlugin : public QObject, public PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(PluginInterface)
|
Q_INTERFACES(PluginInterface)
|
||||||
Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.rtl-sdr")
|
Q_PLUGIN_METADATA(IID RTLSDR_DEVICE_TYPE_ID)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RTLSDRPlugin(QObject* parent = NULL);
|
explicit RTLSDRPlugin(QObject* parent = NULL);
|
||||||
@ -18,6 +20,8 @@ public:
|
|||||||
virtual SampleSourceDevices enumSampleSources();
|
virtual SampleSourceDevices enumSampleSources();
|
||||||
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId);
|
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId);
|
||||||
|
|
||||||
|
static const QString m_deviceTypeID;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user