diff --git a/sdrbase/limerfe/limerfecontroller.cpp b/sdrbase/limerfe/limerfecontroller.cpp index 0aeadd886..e3dc0043d 100644 --- a/sdrbase/limerfe/limerfecontroller.cpp +++ b/sdrbase/limerfe/limerfecontroller.cpp @@ -47,6 +47,8 @@ LimeRFEController::LimeRFESettings::LimeRFESettings() m_txHAMChannel = HAM_144_146MHz; m_txCellularChannel = CellularBand38; m_txPort = TxPortJ3; + m_swrEnable = false; + m_swrSource = SWRExternal; m_txRxDriven = false; m_rxOn = false; m_txOn = false; diff --git a/sdrgui/limerfegui/limerfeusbdialog.cpp b/sdrgui/limerfegui/limerfeusbdialog.cpp index 75752b38b..49eea9e08 100644 --- a/sdrgui/limerfegui/limerfeusbdialog.cpp +++ b/sdrgui/limerfegui/limerfeusbdialog.cpp @@ -22,14 +22,16 @@ #include "dsp/dspengine.h" #include "dsp/dspdevicesourceengine.h" #include "dsp/dspdevicesinkengine.h" +#include "mainwindow.h" +#include "device/deviceuiset.h" #include "gui/doublevalidator.h" #include "limerfeusbdialog.h" #include "ui_limerfeusbdialog.h" -LimeRFEUSBDialog::LimeRFEUSBDialog(LimeRFEUSBCalib& limeRFEUSBCalib, QWidget* parent) : +LimeRFEUSBDialog::LimeRFEUSBDialog(LimeRFEUSBCalib& limeRFEUSBCalib, MainWindow* mainWindow) : m_limeRFEUSBCalib(limeRFEUSBCalib), - QDialog(parent), + QDialog(mainWindow), ui(new Ui::LimeRFEUSBDialog), m_rxTxToggle(false), m_currentPowerCorrection(0.0), @@ -37,6 +39,7 @@ LimeRFEUSBDialog::LimeRFEUSBDialog(LimeRFEUSBCalib& limeRFEUSBCalib, QWidget* pa m_deviceSetSync(false) { ui->setupUi(this); + m_mainWindow = mainWindow; ui->powerCorrValue->setValidator(new DoubleValidator(-99.9, 99.9, 1, ui->powerCorrValue)); std::vector comPorts; SerialUtil::getComPorts(comPorts, "ttyUSB[0-9]+"); // regex is for Linux only @@ -656,6 +659,9 @@ void LimeRFEUSBDialog::stopStartRx(bool start) if (deviceSourceEngine->initAcquisition()) { deviceSourceEngine->startAcquisition(); } + + MainWindow::MsgDeviceSetFocus *msg = MainWindow::MsgDeviceSetFocus::create(m_rxDeviceSetIndex[rxDeviceSetSequence]); + m_mainWindow->getInputMessageQueue()->push(msg); } else { @@ -678,6 +684,9 @@ void LimeRFEUSBDialog::stopStartTx(bool start) if (deviceSinkEngine->initGeneration()) { deviceSinkEngine->startGeneration(); } + + MainWindow::MsgDeviceSetFocus *msg = MainWindow::MsgDeviceSetFocus::create(m_txDeviceSetIndex[txDeviceSetSequence]); + m_mainWindow->getInputMessageQueue()->push(msg); } else { @@ -710,22 +719,37 @@ void LimeRFEUSBDialog::updateAbsPower(double powerCorrDB) void LimeRFEUSBDialog::updateDeviceSetList() { - DSPEngine *dspEngine = DSPEngine::instance(); + std::vector& deviceUISets = m_mainWindow->getDeviceUISets(); + std::vector::const_iterator it = deviceUISets.begin(); m_sourceEngines.clear(); + m_rxDeviceSetIndex.clear(); m_sinkEngines.clear(); + m_txDeviceSetIndex.clear(); + ui->deviceSetRx->clear(); + ui->deviceSetTx->clear(); + unsigned int deviceIndex = 0; + unsigned int rxIndex = 0; + unsigned int txIndex = 0; - for (uint32_t i = 0; i < dspEngine->getDeviceSourceEnginesNumber(); i++) + for (; it != deviceUISets.end(); ++it, deviceIndex++) { - DSPDeviceSourceEngine *deviceSourceEngine = dspEngine->getDeviceSourceEngineByIndex(i); - m_sourceEngines.push_back(deviceSourceEngine); - ui->deviceSetRx->addItem(QString("%1").arg(i)); - } + DSPDeviceSourceEngine *deviceSourceEngine = (*it)->m_deviceSourceEngine; + DSPDeviceSinkEngine *deviceSinkEngine = (*it)->m_deviceSinkEngine; - for (uint32_t i = 0; i < dspEngine->getDeviceSinkEnginesNumber(); i++) - { - DSPDeviceSinkEngine *deviceSinkEngine = dspEngine->getDeviceSinkEngineByIndex(i); - m_sinkEngines.push_back(deviceSinkEngine); - ui->deviceSetTx->addItem(QString("%1").arg(i)); + if (deviceSourceEngine) + { + m_sourceEngines.push_back(deviceSourceEngine); + m_rxDeviceSetIndex.push_back(deviceIndex); + ui->deviceSetRx->addItem(QString("%1").arg(deviceIndex)); + rxIndex++; + } + else if (deviceSinkEngine) + { + m_sinkEngines.push_back(deviceSinkEngine); + m_txDeviceSetIndex.push_back(deviceIndex); + ui->deviceSetTx->addItem(QString("%1").arg(deviceIndex)); + txIndex++; + } } } @@ -824,9 +848,11 @@ void LimeRFEUSBDialog::on_rxTxToggle_clicked() int rc = m_controller.setTx(m_settings, m_settings.m_txOn); ui->statusText->setText(m_controller.getError(rc).c_str()); displayMode(); - } - highlightApplyButton(true); + if (m_deviceSetSync) { + syncRxTx(); + } + } } void LimeRFEUSBDialog::on_apply_clicked() diff --git a/sdrgui/limerfegui/limerfeusbdialog.h b/sdrgui/limerfegui/limerfeusbdialog.h index c814f7dfc..673fb24a2 100644 --- a/sdrgui/limerfegui/limerfeusbdialog.h +++ b/sdrgui/limerfegui/limerfeusbdialog.h @@ -31,6 +31,7 @@ class DSPDeviceSourceEngine; class DSPDeviceSinkEngine; +class MainWindow; namespace Ui { class LimeRFEUSBDialog; @@ -40,7 +41,7 @@ class SDRGUI_API LimeRFEUSBDialog : public QDialog { Q_OBJECT public: - explicit LimeRFEUSBDialog(LimeRFEUSBCalib& limeRFEUSBCalib, QWidget* parent = nullptr); + explicit LimeRFEUSBDialog(LimeRFEUSBCalib& limeRFEUSBCalib, MainWindow* mainWindow); ~LimeRFEUSBDialog(); private: @@ -61,6 +62,7 @@ private: void highlightApplyButton(bool highlight); Ui::LimeRFEUSBDialog* ui; + MainWindow *m_mainWindow; LimeRFEController m_controller; LimeRFEController::LimeRFESettings m_settings; LimeRFEUSBCalib& m_limeRFEUSBCalib; @@ -73,7 +75,9 @@ private: int m_rxDeviceSetSequence; int m_txDeviceSetSequence; std::vector m_sourceEngines; + std::vector m_rxDeviceSetIndex; std::vector m_sinkEngines; + std::vector m_txDeviceSetIndex; private slots: void on_openDevice_clicked(); diff --git a/sdrgui/limerfegui/limerfeusbdialog.ui b/sdrgui/limerfegui/limerfeusbdialog.ui index a6b7885ad..a8b75a21f 100644 --- a/sdrgui/limerfegui/limerfeusbdialog.ui +++ b/sdrgui/limerfegui/limerfeusbdialog.ui @@ -886,7 +886,7 @@ - Sequence of Rx DeviceSet + Index of Rx DeviceSet @@ -899,7 +899,7 @@ - Sequence of Tx DeviceSet + Index of Tx DeviceSet diff --git a/sdrgui/limerfeusbgui.md b/sdrgui/limerfeusbgui.md index 7641baa57..9ced50bc1 100644 --- a/sdrgui/limerfeusbgui.md +++ b/sdrgui/limerfeusbgui.md @@ -181,21 +181,17 @@ Use this switch to activate Rx/Tx toggle. When Rx is switched on Tx is switched When switched on this connects the Rx (D.1) and Tx (D.2) switches to a Rx and Tx device set selected by (D.5) and (D.6) respectively in order to start or stop devices accordingly. -

D.5 Rx device set sequence

+

D.5 Rx device set index

-Select the Rx device set sequence with which you want to synchronize the Rx switch (D.1). Note that this is the sequence of Rx in increasing order of Rx tabs and not the tab number itself. +Select the Rx device set index with which you want to synchronize the Rx switch (D.1). -For example if you have a configuration with R0, T1 and R2 tabs the device set corresponding to R2 will be identified with sequence number 1. +

D.6 Tx device set index

-

D.6 Tx device set sequence

+Select the Tx device set index with which you want to synchronize the Tx switch (D.2). -Select the Tx device set sequence with which you want to synchronize the Tx switch (D.2). Note that this is the sequence of Tx in increasing order of Tx tabs and not the tab number itself. +

D.7 Refresh device sets indexes

-Using the same example as above T1 is identified with sequence number 0. - -

D.7 Refresh device sets sequences

- -When the configuration of device sets changes you can use this button to refresh the device set sequences in (D.5) and (D.6). +When the configuration of device sets changes you can use this button to refresh the device set indexes in (D.5) and (D.6).

5. Status window

diff --git a/sdrgui/mainwindow.h b/sdrgui/mainwindow.h index e5a84bfe3..c620bdde6 100644 --- a/sdrgui/mainwindow.h +++ b/sdrgui/mainwindow.h @@ -68,6 +68,26 @@ class SDRGUI_API MainWindow : public QMainWindow { Q_OBJECT public: + class MsgDeviceSetFocus : public Message { + MESSAGE_CLASS_DECLARATION + + public: + int getDeviceSetIndex() const { return m_deviceSetIndex; } + + static MsgDeviceSetFocus* create(int deviceSetIndex) + { + return new MsgDeviceSetFocus(deviceSetIndex); + } + + private: + int m_deviceSetIndex; + + MsgDeviceSetFocus(int deviceSetIndex) : + Message(), + m_deviceSetIndex(deviceSetIndex) + { } + }; + explicit MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent = 0); ~MainWindow(); static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference @@ -82,6 +102,7 @@ public: const QTimer& getMasterTimer() const { return m_masterTimer; } const MainSettings& getMainSettings() const { return m_settings; } const PluginManager *getPluginManager() const { return m_pluginManager; } + std::vector& getDeviceUISets() { return m_deviceUIs; } void commandKeysConnect(QObject *object, const char *slot); void commandKeysDisconnect(QObject *object, const char *slot); @@ -279,26 +300,6 @@ private: QString tabName; }; - class MsgDeviceSetFocus : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getDeviceSetIndex() const { return m_deviceSetIndex; } - - static MsgDeviceSetFocus* create(int deviceSetIndex) - { - return new MsgDeviceSetFocus(deviceSetIndex); - } - - private: - int m_deviceSetIndex; - - MsgDeviceSetFocus(int deviceSetIndex) : - Message(), - m_deviceSetIndex(deviceSetIndex) - { } - }; - class MsgApplySettings : public Message { MESSAGE_CLASS_DECLARATION