1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-03-23 04:44:53 -04:00

SDRdaemonFEC: implemented tx delay as percentage of UDP packet process time

This commit is contained in:
f4exb 2017-06-08 23:35:52 +02:00
parent 45b3c73c20
commit 860048a1d1
3 changed files with 84 additions and 17 deletions

View File

@ -68,6 +68,7 @@ SDRdaemonFECGui::SDRdaemonFECGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_countRecovered(0),
m_doApplySettings(true),
m_forceSettings(true),
m_txDelay(0.0),
m_dcBlock(false),
m_iqCorrection(false)
{
@ -163,6 +164,8 @@ bool SDRdaemonFECGui::deserialize(const QByteArray& data)
{
displaySettings();
configureUDPLink();
updateTxDelay();
sendControl();
blockApplySettings(false);
sendControl(true);
m_forceSettings = true;
@ -199,12 +202,21 @@ bool SDRdaemonFECGui::handleMessage(const Message& message)
}
else if (SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData::match(message))
{
m_sampleRate = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).getSampleRate();
m_centerFrequency = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).getCenterFrequency();
m_startingTimeStamp.tv_sec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).get_tv_sec();
m_startingTimeStamp.tv_usec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).get_tv_usec();
updateWithStreamData();
return true;
int sampleRate = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).getSampleRate();
if (m_sampleRate != sampleRate)
{
m_sampleRate = sampleRate;
updateTxDelay();
sendControl();
}
m_centerFrequency = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).getCenterFrequency();
m_startingTimeStamp.tv_sec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).get_tv_sec();
m_startingTimeStamp.tv_usec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamData&)message).get_tv_usec();
updateWithStreamData();
return true;
}
else if (SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming::match(message))
{
@ -221,7 +233,15 @@ bool SDRdaemonFECGui::handleMessage(const Message& message)
m_avgNbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbOriginalBlocks();
m_avgNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbRecovery();
m_nbOriginalBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbOriginalBlocksPerFrame();
m_nbFECBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbFECBlocksPerFrame();
int nbFECBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getNbFECBlocksPerFrame();
if (m_nbFECBlocks != nbFECBlocks)
{
m_nbFECBlocks = nbFECBlocks;
updateTxDelay();
sendControl();
}
updateWithStreamTime();
return true;
@ -276,6 +296,12 @@ void SDRdaemonFECGui::updateSampleRateAndFrequency()
ui->deviceRateText->setText(tr("%1k").arg((float)m_deviceSampleRate / 1000));
}
void SDRdaemonFECGui::updateTxDelay()
{
m_txDelay = ((127*127*m_settings.m_txDelay) / m_sampleRate)/(128 + m_nbFECBlocks);
ui->txDelayText->setToolTip(tr("%1 us").arg(QString::number(m_txDelay*1e6, 'f', 0)));
}
void SDRdaemonFECGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
@ -287,7 +313,7 @@ void SDRdaemonFECGui::displaySettings()
ui->sampleRate->setText(QString::number(m_settings.m_sampleRate / 1000));
ui->specificParms->setText(m_settings.m_specificParameters);
ui->specificParms->setCursorPosition(0);
ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay*100));
QString s0 = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0);
QString s1 = QString::number(m_settings.m_nbFECBlocks, 'f', 0);
@ -300,7 +326,6 @@ void SDRdaemonFECGui::displaySettings()
ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
}
void SDRdaemonFECGui::sendControl(bool force)
@ -364,6 +389,14 @@ void SDRdaemonFECGui::sendControl(bool force)
nbArgs++;
}
if (m_txDelay != 0.0)
{
if (nbArgs > 0) os << ",";
os << "txdelay=" << (int) (m_txDelay*1e6);
nbArgs++;
m_txDelay = 0.0;
}
if ((m_settings.m_specificParameters != m_controlSettings.m_specificParameters) || force)
{
if (m_settings.m_specificParameters.size() > 0)
@ -436,6 +469,7 @@ void SDRdaemonFECGui::on_applyButton_clicked(bool checked __attribute__((unused)
void SDRdaemonFECGui::on_sendButton_clicked(bool checked __attribute__((unused)))
{
updateTxDelay();
sendControl(true);
ui->specificParms->setCursorPosition(0);
}
@ -542,6 +576,14 @@ void SDRdaemonFECGui::on_fcPos_currentIndexChanged(int index __attribute__((unus
sendControl();
}
void SDRdaemonFECGui::on_txDelay_valueChanged(int value)
{
m_settings.m_txDelay = value / 100.0;
ui->txDelayText->setText(tr("%1").arg(value));
updateTxDelay();
sendControl();
}
void SDRdaemonFECGui::on_startStop_toggled(bool checked)
{
if (checked)

View File

@ -97,6 +97,7 @@ private:
bool m_doApplySettings;
bool m_forceSettings;
double m_txDelay;
bool m_dcBlock;
bool m_iqCorrection;
@ -115,6 +116,7 @@ private:
void updateWithStreamData();
void updateWithStreamTime();
void updateSampleRateAndFrequency();
void updateTxDelay();
void displayEventCounts();
void displayEventTimer();
@ -136,6 +138,7 @@ private slots:
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_eventCountsReset_clicked(bool checked);
void on_txDelay_valueChanged(int value);
void updateHardware();
void updateStatus();
void tick();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>372</width>
<height>292</height>
<height>261</height>
</rect>
</property>
<property name="minimumSize">
@ -557,7 +557,7 @@
</property>
<property name="minimumSize">
<size>
<width>120</width>
<width>100</width>
<height>0</height>
</size>
</property>
@ -587,12 +587,6 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Local data connection port</string>
</property>
@ -630,6 +624,19 @@
</property>
</widget>
</item>
<item>
<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>
<item>
<widget class="QPushButton" name="applyButton">
<property name="enabled">
@ -744,6 +751,21 @@
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Delay between consecutive UDP packets in percentage of nominal UDP packet process time</string>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>90</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
<item>