1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-28 13:04:17 -04:00

API: fixed adding channels when device is MIMO

This commit is contained in:
f4exb
2022-01-13 02:45:25 +01:00
parent 61226c06bd
commit a1c85aac17
3 changed files with 39 additions and 11 deletions
+30 -2
View File
@@ -1170,7 +1170,35 @@ bool MainWindow::handleMessage(const Message& cmd)
{
MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd;
ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex());
channelAddClicked(notif.getChannelRegistrationIndex());
int currentChannelTabIndex = ui->tabChannels->currentIndex();
if (currentChannelTabIndex >= 0)
{
DeviceUISet *deviceUI = m_deviceUIs[currentChannelTabIndex];
int channelRegistrationIndex;
if (deviceUI->m_deviceMIMOEngine)
{
int nbMIMOChannels = deviceUI->getNumberOfAvailableMIMOChannels();
int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels();
int nbTxChannels = deviceUI->getNumberOfAvailableTxChannels();
int direction = notif.getDirection();
if (direction == 2) {
channelRegistrationIndex = notif.getChannelRegistrationIndex();
} else if (direction == 0) {
channelRegistrationIndex = nbMIMOChannels + notif.getChannelRegistrationIndex();
} else {
channelRegistrationIndex = nbMIMOChannels + nbRxChannels + notif.getChannelRegistrationIndex();
}
}
else
{
channelRegistrationIndex = notif.getChannelRegistrationIndex();
}
channelAddClicked(channelRegistrationIndex);
}
return true;
}
@@ -2247,7 +2275,7 @@ void MainWindow::channelAddClicked(int channelIndex)
int nbMIMOChannels = deviceUI->getNumberOfAvailableMIMOChannels();
int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels();
int nbTxChannels = deviceUI->getNumberOfAvailableTxChannels();
qDebug("MainWindow::channelAddClicked: MIMO: tab: nbMIMO: %d %d nbRx: %d nbTx: %d selected: %d",
qDebug("MainWindow::channelAddClicked: MIMO: tab %d : nbMIMO: %d nbRx: %d nbTx: %d selected: %d",
currentChannelTabIndex, nbMIMOChannels, nbRxChannels, nbTxChannels, channelIndex);
if (channelIndex < nbMIMOChannels)