diff --git a/doc/img/XTRXInput_plugin.png b/doc/img/XTRXInput_plugin.png index ac2bc67c8..ddd6044f5 100644 Binary files a/doc/img/XTRXInput_plugin.png and b/doc/img/XTRXInput_plugin.png differ diff --git a/doc/img/XTRXInput_plugin.xcf b/doc/img/XTRXInput_plugin.xcf index 6ef9c98ae..9ce255821 100644 Binary files a/doc/img/XTRXInput_plugin.xcf and b/doc/img/XTRXInput_plugin.xcf differ diff --git a/plugins/samplesink/xtrxoutput/xtrxoutputgui.ui b/plugins/samplesink/xtrxoutput/xtrxoutputgui.ui index cb0959f02..72191049f 100644 --- a/plugins/samplesink/xtrxoutput/xtrxoutputgui.ui +++ b/plugins/samplesink/xtrxoutput/xtrxoutputgui.ui @@ -446,6 +446,9 @@ 16777215 + + Toggle between device to host (SR) and base band (BB) sample rate input + SR diff --git a/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp b/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp index 696f7ad01..95f7cd19f 100644 --- a/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp +++ b/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp @@ -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, diff --git a/plugins/samplesource/xtrxinput/readme.md b/plugins/samplesource/xtrxinput/readme.md index aeae2a42e..360e0c95d 100644 --- a/plugins/samplesource/xtrxinput/readme.md +++ b/plugins/samplesource/xtrxinput/readme.md @@ -74,7 +74,9 @@ This is the sample rate at which the ADC runs in kS/s (k) or MS/s (M) before har

1.5: Stream sample rate

-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)

1.6: Channel number

@@ -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. -

5: Device to host stream sample rate

+

5A: Device to host sample rate / Baseband sample rate input toggle

-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). + +

5: Sample rate

+ +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. diff --git a/plugins/samplesource/xtrxinput/xtrxinputgui.cpp b/plugins/samplesource/xtrxinput/xtrxinputgui.cpp index 89940ce37..9a141969b 100644 --- a/plugins/samplesource/xtrxinput/xtrxinputgui.cpp +++ b/plugins/samplesource/xtrxinput/xtrxinputgui.cpp @@ -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<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<sampleRate->setValue(m_settings.m_devSampleRate/(1<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); diff --git a/plugins/samplesource/xtrxinput/xtrxinputgui.h b/plugins/samplesource/xtrxinput/xtrxinputgui.h index d87f27a65..7b49c1f9c 100644 --- a/plugins/samplesource/xtrxinput/xtrxinputgui.h +++ b/plugins/samplesource/xtrxinput/xtrxinputgui.h @@ -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(); diff --git a/plugins/samplesource/xtrxinput/xtrxinputgui.ui b/plugins/samplesource/xtrxinput/xtrxinputgui.ui index fd49e12f9..05d808727 100644 --- a/plugins/samplesource/xtrxinput/xtrxinputgui.ui +++ b/plugins/samplesource/xtrxinput/xtrxinputgui.ui @@ -200,7 +200,7 @@ - + 54 @@ -468,16 +468,31 @@ - - - - 0 - 0 - + + + + 24 + 0 + + + + + 24 + 16777215 + + + + Toggle between device to host (SR) and base band (BB) sample rate input SR + + true + + + true + diff --git a/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp b/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp index 1f15596a8..581d13bb5 100644 --- a/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp +++ b/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp @@ -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,