1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

New preset design (single). Applied to HackRF

This commit is contained in:
f4exb 2015-09-30 04:39:09 +02:00
parent 2d9c0bcfd2
commit ded446c43a
11 changed files with 117 additions and 145 deletions

View File

@ -123,8 +123,6 @@ private slots:
void on_action_Stop_triggered();
void on_action_Start_Recording_triggered();
void on_action_Stop_Recording_triggered();
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);
void on_action_View_Fullscreen_toggled(bool checked);
void on_presetSave_clicked();
void on_presetUpdate_clicked();

View File

@ -37,15 +37,6 @@ public:
void setLayout(const QByteArray& data) { m_layout = data; }
const QByteArray& getLayout() const { return m_layout; }
void setDCOffsetCorrection(bool value) { m_dcOffsetCorrection = value; }
bool getDCOffsetCorrection() const { return m_dcOffsetCorrection; }
void setIQImbalanceCorrection(bool value) { m_iqImbalanceCorrection = value; }
bool getIQImbalanceCorrection() const { return m_iqImbalanceCorrection; }
void setScopeConfig(const QByteArray& data) { m_scopeConfig = data; }
const QByteArray& getScopeConfig() const { return m_scopeConfig; }
void clearChannels() { m_channelConfigs.clear(); }
void addChannel(const QString& channel, const QByteArray& config) { m_channelConfigs.append(ChannelConfig(channel, config)); }
int getChannelCount() const { return m_channelConfigs.count(); }
@ -67,7 +58,6 @@ protected:
// general configuration
QByteArray m_spectrumConfig;
QByteArray m_scopeConfig;
// dc offset and i/q imbalance correction TODO: move it into the source data
bool m_dcOffsetCorrection;

View File

@ -214,6 +214,9 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
m_basicSettingsShown(false)
{
ui->setupUi(this);
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
setAttribute(Qt::WA_DeleteOnClose, true);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));

View File

@ -113,6 +113,9 @@ void HackRFGui::displaySettings()
ui->LOppm->setValue(m_settings.m_LOppmTenths);
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->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
ui->biasT->setChecked(m_settings.m_biasT);
@ -197,6 +200,18 @@ void HackRFGui::on_LOppm_valueChanged(int value)
sendSettings();
}
void HackRFGui::on_dcOffset_toggled(bool checked)
{
m_settings.m_dcBlock = checked;
sendSettings();
}
void HackRFGui::on_iqImbalance_toggled(bool checked)
{
m_settings.m_iqCorrection = checked;
sendSettings();
}
void HackRFGui::on_sampleRate_currentIndexChanged(int index)
{
m_settings.m_devSampleRateIndex = index;

View File

@ -72,6 +72,8 @@ private:
private slots:
void on_centerFrequency_changed(quint64 value);
void on_LOppm_valueChanged(int value);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);
void on_sampleRate_currentIndexChanged(int index);
void on_biasT_stateChanged(int state);
void on_decim_valueChanged(int value);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>215</width>
<height>220</height>
<width>256</width>
<height>218</height>
</rect>
</property>
<property name="sizePolicy">
@ -136,6 +136,37 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_corr">
<item row="0" column="1">
<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 row="0" column="2">
<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>
<item row="0" column="0">
<widget class="QLabel" name="corrLabel">
<property name="text">
<string>Auto corr</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_freq">
<property name="orientation">
@ -148,13 +179,6 @@
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="2">
<widget class="QCheckBox" name="biasT">
<property name="text">
<string>Bias T</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="sampleRateLabel">
<property name="sizePolicy">
@ -175,6 +199,29 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="bbFiltLabel">
<property name="text">
<string>BBF</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="bbFilter"/>
</item>
<item row="0" column="4">
<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>
</layout>
</item>
<item>
@ -224,7 +271,7 @@
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_fcPos" columnstretch="0,0,0,0">
<layout class="QGridLayout" name="gridLayout_fcPos" columnstretch="0,0,0,0,0">
<property name="spacing">
<number>3</number>
</property>
@ -235,19 +282,6 @@
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="fcPosRightSpacer">
<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 row="0" column="1">
<widget class="QComboBox" name="fcPos">
<item>
@ -268,6 +302,16 @@
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="biasT">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Bias T</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="lnaExt">
<property name="toolTip">
<string>Extra LNA +14dB</string>
@ -350,36 +394,6 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_bbf">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="bbFiltLabel">
<property name="text">
<string>BBF</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="bbFilter"/>
</item>
<item row="0" column="2">
<spacer name="bbSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_vga" columnstretch="0,0,0">
<property name="spacing">
@ -441,6 +455,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/>
<connections/>

View File

@ -180,6 +180,18 @@ bool HackRFInput::applySettings(const HackRFSettings& settings, bool force)
qDebug() << "HackRFInput::applySettings";
if (m_settings.m_dcBlock != settings.m_dcBlock)
{
m_settings.m_dcBlock = settings.m_dcBlock;
DSPEngine::instance()->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection);
}
if (m_settings.m_iqCorrection != settings.m_iqCorrection)
{
m_settings.m_iqCorrection = settings.m_iqCorrection;
DSPEngine::instance()->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection);
}
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
{
forwardChange = true;

View File

@ -82,6 +82,8 @@ bool HackRFSettings::deserialize(const QByteArray& data)
d.readU32(7, &m_lnaGain, 16);
d.readU32(8, &m_bandwidthIndex, 0);
d.readU32(9, &m_vgaGain, 16);
d.readBool(10, &m_dcBlock, false);
d.readBool(11, &m_iqCorrection, false);
return true;
}

View File

@ -68,21 +68,21 @@ MainWindow::MainWindow(QWidget* parent) :
// work around broken Qt dock widget ordering
removeDockWidget(ui->inputDock);
removeDockWidget(ui->processingDock);
removeDockWidget(ui->rxDisplayDock);
removeDockWidget(ui->presetDock);
removeDockWidget(ui->channelDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->inputDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->processingDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->rxDisplayDock);
addDockWidget(Qt::LeftDockWidgetArea, ui->presetDock);
addDockWidget(Qt::RightDockWidgetArea, ui->channelDock);
ui->inputDock->show();
ui->processingDock->show();
ui->rxDisplayDock->show();
ui->presetDock->show();
ui->channelDock->show();
ui->menu_Window->addAction(ui->inputDock->toggleViewAction());
ui->menu_Window->addAction(ui->processingDock->toggleViewAction());
ui->menu_Window->addAction(ui->rxDisplayDock->toggleViewAction());
ui->menu_Window->addAction(ui->presetDock->toggleViewAction());
ui->menu_Window->addAction(ui->channelDock->toggleViewAction());
@ -211,8 +211,6 @@ void MainWindow::loadPresetSettings(const Preset* preset)
qDebug() << "MainWindow::loadPresetSettings: preset: " << preset->getSource().toStdString().c_str();
ui->glSpectrumGUI->deserialize(preset->getSpectrumConfig());
ui->dcOffset->setChecked(preset->getDCOffsetCorrection());
ui->iqImbalance->setChecked(preset->getIQImbalanceCorrection());
m_pluginManager->loadSettings(preset);
@ -433,18 +431,6 @@ void MainWindow::on_action_Stop_Recording_triggered()
m_fileSink->stopRecording();
}
void MainWindow::on_dcOffset_toggled(bool checked)
{
m_settings.getCurrent()->setDCOffsetCorrection(checked);
m_dspEngine->configureCorrections(m_settings.getCurrent()->getDCOffsetCorrection(), m_settings.getCurrent()->getIQImbalanceCorrection());
}
void MainWindow::on_iqImbalance_toggled(bool checked)
{
m_settings.getCurrent()->setIQImbalanceCorrection(checked);
m_dspEngine->configureCorrections(m_settings.getCurrent()->getDCOffsetCorrection(), m_settings.getCurrent()->getIQImbalanceCorrection());
}
void MainWindow::on_action_View_Fullscreen_toggled(bool checked)
{
if(checked)

View File

@ -256,9 +256,9 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="processingDock">
<widget class="QDockWidget" name="rxDisplayDock">
<property name="windowTitle">
<string>Processing and Display</string>
<string>Rx Display</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
@ -286,45 +286,6 @@
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="ButtonSwitch" name="dcOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Compensate DC offset</string>
</property>
<property name="text">
<string>DC Offset Corr</string>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="iqImbalance">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Compensate I/Q imbalance</string>
</property>
<property name="text">
<string>I/Q Imbal. Corr</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="GLSpectrumGUI" name="glSpectrumGUI" native="true"/>
</item>
@ -492,11 +453,6 @@
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>ChannelWindow</class>
<extends>QWidget</extends>
@ -509,8 +465,6 @@
<tabstop>presetSave</tabstop>
<tabstop>presetDelete</tabstop>
<tabstop>presetLoad</tabstop>
<tabstop>dcOffset</tabstop>
<tabstop>iqImbalance</tabstop>
</tabstops>
<resources>
<include location="resources/res.qrc"/>

View File

@ -14,9 +14,6 @@ void Preset::resetToDefaults()
m_description = "no name";
m_centerFrequency = 0;
m_spectrumConfig.clear();
m_scopeConfig.clear();
m_dcOffsetCorrection = false;
m_iqImbalanceCorrection = false;
m_layout.clear();
m_spectrumConfig.clear();
m_channelConfigs.clear();
@ -34,11 +31,8 @@ QByteArray Preset::serialize() const
s.writeU64(3, m_centerFrequency);
s.writeBlob(4, m_layout);
s.writeBlob(5, m_spectrumConfig);
s.writeBool(6, m_dcOffsetCorrection);
s.writeBool(7, m_iqImbalanceCorrection);
s.writeBlob(8, m_scopeConfig);
s.writeString(9, m_source);
s.writeBlob(10, m_sourceConfig);
s.writeString(6, m_source);
s.writeBlob(7, m_sourceConfig);
s.writeS32(200, m_channelConfigs.size());
@ -68,13 +62,10 @@ bool Preset::deserialize(const QByteArray& data)
d.readU64(3, &m_centerFrequency, 0);
d.readBlob(4, &m_layout);
d.readBlob(5, &m_spectrumConfig);
d.readBool(6, &m_dcOffsetCorrection, false);
d.readBool(7, &m_iqImbalanceCorrection, false);
d.readBlob(8, &m_scopeConfig);
d.readString(9, &m_source);
d.readBlob(10, &m_sourceConfig);
d.readString(6, &m_source);
d.readBlob(7, &m_sourceConfig);
qDebug() << " m_group: " << m_group.toStdString().c_str();
qDebug() << "Preset::deserialize: m_group: " << m_group.toStdString().c_str();
qint32 channelCount = 0;
d.readS32(200, &channelCount, 0);