1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

XTRX input: implemented baseband or device sample rate input option

This commit is contained in:
f4exb 2019-04-10 23:40:45 +02:00
parent c94b7ccbe2
commit dc519fbda7
9 changed files with 104 additions and 18 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

View File

@ -446,6 +446,9 @@
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Toggle between device to host (SR) and base band (BB) sample rate input</string>
</property>
<property name="text">
<string>SR</string>
</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
@ -34,7 +34,7 @@
const PluginDescriptor XTRXOutputPlugin::m_pluginDescriptor = {
QString("XTRX Output"),
QString("4.5.2"),
QString("4.5.4"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -74,7 +74,9 @@ This is the sample rate at which the ADC runs in kS/s (k) or MS/s (M) before har
<h4>1.5: Stream sample rate</h4>
Baseband I/Q sample rate in kS/s. This is the device to host sample rate (5) divided by the software decimation factor (4).
In device to host sample rate input mode (5A) this is the baseband I/Q sample rate in kS/s. This is the device to host sample rate (5) divided by the software decimation factor (4).
In baseband sample rate input mode (5A) this is the device to host sample rate in kS/s. This is the baseband sample rate (5) multiplied by the software decimation factor (4)
<h4>1.6: Channel number</h4>
@ -140,9 +142,18 @@ The first position in the combo is marked as "A". This is because decimation by
The I/Q stream from the XTRX is downsampled by a power of two by software inside the plugin before being sent to the passband. Possible values are increasing powers of two: 1 (no decimation), 2, 4, 8, 16, 32.
<h3>5: Device to host stream sample rate</h3>
<h3>5A: Device to host sample rate / Baseband sample rate input toggle</h3>
This is the XTRX device to/from host stream sample rate in S/s. It is the same for the Rx and Tx systems.
Use this toggle button to switch the sample rate input next (5) between device to host sample rate and baseband sample rate input. The button shows the current mode:
- **SR**: device to host sample rate input mode. The baseband sample rate (1.5) is the device to host sample rate (5) divided by the software decimation factor (4).
- **BB**: baseband sample rate input mode. The device to host sample rate (1.5) is the baseband sample rate (5) multiplied by the software decimation factor (4).
<h3>5: Sample rate</h3>
This is the XTRX device to/from host stream sample rate or baseband sample rate in samples per second (S/s). The control (5A) is used to switch between the two input modes. The device to/from host stream sample rate is the same for the Rx and Tx systems.
The limits are adjusted automatically. In baseband input mode the limits are driven by the decimation factor (4). You may need to increase this decimation factor to be able to reach lower values.
Use the wheels to adjust the sample rate. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows.

View File

@ -37,6 +37,7 @@ XTRXInputGUI::XTRXInputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
ui(new Ui::XTRXInputGUI),
m_deviceUISet(deviceUISet),
m_settings(),
m_sampleRateMode(true),
m_sampleRate(0),
m_lastEngineState((DSPDeviceSourceEngine::State)-1),
m_doApplySettings(true),
@ -277,7 +278,39 @@ void XTRXInputGUI::updateSampleRateAndFrequency()
{
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateLabel->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5)));
displaySampleRate();
}
void XTRXInputGUI::displaySampleRate()
{
float minF, maxF, stepF;
m_XTRXInput->getSRRange(minF, maxF, stepF);
ui->sampleRate->blockSignals(true);
if (m_sampleRateMode)
{
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(60,60,60); }");
ui->sampleRateMode->setText("SR");
ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF);
ui->sampleRate->setValue(m_settings.m_devSampleRate);
ui->sampleRate->setToolTip("Device to host sample rate (S/s)");
ui->deviceRateText->setToolTip("Baseband sample rate (S/s)");
uint32_t basebandSampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim);
ui->deviceRateText->setText(tr("%1k").arg(QString::number(basebandSampleRate / 1000.0f, 'g', 5)));
}
else
{
ui->sampleRateMode->setStyleSheet("QToolButton { background:rgb(50,50,50); }");
ui->sampleRateMode->setText("BB");
ui->sampleRate->setValueRange(8, (uint32_t) minF/(1<<m_settings.m_log2SoftDecim), (uint32_t) maxF/(1<<m_settings.m_log2SoftDecim));
ui->sampleRate->setValue(m_settings.m_devSampleRate/(1<<m_settings.m_log2SoftDecim));
ui->sampleRate->setToolTip("Baseband sample rate (S/s)");
ui->deviceRateText->setToolTip("Device to host sample rate (S/s)");
ui->deviceRateText->setText(tr("%1k").arg(QString::number(m_settings.m_devSampleRate / 1000.0f, 'g', 5)));
}
ui->sampleRate->blockSignals(false);
}
void XTRXInputGUI::displaySettings()
@ -286,7 +319,7 @@ void XTRXInputGUI::displaySettings()
ui->extClock->setExternalClockActive(m_settings.m_extClock);
setCenterFrequencyDisplay();
ui->sampleRate->setValue(m_settings.m_devSampleRate);
displaySampleRate();
ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
@ -503,7 +536,12 @@ void XTRXInputGUI::on_iqImbalance_toggled(bool checked)
void XTRXInputGUI::on_sampleRate_changed(quint64 value)
{
m_settings.m_devSampleRate = value;
if (m_sampleRateMode) {
m_settings.m_devSampleRate = value;
} else {
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2SoftDecim);
}
updateADCRate();
setNCODisplay();
sendSettings();}
@ -513,6 +551,14 @@ void XTRXInputGUI::on_hwDecim_currentIndexChanged(int index)
if ((index <0) || (index > 5))
return;
m_settings.m_log2HardDecim = index;
displaySampleRate();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2SoftDecim);
}
updateADCRate();
setNCODisplay();
sendSettings();
@ -520,8 +566,10 @@ void XTRXInputGUI::on_hwDecim_currentIndexChanged(int index)
void XTRXInputGUI::on_swDecim_currentIndexChanged(int index)
{
if ((index <0) || (index > 6))
if ((index <0) || (index > 6)) {
return;
}
m_settings.m_log2SoftDecim = index;
sendSettings();
}
@ -601,6 +649,12 @@ void XTRXInputGUI::on_pwrmode_currentIndexChanged(int index)
sendSettings();
}
void XTRXInputGUI::on_sampleRateMode_toggled(bool checked)
{
m_sampleRateMode = checked;
displaySampleRate();
}
void XTRXInputGUI::openDeviceSettingsDialog(const QPoint& p)
{
BasicDeviceSettingsDialog dialog(this);

View File

@ -57,6 +57,7 @@ private:
DeviceUISet* m_deviceUISet;
XTRXInput* m_XTRXInput; //!< Same object as above but gives easy access to XTRXInput methods and attributes that are used intensively
XTRXInputSettings m_settings;
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
QTimer m_updateTimer;
QTimer m_statusTimer;
int m_sampleRate;
@ -69,6 +70,7 @@ private:
MessageQueue m_inputMessageQueue;
void displaySettings();
void displaySampleRate();
void setNCODisplay();
void setCenterFrequencyDisplay();
void setCenterFrequencySetting(uint64_t kHzValue);
@ -98,6 +100,7 @@ private slots:
void on_antenna_currentIndexChanged(int index);
void on_extClock_clicked();
void on_pwrmode_currentIndexChanged(int index);
void on_sampleRateMode_toggled(bool checked);
void updateHardware();
void updateStatus();

View File

@ -200,7 +200,7 @@
<item>
<layout class="QHBoxLayout" name="freqRightBotLayout">
<item>
<widget class="QLabel" name="deviceRateLabel">
<widget class="QLabel" name="deviceRateText">
<property name="minimumSize">
<size>
<width>54</width>
@ -468,16 +468,31 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QToolButton" name="sampleRateMode">
<property name="minimumSize">
<size>
<width>24</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Toggle between device to host (SR) and base band (BB) sample rate input</string>
</property>
<property name="text">
<string>SR</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// Copyright (C) 2017 Sergey Kostanbaev, Fairwaves Inc. //
// //
// This program is free software; you can redistribute it and/or modify //
@ -35,7 +35,7 @@
const PluginDescriptor XTRXInputPlugin::m_pluginDescriptor = {
QString("XTRX Input"),
QString("4.5.2"),
QString("4.5.4"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,