mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-03 13:47:50 -04:00
SDRDaemonSink: set the Tx delay as a percentage of the nominal UDP block transmission time
This commit is contained in:
parent
c67422fde7
commit
0935071f97
@ -224,14 +224,20 @@ void SDRdaemonSinkGui::updateSampleRateAndFrequency()
|
||||
ui->deviceRateText->setText(tr("%1k").arg((float)(m_sampleRate*(1<<m_settings.m_log2Interp)) / 1000));
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::updateTxDelayTooltip()
|
||||
{
|
||||
double delay = ((127*127*m_settings.m_txDelay) / m_settings.m_sampleRate)/(128 + m_settings.m_nbFECBlocks);
|
||||
ui->txDelayText->setToolTip(tr("%1 us").arg(QString::number(delay*1e6, 'f', 0)));
|
||||
}
|
||||
|
||||
void SDRdaemonSinkGui::displaySettings()
|
||||
{
|
||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||
ui->sampleRate->setValue(m_settings.m_sampleRate);
|
||||
ui->deviceRateText->setText(tr("%1k").arg((float)(m_sampleRate*(1<<m_settings.m_log2Interp)) / 1000));
|
||||
ui->interp->setCurrentIndex(m_settings.m_log2Interp);
|
||||
ui->txDelay->setValue(m_settings.m_txDelay/10);
|
||||
ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay));
|
||||
ui->txDelay->setValue(m_settings.m_txDelay*100);
|
||||
ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay*100));
|
||||
ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks);
|
||||
|
||||
QString s0 = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0);
|
||||
@ -389,6 +395,7 @@ void SDRdaemonSinkGui::on_centerFrequency_changed(quint64 value)
|
||||
void SDRdaemonSinkGui::on_sampleRate_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_sampleRate = value;
|
||||
updateTxDelayTooltip();
|
||||
sendControl();
|
||||
sendSettings();
|
||||
}
|
||||
@ -406,8 +413,9 @@ void SDRdaemonSinkGui::on_interp_currentIndexChanged(int index)
|
||||
|
||||
void SDRdaemonSinkGui::on_txDelay_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_txDelay = value * 10;
|
||||
ui->txDelayText->setText(tr("%1").arg(10*value));
|
||||
m_settings.m_txDelay = value / 100.0;
|
||||
ui->txDelayText->setText(tr("%1").arg(value));
|
||||
updateTxDelayTooltip();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -419,6 +427,7 @@ void SDRdaemonSinkGui::on_nbFECBlocks_valueChanged(int value)
|
||||
QString s = QString::number(nbOriginalBlocks + nbFECBlocks, 'f', 0);
|
||||
QString s1 = QString::number(nbFECBlocks, 'f', 0);
|
||||
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1));
|
||||
updateTxDelayTooltip();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,7 @@ private:
|
||||
void sendSettings();
|
||||
void updateWithStreamTime();
|
||||
void updateSampleRateAndFrequency();
|
||||
void updateTxDelayTooltip();
|
||||
void displayEventCounts();
|
||||
void displayEventTimer();
|
||||
|
||||
|
@ -293,16 +293,19 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Delay in microseconds between consecutive UDP packets</string>
|
||||
<string>Delay between consecutive UDP packets in percentage of nominal UDP packet process time</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>200</number>
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -310,12 +313,18 @@
|
||||
<widget class="QLabel" name="txDelayText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0000</string>
|
||||
<string>90</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -64,11 +64,13 @@ bool SDRdaemonSinkOutput::start()
|
||||
m_sdrDaemonSinkThread->setRemoteAddress(m_settings.m_address, m_settings.m_dataPort);
|
||||
m_sdrDaemonSinkThread->setCenterFrequency(m_settings.m_centerFrequency);
|
||||
m_sdrDaemonSinkThread->setSamplerate(m_settings.m_sampleRate);
|
||||
m_sdrDaemonSinkThread->setTxDelay(m_settings.m_txDelay);
|
||||
m_sdrDaemonSinkThread->setNbBlocksFEC(m_settings.m_nbFECBlocks);
|
||||
m_sdrDaemonSinkThread->connectTimer(m_masterTimer);
|
||||
m_sdrDaemonSinkThread->startWork();
|
||||
|
||||
double delay = ((127*127*m_settings.m_txDelay) / m_settings.m_sampleRate)/(128 + m_settings.m_nbFECBlocks);
|
||||
m_sdrDaemonSinkThread->setTxDelay((int) (delay*1e6));
|
||||
|
||||
mutexLocker.unlock();
|
||||
//applySettings(m_generalSettings, m_settings, true);
|
||||
qDebug("SDRdaemonSinkOutput::start: started");
|
||||
@ -171,6 +173,7 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
bool forwardChange = false;
|
||||
bool changeTxDelay = false;
|
||||
|
||||
if (force || (m_settings.m_address != settings.m_address) || (m_settings.m_dataPort != settings.m_dataPort))
|
||||
{
|
||||
@ -205,6 +208,7 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
|
||||
}
|
||||
|
||||
forwardChange = true;
|
||||
changeTxDelay = true;
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_log2Interp != settings.m_log2Interp))
|
||||
@ -213,16 +217,6 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
|
||||
forwardChange = true;
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_txDelay != settings.m_txDelay))
|
||||
{
|
||||
m_settings.m_txDelay = settings.m_txDelay;
|
||||
|
||||
if (m_sdrDaemonSinkThread != 0)
|
||||
{
|
||||
m_sdrDaemonSinkThread->setTxDelay(m_settings.m_txDelay);
|
||||
}
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_nbFECBlocks != settings.m_nbFECBlocks))
|
||||
{
|
||||
m_settings.m_nbFECBlocks = settings.m_nbFECBlocks;
|
||||
@ -231,11 +225,34 @@ void SDRdaemonSinkOutput::applySettings(const SDRdaemonSinkSettings& settings, b
|
||||
{
|
||||
m_sdrDaemonSinkThread->setNbBlocksFEC(m_settings.m_nbFECBlocks);
|
||||
}
|
||||
|
||||
changeTxDelay = true;
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_txDelay != settings.m_txDelay))
|
||||
{
|
||||
m_settings.m_txDelay = settings.m_txDelay;
|
||||
changeTxDelay = true;
|
||||
}
|
||||
|
||||
if (changeTxDelay)
|
||||
{
|
||||
double delay = ((127*127*m_settings.m_txDelay) / m_settings.m_sampleRate)/(128 + m_settings.m_nbFECBlocks);
|
||||
qDebug("SDRdaemonSinkOutput::applySettings: Tx delay: %f us", delay*1e6);
|
||||
|
||||
if (m_sdrDaemonSinkThread != 0)
|
||||
{
|
||||
// delay is calculated as a fraction of the nominal UDP block process time
|
||||
// frame size: 127 * 127 samples
|
||||
// divided by sample rate gives the frame process time
|
||||
// divided by the number of actual blocks including FEC blocks gives the block (i.e. UDP block) process time
|
||||
m_sdrDaemonSinkThread->setTxDelay((int) (delay*1e6));
|
||||
}
|
||||
}
|
||||
|
||||
mutexLocker.unlock();
|
||||
|
||||
qDebug("SDRdaemonSinkOutput::applySettings: %s m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d m_txDelay: %d m_nbFECBlocks: %d",
|
||||
qDebug("SDRdaemonSinkOutput::applySettings: %s m_centerFrequency: %llu m_sampleRate: %llu m_log2Interp: %d m_txDelay: %f m_nbFECBlocks: %d",
|
||||
forwardChange ? "forward change" : "",
|
||||
m_settings.m_centerFrequency,
|
||||
m_settings.m_sampleRate,
|
||||
|
@ -27,7 +27,7 @@ void SDRdaemonSinkSettings::resetToDefaults()
|
||||
m_centerFrequency = 435000*1000;
|
||||
m_sampleRate = 192000;
|
||||
m_log2Interp = 4;
|
||||
m_txDelay = 300;
|
||||
m_txDelay = 0.5;
|
||||
m_nbFECBlocks = 0;
|
||||
m_address = "127.0.0.1";
|
||||
m_dataPort = 9092;
|
||||
@ -41,7 +41,7 @@ QByteArray SDRdaemonSinkSettings::serialize() const
|
||||
|
||||
s.writeU64(1, m_sampleRate);
|
||||
s.writeU32(2, m_log2Interp);
|
||||
s.writeU32(3, m_txDelay);
|
||||
s.writeFloat(3, m_txDelay);
|
||||
s.writeU32(4, m_nbFECBlocks);
|
||||
s.writeString(5, m_address);
|
||||
s.writeU32(6, m_dataPort);
|
||||
@ -66,7 +66,7 @@ bool SDRdaemonSinkSettings::deserialize(const QByteArray& data)
|
||||
quint32 uintval;
|
||||
d.readU64(1, &m_sampleRate, 48000);
|
||||
d.readU32(2, &m_log2Interp, 0);
|
||||
d.readU32(3, &m_txDelay, 300);
|
||||
d.readFloat(3, &m_txDelay, 0.5);
|
||||
d.readU32(4, &m_nbFECBlocks, 0);
|
||||
d.readString(5, &m_address, "127.0.0.1");
|
||||
d.readU32(6, &uintval, 9090);
|
||||
|
@ -23,7 +23,7 @@ struct SDRdaemonSinkSettings {
|
||||
quint64 m_centerFrequency;
|
||||
quint64 m_sampleRate;
|
||||
quint32 m_log2Interp;
|
||||
quint32 m_txDelay;
|
||||
float m_txDelay;
|
||||
quint32 m_nbFECBlocks;
|
||||
QString m_address;
|
||||
quint16 m_dataPort;
|
||||
|
@ -178,13 +178,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="gridLayout_corr">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Auto Corr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="dcOffset">
|
||||
<property name="toolTip">
|
||||
@ -218,6 +211,64 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bufferLenSecsText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Buffer length in seconds</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="lineStream7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bufferRWBalanceText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Main buffer read/write positions unbalance (%): positive means read leads</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-00</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="lineStream2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="absTimeText">
|
||||
<property name="enabled">
|
||||
@ -441,38 +492,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bufferLenSecsText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Buffer length in seconds</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="lineStream7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nominalNbBlocksText">
|
||||
<property name="minimumSize">
|
||||
@ -492,32 +511,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="lineStream2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bufferRWBalanceText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Main buffer read/write positions unbalance (%): positive means read leads</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-00</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@ -570,9 +563,12 @@
|
||||
<property name="toolTip">
|
||||
<string>Local data connection IP address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0.0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
@ -599,9 +595,12 @@
|
||||
<property name="toolTip">
|
||||
<string>Local data connection port</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
@ -619,9 +618,12 @@
|
||||
<property name="toolTip">
|
||||
<string>Remote control port</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user