mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
DaemonSink (4)
This commit is contained in:
parent
4819ebf5f6
commit
29583e4d56
@ -83,8 +83,11 @@ DaemonSink::~DaemonSink()
|
||||
|
||||
void DaemonSink::setTxDelay(int txDelay)
|
||||
{
|
||||
qDebug() << "DaemonSink::setTxDelay: txDelay: " << txDelay;
|
||||
m_txDelay = txDelay;
|
||||
double txDelayRatio = txDelay / 100.0;
|
||||
double delay = m_sampleRate == 0 ? 1.0 : (127*127*txDelayRatio) / m_sampleRate;
|
||||
delay /= 128 + m_settings.m_nbFECBlocks;
|
||||
m_txDelay = roundf(delay*1e6); // microseconds
|
||||
qDebug() << "DaemonSink::setTxDelay: "<< txDelay << "% m_txDelay: " << m_txDelay << "us";
|
||||
}
|
||||
|
||||
void DaemonSink::setNbBlocksFEC(int nbBlocksFEC)
|
||||
@ -304,11 +307,11 @@ void DaemonSink::applySettings(const DaemonSinkSettings& settings, bool force)
|
||||
<< " force: " << force;
|
||||
|
||||
if ((m_settings.m_nbFECBlocks != settings.m_nbFECBlocks) || force) {
|
||||
m_nbBlocksFEC = settings.m_nbFECBlocks;
|
||||
setNbBlocksFEC(settings.m_nbFECBlocks);
|
||||
}
|
||||
|
||||
if ((m_settings.m_txDelay != settings.m_txDelay) || force) {
|
||||
m_txDelay = settings.m_txDelay;
|
||||
setTxDelay(settings.m_txDelay);
|
||||
}
|
||||
|
||||
if ((m_settings.m_dataAddress != settings.m_dataAddress) || force) {
|
||||
|
@ -129,7 +129,7 @@ DaemonSinkGUI::DaemonSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
|
||||
m_deviceUISet->addRollupWidget(this);
|
||||
|
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
connect(&(m_deviceUISet->m_deviceSourceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
|
||||
//connect(&(m_deviceUISet->m_deviceSourceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
|
||||
|
||||
m_time.start();
|
||||
|
||||
@ -174,6 +174,11 @@ void DaemonSinkGUI::displaySettings()
|
||||
blockApplySettings(true);
|
||||
ui->dataAddress->setText(m_settings.m_dataAddress);
|
||||
ui->dataPort->setText(tr("%1").arg(m_settings.m_dataPort));
|
||||
QString s = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0);
|
||||
QString s1 = QString::number(m_settings.m_nbFECBlocks, 'f', 0);
|
||||
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1));
|
||||
ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay));
|
||||
updateTxDelayTooltip();
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
@ -259,7 +264,7 @@ void DaemonSinkGUI::on_dataApplyButton_clicked(bool checked __attribute__((unuse
|
||||
|
||||
void DaemonSinkGUI::on_txDelay_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_txDelay = value / 100.0;
|
||||
m_settings.m_txDelay = value; // percentage
|
||||
ui->txDelayText->setText(tr("%1").arg(value));
|
||||
updateTxDelayTooltip();
|
||||
applySettings();
|
||||
@ -279,7 +284,9 @@ void DaemonSinkGUI::on_nbFECBlocks_valueChanged(int value)
|
||||
|
||||
void DaemonSinkGUI::updateTxDelayTooltip()
|
||||
{
|
||||
double delay = m_sampleRate == 0 ? 0.0 : ((127*127*m_settings.m_txDelay) / m_sampleRate)/(128 + m_settings.m_nbFECBlocks);
|
||||
double txDelayRatio = m_settings.m_txDelay / 100.0;
|
||||
double delay = m_sampleRate == 0 ? 0.0 : (127*127*txDelayRatio) / m_sampleRate;
|
||||
delay /= 128 + m_settings.m_nbFECBlocks;
|
||||
ui->txDelayText->setToolTip(tr("%1 us").arg(QString::number(delay*1e6, 'f', 0)));
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@ void DaemonSinkSettings::resetToDefaults()
|
||||
m_txDelay = 100;
|
||||
m_dataAddress = "127.0.0.1";
|
||||
m_dataPort = 9090;
|
||||
m_rgbColor = QColor(140, 4, 4).rgb();
|
||||
m_title = "Daemon sink";
|
||||
}
|
||||
|
||||
QByteArray DaemonSinkSettings::serialize() const
|
||||
|
@ -97,6 +97,7 @@ bool DaemonSinkThread::handleDataBlock(SDRDaemonDataBlock& dataBlock)
|
||||
uint16_t frameIndex = dataBlock.m_txControlBlock.m_frameIndex;
|
||||
int nbBlocksFEC = dataBlock.m_txControlBlock.m_nbBlocksFEC;
|
||||
int txDelay = dataBlock.m_txControlBlock.m_txDelay;
|
||||
qDebug("DaemonSinkThread::handleDataBlock: txDelay: %d QS: %d", txDelay, m_dataQueue->size());
|
||||
m_address.setAddress(dataBlock.m_txControlBlock.m_dataAddress);
|
||||
uint16_t dataPort = dataBlock.m_txControlBlock.m_dataPort;
|
||||
SDRDaemonSuperBlock *txBlockx = dataBlock.m_superBlocks;
|
||||
@ -109,7 +110,8 @@ bool DaemonSinkThread::handleDataBlock(SDRDaemonDataBlock& dataBlock)
|
||||
{
|
||||
// send block via UDP
|
||||
m_socket->writeDatagram((const char*)&txBlockx[i], (qint64 ) SDRDaemonUdpSize, m_address, dataPort);
|
||||
usleep(txDelay);
|
||||
//m_socket->SendDataGram((const char*)&txBlockx[i], (int) SDRDaemonUdpSize, m_address.toStdString(), (uint32_t) dataPort);
|
||||
//usleep(txDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user