mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 18:15:45 -05:00
SDRdaemon plugin: implement DC offset and IQ imbalance corrections
This commit is contained in:
parent
05a4a7cb4e
commit
f04b6c4dc1
@ -27,7 +27,6 @@ include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/include-gpl
|
||||
${LIBRTLSDR_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
#include(${QT_USE_FILE})
|
||||
@ -50,7 +49,6 @@ target_include_directories(inputsdrdaemon PUBLIC
|
||||
|
||||
target_link_libraries(inputsdrdaemon
|
||||
${QT_LIBRARIES}
|
||||
${LIBUSB_LIBRARIES}
|
||||
${LZ4_LIBRARIES}
|
||||
sdrbase
|
||||
)
|
||||
|
@ -39,7 +39,9 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
m_sampleRate(0),
|
||||
m_centerFrequency(0),
|
||||
m_samplesCount(0),
|
||||
m_tickCount(0)
|
||||
m_tickCount(0),
|
||||
m_dcBlock(false),
|
||||
m_iqCorrection(false)
|
||||
{
|
||||
m_startingTimeStamp.tv_sec = 0;
|
||||
m_startingTimeStamp.tv_usec = 0;
|
||||
@ -173,7 +175,7 @@ void SDRdaemonGui::handleSourceMessages()
|
||||
|
||||
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
|
||||
{
|
||||
qDebug("SDRdaemonGui::handleSourceMessages: message: %s", message->getIdentifier());
|
||||
//qDebug("SDRdaemonGui::handleSourceMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (handleMessage(*message))
|
||||
{
|
||||
@ -184,6 +186,8 @@ void SDRdaemonGui::handleSourceMessages()
|
||||
|
||||
void SDRdaemonGui::displaySettings()
|
||||
{
|
||||
ui->dcOffset->setChecked(m_dcBlock);
|
||||
ui->iqImbalance->setChecked(m_iqCorrection);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -198,6 +202,26 @@ void SDRdaemonGui::on_applyButton_clicked(bool checked)
|
||||
configureUDPLink();
|
||||
}
|
||||
|
||||
void SDRdaemonGui::on_dcOffset_toggled(bool checked)
|
||||
{
|
||||
if (m_dcBlock != checked)
|
||||
{
|
||||
m_dcBlock = checked;
|
||||
SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr* message = SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr::create(m_dcBlock, m_iqCorrection);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonGui::on_iqImbalance_toggled(bool checked)
|
||||
{
|
||||
if (m_iqCorrection != checked)
|
||||
{
|
||||
m_iqCorrection = checked;
|
||||
SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr* message = SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr::create(m_dcBlock, m_iqCorrection);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonGui::configureUDPLink()
|
||||
{
|
||||
bool ok;
|
||||
@ -232,28 +256,8 @@ void SDRdaemonGui::updateWithStreamTime()
|
||||
{
|
||||
quint64 startingTimeStampMsec = (m_startingTimeStamp.tv_sec * 1000) + (m_startingTimeStamp.tv_usec / 1000);
|
||||
QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec);
|
||||
QString s_date = dt.toString("yyyyMMdd hh.mm.ss.zzz");
|
||||
QString s_date = dt.toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
ui->absTimeText->setText(s_date);
|
||||
/*
|
||||
int t_sec = 0;
|
||||
int t_msec = 0;
|
||||
|
||||
if (m_sampleRate > 0){
|
||||
t_msec = ((m_samplesCount * 1000) / m_sampleRate) % 1000;
|
||||
t_sec = m_samplesCount / m_sampleRate;
|
||||
}
|
||||
|
||||
QTime t(0, 0, 0, 0);
|
||||
t = t.addSecs(t_sec);
|
||||
t = t.addMSecs(t_msec);
|
||||
QString s_time = t.toString("hh:mm:ss.zzz");
|
||||
|
||||
quint64 startingTimeStampMsec = m_startingTimeStamp * 1000;
|
||||
QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec);
|
||||
dt = dt.addSecs(t_sec);
|
||||
dt = dt.addMSecs(t_msec);
|
||||
QString s_date = dt.toString("yyyyMMdd hh.mm.ss.zzz");
|
||||
ui->absTimeText->setText(s_date);*/
|
||||
}
|
||||
|
||||
void SDRdaemonGui::tick()
|
||||
|
@ -60,6 +60,9 @@ private:
|
||||
int m_samplesCount;
|
||||
std::size_t m_tickCount;
|
||||
|
||||
bool m_dcBlock;
|
||||
bool m_iqCorrection;
|
||||
|
||||
void displaySettings();
|
||||
void displayTime();
|
||||
void configureUDPLink();
|
||||
@ -70,6 +73,8 @@ private:
|
||||
private slots:
|
||||
void handleSourceMessages();
|
||||
void on_applyButton_clicked(bool checked);
|
||||
void on_dcOffset_toggled(bool checked);
|
||||
void on_iqImbalance_toggled(bool checked);
|
||||
void tick();
|
||||
};
|
||||
|
||||
|
@ -103,6 +103,119 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_freq_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="rateTimeLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Rate: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleRateText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record sample rate</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="absTimeLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="absTimeText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record absolute time</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>20150101 00:00:00.000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_rateTime">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="gridLayout_corr">
|
||||
<item>
|
||||
<widget class="QLabel" name="corrLabel">
|
||||
<property name="text">
|
||||
<string>Auto corr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="dcOffset">
|
||||
<property name="toolTip">
|
||||
<string>DC Offset auto correction</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DC Offset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="iqImbalance">
|
||||
<property name="toolTip">
|
||||
<string>IQ Imbalance auto correction</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IQ Imbalance</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_freq">
|
||||
<property name="orientation">
|
||||
@ -175,75 +288,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="rateTimeLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Rate: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleRateText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record sample rate</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="absTimeLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="absTimeText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record absolute time</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>20150101 00:00:00.000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_file">
|
||||
<widget class="Line" name="line_address">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -261,6 +306,11 @@
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "sdrdaemonudphandler.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonUDPLink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonWork, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonStreamTiming, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgReportSDRdaemonAcquisition, Message)
|
||||
@ -100,6 +101,15 @@ bool SDRdaemonInput::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureSDRdaemonUDPLink::match(message))
|
||||
{
|
||||
// TODO: change UDP settings
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureSDRdaemonAutoCorr::match(message))
|
||||
{
|
||||
MsgConfigureSDRdaemonAutoCorr& conf = (MsgConfigureSDRdaemonAutoCorr&) message;
|
||||
bool dcBlock = conf.getDCBlock();
|
||||
bool iqImbalance = conf.getIQImbalance();
|
||||
DSPEngine::instance()->configureCorrections(dcBlock, iqImbalance);
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureSDRdaemonWork::match(message))
|
||||
|
@ -51,6 +51,28 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgConfigureSDRdaemonAutoCorr : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
public:
|
||||
bool getDCBlock() const { return m_dcBlock; }
|
||||
bool getIQImbalance() const { return m_iqCorrection; }
|
||||
|
||||
static MsgConfigureSDRdaemonAutoCorr* create(bool dcBlock, bool iqImbalance)
|
||||
{
|
||||
return new MsgConfigureSDRdaemonAutoCorr(dcBlock, iqImbalance);
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_dcBlock;
|
||||
bool m_iqCorrection;
|
||||
|
||||
MsgConfigureSDRdaemonAutoCorr(bool dcBlock, bool iqImbalance) :
|
||||
Message(),
|
||||
m_dcBlock(dcBlock),
|
||||
m_iqCorrection(iqImbalance)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgConfigureSDRdaemonWork : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user