mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
XTRX: fixed sample rate setting
This commit is contained in:
parent
8653d326b3
commit
c7e7215199
@ -125,14 +125,16 @@ double DeviceXTRX::set_samplerate(double rate, double master, bool output)
|
|||||||
m_inputRate = rate;
|
m_inputRate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
int res = xtrx_set_samplerate(m_dev,
|
int res = xtrx_set_samplerate(
|
||||||
|
m_dev,
|
||||||
m_masterRate,
|
m_masterRate,
|
||||||
m_inputRate,
|
m_inputRate,
|
||||||
m_outputRate,
|
m_outputRate,
|
||||||
0,
|
XTRX_SAMPLERATE_FORCE_UPDATE,
|
||||||
&m_clockGen,
|
&m_clockGen,
|
||||||
&m_actualInputRate,
|
&m_actualInputRate,
|
||||||
&m_actualOutputRate);
|
&m_actualOutputRate
|
||||||
|
);
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
|
@ -382,12 +382,6 @@ void XTRXOutput::stop()
|
|||||||
// remove old thread address from buddies (reset in all buddies)
|
// remove old thread address from buddies (reset in all buddies)
|
||||||
const std::vector<DeviceAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
const std::vector<DeviceAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
||||||
std::vector<DeviceAPI*>::const_iterator it = sinkBuddies.begin();
|
std::vector<DeviceAPI*>::const_iterator it = sinkBuddies.begin();
|
||||||
|
|
||||||
for (; it != sinkBuddies.end(); ++it)
|
|
||||||
{
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_sink->setThread(0);
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_thread = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (nbOriginalChannels == 2) // Reduce from MO to SO by deleting and re-creating the thread
|
else if (nbOriginalChannels == 2) // Reduce from MO to SO by deleting and re-creating the thread
|
||||||
{
|
{
|
||||||
@ -404,13 +398,6 @@ void XTRXOutput::stop()
|
|||||||
// remove old thread address from buddies (reset in all buddies). The address being held only in the owning source.
|
// remove old thread address from buddies (reset in all buddies). The address being held only in the owning source.
|
||||||
const std::vector<DeviceAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
const std::vector<DeviceAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
||||||
std::vector<DeviceAPI*>::const_iterator it = sinkBuddies.begin();
|
std::vector<DeviceAPI*>::const_iterator it = sinkBuddies.begin();
|
||||||
|
|
||||||
for (; it != sinkBuddies.end(); ++it)
|
|
||||||
{
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_sink->setThread(0);
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_thread = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
xtrxOutputThread->startWork();
|
xtrxOutputThread->startWork();
|
||||||
}
|
}
|
||||||
@ -503,24 +490,20 @@ int XTRXOutput::getSampleRate() const
|
|||||||
|
|
||||||
uint32_t XTRXOutput::getDevSampleRate() const
|
uint32_t XTRXOutput::getDevSampleRate() const
|
||||||
{
|
{
|
||||||
uint32_t devSampleRate = m_settings.m_devSampleRate;
|
|
||||||
|
|
||||||
if (m_deviceShared.m_dev) {
|
if (m_deviceShared.m_dev) {
|
||||||
devSampleRate = m_deviceShared.m_dev->getActualOutputRate();
|
return m_deviceShared.m_dev->getActualOutputRate();
|
||||||
|
} else {
|
||||||
|
return m_settings.m_devSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return devSampleRate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t XTRXOutput::getLog2HardInterp() const
|
uint32_t XTRXOutput::getLog2HardInterp() const
|
||||||
{
|
{
|
||||||
uint32_t log2HardInterp = m_settings.m_log2HardInterp;
|
|
||||||
|
|
||||||
if (m_deviceShared.m_dev && (m_deviceShared.m_dev->getActualOutputRate() != 0.0)) {
|
if (m_deviceShared.m_dev && (m_deviceShared.m_dev->getActualOutputRate() != 0.0)) {
|
||||||
log2HardInterp = log2(m_deviceShared.m_dev->getClockGen() / m_deviceShared.m_dev->getActualOutputRate() / 4);
|
return log2(m_deviceShared.m_dev->getClockGen() / m_deviceShared.m_dev->getActualOutputRate() / 4);
|
||||||
|
} else {
|
||||||
|
return m_settings.m_log2HardInterp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return log2HardInterp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double XTRXOutput::getClockGen() const
|
double XTRXOutput::getClockGen() const
|
||||||
@ -964,42 +947,40 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||||||
|
|
||||||
if (doChangeSampleRate && (settings.m_devSampleRate != 0))
|
if (doChangeSampleRate && (settings.m_devSampleRate != 0))
|
||||||
{
|
{
|
||||||
XTRXOutputThread *txThread = findThread();
|
// XTRXOutputThread *txThread = findThread();
|
||||||
|
|
||||||
if (txThread && txThread->isRunning())
|
// if (txThread && txThread->isRunning())
|
||||||
{
|
// {
|
||||||
txThread->stopWork();
|
// txThread->stopWork();
|
||||||
txThreadWasRunning = true;
|
// txThreadWasRunning = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
suspendRxThread();
|
// suspendRxThread();
|
||||||
|
|
||||||
double master = (settings.m_log2HardInterp == 0) ? 0 : (settings.m_devSampleRate * 4 * (1 << settings.m_log2HardInterp));
|
double master = (m_settings.m_log2HardInterp == 0) ? 0 : (m_settings.m_devSampleRate * 4 * (1 << m_settings.m_log2HardInterp));
|
||||||
|
|
||||||
|
int res = m_deviceShared.m_dev->setSamplerate(
|
||||||
|
m_settings.m_devSampleRate,
|
||||||
|
master,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if (m_deviceShared.m_dev->set_samplerate(settings.m_devSampleRate,
|
|
||||||
master, //(settings.m_devSampleRate<<settings.m_log2HardDecim)*4,
|
|
||||||
true) < 0)
|
|
||||||
{
|
|
||||||
qCritical("XTRXOutput::applySettings: could not set sample rate to %f with oversampling of %d",
|
|
||||||
settings.m_devSampleRate,
|
|
||||||
1<<settings.m_log2HardInterp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
doChangeFreq = true;
|
doChangeFreq = true;
|
||||||
forceNCOFrequency = true;
|
forceNCOFrequency = true;
|
||||||
forwardChangeAllDSP = true;
|
forwardChangeAllDSP = true;
|
||||||
|
m_settings.m_devSampleRate = m_deviceShared.m_dev->getActualOutputRate();
|
||||||
|
m_settings.m_log2HardInterp = getLog2HardInterp();
|
||||||
|
|
||||||
qDebug("XTRXOutput::applySettings: sample rate set to %f with oversampling of %d",
|
qDebug("XTRXOutput::applySettings: sample rate set %s to %f with hard interpolation of %d",
|
||||||
m_deviceShared.m_dev->getActualOutputRate(),
|
(res < 0) ? "changed" : "unchanged",
|
||||||
1 << getLog2HardInterp());
|
m_settings.m_devSampleRate,
|
||||||
}
|
m_settings.m_log2HardInterp);
|
||||||
|
|
||||||
resumeRxThread();
|
// resumeRxThread();
|
||||||
|
|
||||||
if (txThreadWasRunning) {
|
// if (txThreadWasRunning) {
|
||||||
txThread->startWork();
|
// txThread->startWork();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doLPCalibration)
|
if (doLPCalibration)
|
||||||
@ -1022,12 +1003,12 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||||||
{
|
{
|
||||||
if (xtrx_tune(m_deviceShared.m_dev->getDevice(),
|
if (xtrx_tune(m_deviceShared.m_dev->getDevice(),
|
||||||
XTRX_TUNE_TX_FDD,
|
XTRX_TUNE_TX_FDD,
|
||||||
settings.m_centerFrequency,
|
m_settings.m_centerFrequency,
|
||||||
0) < 0) {
|
0) < 0) {
|
||||||
qCritical("XTRXOutput::applySettings: could not set frequency to %lu", settings.m_centerFrequency);
|
qCritical("XTRXOutput::applySettings: could not set frequency to %lu", m_settings.m_centerFrequency);
|
||||||
} else {
|
} else {
|
||||||
//doCalibration = true;
|
//doCalibration = true;
|
||||||
qDebug("XTRXOutput::applySettings: frequency set to %lu", settings.m_centerFrequency);
|
qDebug("XTRXOutput::applySettings: frequency set to %lu", m_settings.m_centerFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1039,19 +1020,19 @@ bool XTRXOutput::applySettings(const XTRXOutputSettings& settings, bool force, b
|
|||||||
if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(),
|
if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(),
|
||||||
XTRX_TUNE_BB_TX,
|
XTRX_TUNE_BB_TX,
|
||||||
m_deviceShared.m_channel == 0 ? XTRX_CH_A : XTRX_CH_B,
|
m_deviceShared.m_channel == 0 ? XTRX_CH_A : XTRX_CH_B,
|
||||||
(settings.m_ncoEnable) ? settings.m_ncoFrequency : 0,
|
(m_settings.m_ncoEnable) ? m_settings.m_ncoFrequency : 0,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
{
|
{
|
||||||
qCritical("XTRXOutput::applySettings: could not %s and set NCO to %d Hz",
|
qCritical("XTRXOutput::applySettings: could not %s and set NCO to %d Hz",
|
||||||
settings.m_ncoEnable ? "enable" : "disable",
|
m_settings.m_ncoEnable ? "enable" : "disable",
|
||||||
settings.m_ncoFrequency);
|
m_settings.m_ncoFrequency);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forwardChangeOwnDSP = true;
|
forwardChangeOwnDSP = true;
|
||||||
qDebug("XTRXOutput::applySettings: %sd and set NCO to %d Hz",
|
qDebug("XTRXOutput::applySettings: %sd and set NCO to %d Hz",
|
||||||
settings.m_ncoEnable ? "enable" : "disable",
|
m_settings.m_ncoEnable ? "enable" : "disable",
|
||||||
settings.m_ncoFrequency);
|
m_settings.m_ncoFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,7 @@ bool XTRXOutputGUI::handleMessage(const Message& message)
|
|||||||
else if (XTRXOutput::MsgReportClockGenChange::match(message))
|
else if (XTRXOutput::MsgReportClockGenChange::match(message))
|
||||||
{
|
{
|
||||||
m_settings.m_devSampleRate = m_XTRXOutput->getDevSampleRate();
|
m_settings.m_devSampleRate = m_XTRXOutput->getDevSampleRate();
|
||||||
|
m_settings.m_log2HardInterp = m_XTRXOutput->getLog2HardInterp();
|
||||||
|
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
|
@ -302,6 +302,71 @@
|
|||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<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>
|
||||||
|
<widget class="ValueDial" name="sampleRate" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Liberation Mono</family>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Device to host sample rate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="samplerateUnit">
|
||||||
|
<property name="text">
|
||||||
|
<string>S/s</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="hwInterpLabel">
|
<widget class="QLabel" name="hwInterpLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -356,6 +421,11 @@
|
|||||||
<string>32</string>
|
<string>32</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>64</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -432,71 +502,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<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>
|
|
||||||
<widget class="ValueDial" name="sampleRate" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Liberation Mono</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
<weight>50</weight>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="cursor">
|
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Device to host sample rate</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="samplerateUnit">
|
|
||||||
<property name="text">
|
|
||||||
<string>S/s</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
const PluginDescriptor XTRXOutputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor XTRXOutputPlugin::m_pluginDescriptor = {
|
||||||
QString("XTRX"),
|
QString("XTRX"),
|
||||||
QString("XTRX Output"),
|
QString("XTRX Output"),
|
||||||
QString("4.12.3"),
|
QString("4.14.4"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -400,12 +400,6 @@ void XTRXInput::stop()
|
|||||||
// remove old thread address from buddies (reset in all buddies)
|
// remove old thread address from buddies (reset in all buddies)
|
||||||
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||||
std::vector<DeviceAPI*>::const_iterator it = sourceBuddies.begin();
|
std::vector<DeviceAPI*>::const_iterator it = sourceBuddies.begin();
|
||||||
|
|
||||||
for (; it != sourceBuddies.end(); ++it)
|
|
||||||
{
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_source->setThread(0);
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_thread = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (nbOriginalChannels == 2) // Reduce from MI to SI by deleting and re-creating the thread
|
else if (nbOriginalChannels == 2) // Reduce from MI to SI by deleting and re-creating the thread
|
||||||
{
|
{
|
||||||
@ -422,13 +416,6 @@ void XTRXInput::stop()
|
|||||||
// remove old thread address from buddies (reset in all buddies). The address being held only in the owning source.
|
// remove old thread address from buddies (reset in all buddies). The address being held only in the owning source.
|
||||||
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
const std::vector<DeviceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||||
std::vector<DeviceAPI*>::const_iterator it = sourceBuddies.begin();
|
std::vector<DeviceAPI*>::const_iterator it = sourceBuddies.begin();
|
||||||
|
|
||||||
for (; it != sourceBuddies.end(); ++it)
|
|
||||||
{
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_source->setThread(0);
|
|
||||||
((DeviceXTRXShared*) (*it)->getBuddySharedPtr())->m_thread = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
xtrxInputThread->startWork();
|
xtrxInputThread->startWork();
|
||||||
}
|
}
|
||||||
@ -521,24 +508,20 @@ int XTRXInput::getSampleRate() const
|
|||||||
|
|
||||||
uint32_t XTRXInput::getDevSampleRate() const
|
uint32_t XTRXInput::getDevSampleRate() const
|
||||||
{
|
{
|
||||||
uint32_t devSampleRate = m_settings.m_devSampleRate;
|
|
||||||
|
|
||||||
if (m_deviceShared.m_dev) {
|
if (m_deviceShared.m_dev) {
|
||||||
devSampleRate = m_deviceShared.m_dev->getActualInputRate();
|
return m_deviceShared.m_dev->getActualInputRate();
|
||||||
|
} else {
|
||||||
|
return m_settings.m_devSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return devSampleRate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t XTRXInput::getLog2HardDecim() const
|
uint32_t XTRXInput::getLog2HardDecim() const
|
||||||
{
|
{
|
||||||
uint32_t log2HardDecim = m_settings.m_log2HardDecim;
|
|
||||||
|
|
||||||
if (m_deviceShared.m_dev && (m_deviceShared.m_dev->getActualInputRate() != 0.0)) {
|
if (m_deviceShared.m_dev && (m_deviceShared.m_dev->getActualInputRate() != 0.0)) {
|
||||||
log2HardDecim = log2(m_deviceShared.m_dev->getClockGen() / m_deviceShared.m_dev->getActualInputRate() / 4);
|
return log2(m_deviceShared.m_dev->getClockGen() / m_deviceShared.m_dev->getActualInputRate() / 4);
|
||||||
|
} else {
|
||||||
|
return m_settings.m_log2HardDecim;
|
||||||
}
|
}
|
||||||
|
|
||||||
return log2HardDecim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double XTRXInput::getClockGen() const
|
double XTRXInput::getClockGen() const
|
||||||
@ -630,15 +613,14 @@ bool XTRXInput::handleMessage(const Message& message)
|
|||||||
{
|
{
|
||||||
m_settings.m_devSampleRate = m_deviceShared.m_dev->getActualInputRate();
|
m_settings.m_devSampleRate = m_deviceShared.m_dev->getActualInputRate();
|
||||||
m_settings.m_log2HardDecim = getLog2HardDecim();
|
m_settings.m_log2HardDecim = getLog2HardDecim();
|
||||||
|
}
|
||||||
|
|
||||||
qDebug() << "XTRXInput::handleMessage: MsgReportBuddyChange:"
|
qDebug() << "XTRXInput::handleMessage: MsgReportBuddyChange:"
|
||||||
<< " host_Hz: " << m_deviceShared.m_dev->getActualInputRate()
|
<< " host_Hz: " << m_deviceShared.m_dev->getActualInputRate()
|
||||||
<< " adc_Hz: " << m_deviceShared.m_dev->getClockGen() / 4
|
<< " adc_Hz: " << m_deviceShared.m_dev->getClockGen() / 4
|
||||||
<< " m_log2HardDecim: " << m_settings.m_log2HardDecim;
|
<< " m_log2HardDecim: " << m_settings.m_log2HardDecim;
|
||||||
}
|
|
||||||
|
|
||||||
if (m_settings.m_ncoEnable) // need to reset NCO after sample rate change
|
if (m_settings.m_ncoEnable) { // need to reset NCO after sample rate change
|
||||||
{
|
|
||||||
applySettings(m_settings, false, true);
|
applySettings(m_settings, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1102,44 +1084,42 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
|
|||||||
|
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
|
|
||||||
if (doChangeSampleRate && (settings.m_devSampleRate != 0))
|
if (doChangeSampleRate && (m_settings.m_devSampleRate != 0))
|
||||||
{
|
{
|
||||||
XTRXInputThread *rxThread = findThread();
|
// XTRXInputThread *rxThread = findThread();
|
||||||
|
|
||||||
if (rxThread && rxThread->isRunning())
|
// if (rxThread && rxThread->isRunning())
|
||||||
{
|
// {
|
||||||
rxThread->stopWork();
|
// rxThread->stopWork();
|
||||||
rxThreadWasRunning = true;
|
// rxThreadWasRunning = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
suspendTxThread();
|
// suspendTxThread();
|
||||||
|
|
||||||
double master = (settings.m_log2HardDecim == 0) ? 0 : (settings.m_devSampleRate * 4 * (1 << settings.m_log2HardDecim));
|
double master = (m_settings.m_log2HardDecim == 0) ? 0 : (m_settings.m_devSampleRate * 4 * (1 << m_settings.m_log2HardDecim));
|
||||||
|
|
||||||
|
int res = m_deviceShared.m_dev->setSamplerate(
|
||||||
|
m_settings.m_devSampleRate,
|
||||||
|
master,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
if (m_deviceShared.m_dev->set_samplerate(settings.m_devSampleRate,
|
|
||||||
master, //(settings.m_devSampleRate<<settings.m_log2HardDecim)*4,
|
|
||||||
false) < 0)
|
|
||||||
{
|
|
||||||
qCritical("XTRXInput::applySettings: could not set sample rate to %f with oversampling of %d",
|
|
||||||
settings.m_devSampleRate,
|
|
||||||
1<<settings.m_log2HardDecim);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
doChangeFreq = true;
|
doChangeFreq = true;
|
||||||
forceNCOFrequency = true;
|
forceNCOFrequency = true;
|
||||||
forwardChangeAllDSP = true;
|
forwardChangeAllDSP = true;
|
||||||
|
m_settings.m_devSampleRate = m_deviceShared.m_dev->getActualInputRate();
|
||||||
|
m_settings.m_log2HardDecim = getLog2HardDecim();
|
||||||
|
|
||||||
qDebug("XTRXInput::applySettings: sample rate set to %f with oversampling of %d",
|
qDebug("XTRXInput::applySettings: sample rate set %s to %f with hard decimation of %d",
|
||||||
m_deviceShared.m_dev->getActualInputRate(),
|
(res < 0) ? "changed" : "unchanged",
|
||||||
1 << getLog2HardDecim());
|
m_settings.m_devSampleRate,
|
||||||
}
|
m_settings.m_log2HardDecim);
|
||||||
|
|
||||||
resumeTxThread();
|
// resumeTxThread();
|
||||||
|
|
||||||
if (rxThreadWasRunning) {
|
// if (rxThreadWasRunning) {
|
||||||
rxThread->startWork();
|
// rxThread->startWork();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doLPCalibration)
|
if (doLPCalibration)
|
||||||
@ -1179,12 +1159,12 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
|
|||||||
{
|
{
|
||||||
if (xtrx_tune(m_deviceShared.m_dev->getDevice(),
|
if (xtrx_tune(m_deviceShared.m_dev->getDevice(),
|
||||||
XTRX_TUNE_RX_FDD,
|
XTRX_TUNE_RX_FDD,
|
||||||
settings.m_centerFrequency,
|
m_settings.m_centerFrequency,
|
||||||
0) < 0) {
|
0) < 0) {
|
||||||
qCritical("XTRXInput::applySettings: could not set frequency to %lu", settings.m_centerFrequency);
|
qCritical("XTRXInput::applySettings: could not set frequency to %lu", m_settings.m_centerFrequency);
|
||||||
} else {
|
} else {
|
||||||
//doCalibration = true;
|
//doCalibration = true;
|
||||||
qDebug("XTRXInput::applySettings: frequency set to %lu", settings.m_centerFrequency);
|
qDebug("XTRXInput::applySettings: frequency set to %lu", m_settings.m_centerFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1196,19 +1176,19 @@ bool XTRXInput::applySettings(const XTRXInputSettings& settings, bool force, boo
|
|||||||
if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(),
|
if (xtrx_tune_ex(m_deviceShared.m_dev->getDevice(),
|
||||||
XTRX_TUNE_BB_RX,
|
XTRX_TUNE_BB_RX,
|
||||||
m_deviceShared.m_channel == 0 ? XTRX_CH_A : XTRX_CH_B,
|
m_deviceShared.m_channel == 0 ? XTRX_CH_A : XTRX_CH_B,
|
||||||
(settings.m_ncoEnable) ? settings.m_ncoFrequency : 0,
|
(m_settings.m_ncoEnable) ? m_settings.m_ncoFrequency : 0,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
{
|
{
|
||||||
qCritical("XTRXInput::applySettings: could not %s and set NCO to %d Hz",
|
qCritical("XTRXInput::applySettings: could not %s and set NCO to %d Hz",
|
||||||
settings.m_ncoEnable ? "enable" : "disable",
|
m_settings.m_ncoEnable ? "enable" : "disable",
|
||||||
settings.m_ncoFrequency);
|
m_settings.m_ncoFrequency);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forwardChangeOwnDSP = true;
|
forwardChangeOwnDSP = true;
|
||||||
qDebug("XTRXInput::applySettings: %sd and set NCO to %d Hz",
|
qDebug("XTRXInput::applySettings: %sd and set NCO to %d Hz",
|
||||||
settings.m_ncoEnable ? "enable" : "disable",
|
m_settings.m_ncoEnable ? "enable" : "disable",
|
||||||
settings.m_ncoFrequency);
|
m_settings.m_ncoFrequency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,7 @@ bool XTRXInputGUI::handleMessage(const Message& message)
|
|||||||
else if (XTRXInput::MsgReportClockGenChange::match(message))
|
else if (XTRXInput::MsgReportClockGenChange::match(message))
|
||||||
{
|
{
|
||||||
m_settings.m_devSampleRate = m_XTRXInput->getDevSampleRate();
|
m_settings.m_devSampleRate = m_XTRXInput->getDevSampleRate();
|
||||||
|
m_settings.m_log2HardDecim = m_XTRXInput->getLog2HardDecim();
|
||||||
|
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
|
@ -337,6 +337,71 @@
|
|||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<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>
|
||||||
|
<widget class="ValueDial" name="sampleRate" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Liberation Mono</family>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Device to host sample rate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="samplerateUnit">
|
||||||
|
<property name="text">
|
||||||
|
<string>S/s</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="hwDecimLabel">
|
<widget class="QLabel" name="hwDecimLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -391,6 +456,11 @@
|
|||||||
<string>32</string>
|
<string>32</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>64</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -467,71 +537,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<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>
|
|
||||||
<widget class="ValueDial" name="sampleRate" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Liberation Mono</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
<weight>50</weight>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="cursor">
|
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Device to host sample rate</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="samplerateUnit">
|
|
||||||
<property name="text">
|
|
||||||
<string>S/s</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
const PluginDescriptor XTRXInputPlugin::m_pluginDescriptor = {
|
const PluginDescriptor XTRXInputPlugin::m_pluginDescriptor = {
|
||||||
QString("XTRX"),
|
QString("XTRX"),
|
||||||
QString("XTRX Input"),
|
QString("XTRX Input"),
|
||||||
QString("4.12.3"),
|
QString("4.14.4"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
Loading…
Reference in New Issue
Block a user