1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-04 23:14:47 -04:00

BladeRF2 output: tried to fix SO->MO and MO->SO cycle

This commit is contained in:
f4exb
2018-10-02 06:11:34 +02:00
parent 49a0dbac40
commit f4976485fc
3 changed files with 33 additions and 39 deletions
@@ -298,6 +298,11 @@ bool BladeRF2Output::start()
((DeviceBladeRF2Shared*) (*it)->getBuddySharedPtr())->m_sink->setThread(0);
}
// close all channels
for (int i = bladeRF2OutputThread->getNbChannels()-1; i >= 0; i--) {
m_deviceShared.m_dev->closeTx(i);
}
needsStart = true;
}
else
@@ -320,11 +325,9 @@ bool BladeRF2Output::start()
if (needsStart)
{
qDebug("BladeRF2Output::start: enabling channel(s) and (re)sart buddy thread");
qDebug("BladeRF2Output::start: enabling channel(s) and (re)starting the thread");
int nbChannels = bladeRF2OutputThread->getNbChannels();
for (int i = 0; i < nbChannels; i++)
for (unsigned int i = 0; i < bladeRF2OutputThread->getNbChannels(); i++) // open all channels
{
if (!m_deviceShared.m_dev->openTx(i)) {
qCritical("BladeRF2Output::start: channel %u cannot be enabled", i);
@@ -429,16 +432,22 @@ void BladeRF2Output::stop()
((DeviceBladeRF2Shared*) (*it)->getBuddySharedPtr())->m_sink->setThread(0);
}
for (int i = 0; i < nbOriginalChannels-1; i++) // close all inactive channels
{
if (fifos[i] == 0) {
m_deviceShared.m_dev->closeTx(i);
}
// close all channels
for (int i = nbOriginalChannels-1; i >= 0; i--) {
m_deviceShared.m_dev->closeTx(i);
}
m_deviceShared.m_dev->closeTx(requestedChannel); // close the last channel
if (stillActiveFIFO)
{
qDebug("BladeRF2Output::stop: enabling channel(s) and restarting the thread");
for (unsigned int i = 0; i < bladeRF2OutputThread->getNbChannels(); i++) // open all channels
{
if (!m_deviceShared.m_dev->openTx(i)) {
qCritical("BladeRF2Output::start: channel %u cannot be enabled", i);
}
}
if (stillActiveFIFO) {
bladeRF2OutputThread->startWork();
}
}