1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

PlutoSDR MIMO: fixed MO thread and att setting in GUI

This commit is contained in:
f4exb 2021-05-04 16:32:58 +02:00
parent bfa4c62d81
commit 94d037aa16
7 changed files with 35 additions and 9 deletions

View File

@ -43,7 +43,9 @@ DevicePlutoSDRBox::DevicePlutoSDRBox(const std::string& uri) :
m_rxBuf(nullptr),
m_txBuf(nullptr),
m_xoInitial(0),
m_temp(0.0f)
m_temp(0.0f),
m_rxSampleBytes(0),
m_txSampleBytes(0)
{
m_ctx = iio_create_context_from_uri(uri.c_str());
@ -295,6 +297,7 @@ bool DevicePlutoSDRBox::openRx()
df->with_scale? "true" : "false",
df->scale,
df->repeat);
m_rxSampleBytes = df->length / 8;
}
else
{
@ -343,6 +346,7 @@ bool DevicePlutoSDRBox::openSecondRx()
df->with_scale? "true" : "false",
df->scale,
df->repeat);
m_rxSampleBytes = df->length / 8;
}
else
{
@ -390,6 +394,7 @@ bool DevicePlutoSDRBox::openTx()
df->with_scale? "true" : "false",
df->scale,
df->repeat);
m_txSampleBytes = df->length / 8;
}
else
{
@ -436,6 +441,7 @@ bool DevicePlutoSDRBox::openSecondTx()
df->with_scale? "true" : "false",
df->scale,
df->repeat);
m_txSampleBytes = df->length / 8;
}
else
{

View File

@ -90,6 +90,8 @@ public:
void closeSecondTx(); //!< Close second Tx (Tx1)
int getNbRx() const { return m_rxChannels.size() / 2; }
int getNbTx() const { return m_txChannels.size() / 2; }
int getRxSampleBytes() const { return m_rxSampleBytes; }
int getTxSampleBytes() const { return m_txSampleBytes; }
struct iio_buffer *createRxBuffer(unsigned int size, bool cyclic);
struct iio_buffer *createTxBuffer(unsigned int size, bool cyclic);
void deleteRxBuffer();
@ -133,6 +135,8 @@ private:
bool m_valid;
int64_t m_xoInitial;
float m_temp;
int m_rxSampleBytes; //!< size in bytes of a Rx I or Q sample. Rx must be opened.
int m_txSampleBytes; //!< size in bytes of a Tx I or Q sample. Tx must be opened.
QList<QString> m_rxChannelIds;
QList<iio_channel*> m_rxChannels;
QList<QString> m_txChannelIds;

View File

@ -228,7 +228,7 @@ bool PlutoSDRMIMO::startTx()
m_plutoParams->getBox()->openSecondTx();
}
m_plutoTxBuffer = m_plutoParams->getBox()->createRxBuffer(PlutoSDRMIMOSettings::m_plutoSDRBlockSizeSamples, false);
m_plutoTxBuffer = m_plutoParams->getBox()->createTxBuffer(PlutoSDRMIMOSettings::m_plutoSDRBlockSizeSamples, false);
m_sinkThread->startWork();
mutexLocker.unlock();
m_runningTx = true;

View File

@ -771,6 +771,19 @@ void PlutoSDRMIMOGUI::on_gain_valueChanged(int value)
sendSettings();
}
void PlutoSDRMIMOGUI::on_att_valueChanged(int value)
{
ui->attText->setText(QString("%1 dB").arg(QString::number(value*0.25, 'f', 2)));
if (m_streamIndex == 0) {
m_settings.m_tx0Att = value;
} else {
m_settings.m_tx1Att = value;
}
sendSettings();
}
void PlutoSDRMIMOGUI::on_antenna_currentIndexChanged(int index)
{
if (m_rxElseTx)

View File

@ -103,6 +103,7 @@ private slots:
void on_gainLock_toggled(bool checked);
void on_gainMode_currentIndexChanged(int index);
void on_gain_valueChanged(int value);
void on_att_valueChanged(int value);
void on_transverter_clicked();
void on_rfDCOffset_toggled(bool checked);
void on_bbDCOffset_toggled(bool checked);

View File

@ -90,13 +90,14 @@ int PlutoSDRMIThread::getFcPos() const
void PlutoSDRMIThread::run()
{
std::ptrdiff_t p_inc = m_plutoBox->rxBufferStep();
int sampleSize = 4; // I/Q sample size in bytes
int sampleSize = 2*m_plutoBox->getRxSampleBytes(); // I/Q sample size in bytes
int nbChan = p_inc / sampleSize; // number of I/Q channels
qDebug("PlutoSDRMOThread::run: nbChan: %d", nbChan);
qDebug("PlutoSDRMOThread::run: I+Q bytes %d", sampleSize);
qDebug("PlutoSDRMIThread::run: rxBufferStep: %ld bytes", p_inc);
qDebug("PlutoSDRMIThread::run: Rx sample size is %ld bytes", m_plutoBox->getRxSampleSize()); // couple of I/Q
qDebug("PlutoSDRMIThread::run: Tx sample size is %ld bytes", m_plutoBox->getTxSampleSize());
qDebug("PlutoSDRMIThread::run: Rx all samples size is %ld bytes", m_plutoBox->getRxSampleSize());
qDebug("PlutoSDRMIThread::run: Tx all samples size is %ld bytes", m_plutoBox->getTxSampleSize());
qDebug("PlutoSDRMIThread::run: nominal nbytes_rx is %ld bytes with 1 refill", m_plutoSDRBlockSizeSamples*p_inc);
m_running = true;

View File

@ -86,13 +86,14 @@ int PlutoSDRMOThread::getFcPos() const
void PlutoSDRMOThread::run()
{
std::ptrdiff_t p_inc = m_plutoBox->txBufferStep();
int sampleSize = 4; // I/Q sample size in bytes
int sampleSize = 2*m_plutoBox->getTxSampleBytes(); // I/Q sample size in bytes
int nbChan = p_inc / sampleSize; // number of I/Q channels
qDebug("PlutoSDRMOThread::run: nbChan: %d", nbChan);
qDebug("PlutoSDRMOThread::run: I+Q bytes %d", sampleSize);
qDebug("PlutoSDRMOThread::run: txBufferStep: %ld bytes", p_inc);
qDebug("PlutoSDRMOThread::run: Rx sample size is %ld bytes", m_plutoBox->getRxSampleSize()); // couple of I/Q
qDebug("PlutoSDRMOThread::run: Tx sample size is %ld bytes", m_plutoBox->getTxSampleSize());
qDebug("PlutoSDRMOThread::run: Rx all samples size is %ld bytes", m_plutoBox->getRxSampleSize());
qDebug("PlutoSDRMOThread::run: Tx all samples size is %ld bytes", m_plutoBox->getTxSampleSize());
qDebug("PlutoSDRMOThread::run: nominal nbytes_tx is %ld bytes", PlutoSDRMIMOSettings::m_plutoSDRBlockSizeSamples*p_inc);
m_running = true;
@ -126,7 +127,7 @@ void PlutoSDRMOThread::run()
// Schedule TX buffer for sending
nbytes_tx = m_plutoBox->txBufferPush();
if (nbytes_tx != sampleSize*PlutoSDRMIMOSettings::m_plutoSDRBlockSizeSamples)
if (nbytes_tx != nbChan*sampleSize*PlutoSDRMIMOSettings::m_plutoSDRBlockSizeSamples)
{
qDebug("PlutoSDRMOThread::run: error pushing buf %d / %d",
(int) nbytes_tx, (int) sampleSize*PlutoSDRMIMOSettings::m_plutoSDRBlockSizeSamples);