diff --git a/plugins/samplemimo/metismiso/metismiso.cpp b/plugins/samplemimo/metismiso/metismiso.cpp index 796f39217..f5fb4739c 100644 --- a/plugins/samplemimo/metismiso/metismiso.cpp +++ b/plugins/samplemimo/metismiso/metismiso.cpp @@ -305,6 +305,7 @@ bool MetisMISO::applySettings(const MetisMISOSettings& settings, bool force) << " m_duplex:" << settings.m_duplex << " m_dcBlock:" << settings.m_dcBlock << " m_iqCorrection:" << settings.m_iqCorrection + << " m_txDrive:" << settings.m_txDrive << " m_useReverseAPI: " << settings.m_useReverseAPI << " m_reverseAPIAddress: " << settings.m_reverseAPIAddress << " m_reverseAPIPort: " << settings.m_reverseAPIPort @@ -398,6 +399,12 @@ bool MetisMISO::applySettings(const MetisMISOSettings& settings, bool force) reverseAPIKeys.append("iqCorrection"); } + if ((m_settings.m_txDrive != settings.m_txDrive) || force) + { + reverseAPIKeys.append("txDrive"); + propagateSettings = true; + } + if ((m_settings.m_dcBlock != settings.m_dcBlock) || (m_settings.m_iqCorrection != settings.m_iqCorrection) || force) { @@ -661,6 +668,9 @@ void MetisMISO::webapiUpdateDeviceSettings( if (deviceSettingsKeys.contains("iqCorrection")) { settings.m_iqCorrection = response.getMetisMisoSettings()->getIqCorrection() != 0; } + if (deviceSettingsKeys.contains("txDrive")) { + settings.m_txDrive = response.getMetisMisoSettings()->getTxDrive(); + } if (deviceSettingsKeys.contains("useReverseAPI")) { settings.m_useReverseAPI = response.getMetisMisoSettings()->getUseReverseApi() != 0; } @@ -696,6 +706,7 @@ void MetisMISO::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& respo response.getMetisMisoSettings()->setDuplex(settings.m_duplex ? 1 : 0); response.getMetisMisoSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0); response.getMetisMisoSettings()->setIqCorrection(settings.m_iqCorrection ? 1 : 0); + response.getMetisMisoSettings()->setTxDrive(settings.m_txDrive); response.getMetisMisoSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); if (response.getMetisMisoSettings()->getReverseApiAddress()) { @@ -774,6 +785,9 @@ void MetisMISO::webapiReverseSendSettings(const QList& deviceSettingsKe if (deviceSettingsKeys.contains("iqCorrection") || force) { swgMetisMISOSettings->setIqCorrection(settings.m_iqCorrection ? 1 : 0); } + if (deviceSettingsKeys.contains("txDrive") || force) { + swgMetisMISOSettings->setTxDrive(settings.m_txDrive); + } QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings") .arg(settings.m_reverseAPIAddress) diff --git a/plugins/samplemimo/metismiso/metismisogui.cpp b/plugins/samplemimo/metismiso/metismisogui.cpp index 41747fe78..8b9ad0657 100644 --- a/plugins/samplemimo/metismiso/metismisogui.cpp +++ b/plugins/samplemimo/metismiso/metismisogui.cpp @@ -339,6 +339,13 @@ void MetisMISOGui::on_txEnable_toggled(bool checked) sendSettings(); } +void MetisMISOGui::on_txDrive_valueChanged(int value) +{ + m_settings.m_txDrive = value; + ui->txDriveText->setText(tr("%1").arg(m_settings.m_txDrive)); + sendSettings(); +} + void MetisMISOGui::displaySettings() { blockApplySettings(true); @@ -356,6 +363,8 @@ void MetisMISOGui::displaySettings() ui->duplex->setChecked(m_settings.m_duplex); ui->nbRxIndex->setCurrentIndex(m_settings.m_nbReceivers - 1); ui->txEnable->setChecked(m_settings.m_txEnable); + ui->txDrive->setValue(m_settings.m_txDrive); + ui->txDriveText->setText(tr("%1").arg(m_settings.m_txDrive)); displayFrequency(); displaySampleRate(); updateSpectrum(); diff --git a/plugins/samplemimo/metismiso/metismisogui.h b/plugins/samplemimo/metismiso/metismisogui.h index 389b26a4f..6489e1a26 100644 --- a/plugins/samplemimo/metismiso/metismisogui.h +++ b/plugins/samplemimo/metismiso/metismisogui.h @@ -96,6 +96,7 @@ private slots: void on_duplex_toggled(bool checked); void on_nbRxIndex_currentIndexChanged(int index); void on_txEnable_toggled(bool checked); + void on_txDrive_valueChanged(int value); void openDeviceSettingsDialog(const QPoint& p); void updateStatus(); void updateHardware(); diff --git a/plugins/samplemimo/metismiso/metismisogui.ui b/plugins/samplemimo/metismiso/metismisogui.ui index 46767c2f4..4a44f3ed4 100644 --- a/plugins/samplemimo/metismiso/metismisogui.ui +++ b/plugins/samplemimo/metismiso/metismisogui.ui @@ -7,7 +7,7 @@ 0 0 483 - 200 + 228 @@ -626,6 +626,62 @@ + + + + + + Tx Drv + + + + + + + + 24 + 24 + + + + Tx drive level (0: off) + + + 15 + + + 1 + + + 15 + + + + + + + 00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/plugins/samplemimo/metismiso/metismisosettings.cpp b/plugins/samplemimo/metismiso/metismisosettings.cpp index 396d2a19e..c0f383d67 100644 --- a/plugins/samplemimo/metismiso/metismisosettings.cpp +++ b/plugins/samplemimo/metismiso/metismisosettings.cpp @@ -45,6 +45,7 @@ MetisMISOSettings::MetisMISOSettings(const MetisMISOSettings& other) m_duplex = other.m_duplex; m_dcBlock = other.m_dcBlock; m_iqCorrection = other.m_iqCorrection; + m_txDrive = other.m_txDrive; m_useReverseAPI = other.m_useReverseAPI; m_reverseAPIAddress = other.m_reverseAPIAddress; m_reverseAPIPort = other.m_reverseAPIPort; @@ -72,6 +73,7 @@ void MetisMISOSettings::resetToDefaults() m_duplex = false; m_dcBlock = false; m_iqCorrection = false; + m_txDrive = 15; m_useReverseAPI = false; m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIPort = 8888; @@ -101,10 +103,11 @@ QByteArray MetisMISOSettings::serialize() const s.writeBool(17, m_duplex); s.writeBool(18, m_dcBlock); s.writeBool(19, m_iqCorrection); - s.writeBool(20, m_useReverseAPI); - s.writeString(21, m_reverseAPIAddress); - s.writeU32(22, m_reverseAPIPort); - s.writeU32(23, m_reverseAPIDeviceIndex); + s.writeU32(20, m_txDrive); + s.writeBool(21, m_useReverseAPI); + s.writeString(22, m_reverseAPIAddress); + s.writeU32(23, m_reverseAPIPort); + s.writeU32(24, m_reverseAPIDeviceIndex); return s.final(); } @@ -143,6 +146,7 @@ bool MetisMISOSettings::deserialize(const QByteArray& data) d.readBool(17, &m_duplex, false); d.readBool(18, &m_dcBlock, false); d.readBool(19, &m_iqCorrection, false); + d.readU32(20, &m_txDrive, 15); d.readBool(20, &m_useReverseAPI, false); d.readString(21, &m_reverseAPIAddress, "127.0.0.1"); d.readU32(22, &utmp, 0); diff --git a/plugins/samplemimo/metismiso/metismisosettings.h b/plugins/samplemimo/metismiso/metismisosettings.h index 0fc513e13..6195423fd 100644 --- a/plugins/samplemimo/metismiso/metismisosettings.h +++ b/plugins/samplemimo/metismiso/metismisosettings.h @@ -40,6 +40,7 @@ struct MetisMISOSettings { bool m_duplex; bool m_dcBlock; bool m_iqCorrection; + unsigned int m_txDrive; bool m_useReverseAPI; QString m_reverseAPIAddress; uint16_t m_reverseAPIPort; diff --git a/plugins/samplemimo/metismiso/metismisoudphandler.cpp b/plugins/samplemimo/metismiso/metismisoudphandler.cpp index 90f68cb13..491c4a310 100644 --- a/plugins/samplemimo/metismiso/metismisoudphandler.cpp +++ b/plugins/samplemimo/metismiso/metismisoudphandler.cpp @@ -432,6 +432,11 @@ int MetisMISOUDPHandler::getCommandValue(int commandIndex) { return m_settings.m_rx7CenterFrequency; } + else if (commandIndex == 18) + { + c1 = (m_settings.m_txDrive & 0x0F) << 4; + return (c1<<24) + (c3<<8) + c4; + } else if (commandIndex == 36) { return m_settings.m_rx8CenterFrequency; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index b5948d6f8..2f1499049 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -5507,7 +5507,7 @@ margin-bottom: 20px; }, "txEnable" : { "type" : "integer", - "description" : "Enable Tx * 0 - disabled sends null payload to Metis device * 1 - enabled sends Tx payload to Metis device\n" + "description" : "Enable Tx * 0 - disabled sends null payload to Metis device * 1 - enabled sends Tx payload to Metis device\n" }, "rx1CenterFrequency" : { "type" : "integer", @@ -5575,6 +5575,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "DC block in software * 0 - disabled * 1 - enabled\n" }, + "txDrive" : { + "type" : "integer", + "description" : "Tx drive level (0 to 15)" + }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API * 0 - disabled * 1 - enabled\n" @@ -37554,7 +37558,7 @@ except ApiException as e:
- Generated 2020-09-05T23:57:54.369+02:00 + Generated 2020-09-07T01:54:18.483+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/MetisMISO.yaml b/sdrbase/resources/webapi/doc/swagger/include/MetisMISO.yaml index fd0cc6d7d..192df2bde 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/MetisMISO.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/MetisMISO.yaml @@ -7,7 +7,7 @@ MetisMISOSettings: txEnable: type: integer description: > - Enable Tx + Enable Tx * 0 - disabled sends null payload to Metis device * 1 - enabled sends Tx payload to Metis device rx1CenterFrequency: @@ -77,6 +77,9 @@ MetisMISOSettings: DC block in software * 0 - disabled * 1 - enabled + txDrive: + type: integer + description: Tx drive level (0 to 15) useReverseAPI: type: integer description: > diff --git a/swagger/sdrangel/api/swagger/include/MetisMISO.yaml b/swagger/sdrangel/api/swagger/include/MetisMISO.yaml index fd0cc6d7d..192df2bde 100644 --- a/swagger/sdrangel/api/swagger/include/MetisMISO.yaml +++ b/swagger/sdrangel/api/swagger/include/MetisMISO.yaml @@ -7,7 +7,7 @@ MetisMISOSettings: txEnable: type: integer description: > - Enable Tx + Enable Tx * 0 - disabled sends null payload to Metis device * 1 - enabled sends Tx payload to Metis device rx1CenterFrequency: @@ -77,6 +77,9 @@ MetisMISOSettings: DC block in software * 0 - disabled * 1 - enabled + txDrive: + type: integer + description: Tx drive level (0 to 15) useReverseAPI: type: integer description: > diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index b5948d6f8..2f1499049 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -5507,7 +5507,7 @@ margin-bottom: 20px; }, "txEnable" : { "type" : "integer", - "description" : "Enable Tx * 0 - disabled sends null payload to Metis device * 1 - enabled sends Tx payload to Metis device\n" + "description" : "Enable Tx * 0 - disabled sends null payload to Metis device * 1 - enabled sends Tx payload to Metis device\n" }, "rx1CenterFrequency" : { "type" : "integer", @@ -5575,6 +5575,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "DC block in software * 0 - disabled * 1 - enabled\n" }, + "txDrive" : { + "type" : "integer", + "description" : "Tx drive level (0 to 15)" + }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API * 0 - disabled * 1 - enabled\n" @@ -37554,7 +37558,7 @@ except ApiException as e:
- Generated 2020-09-05T23:57:54.369+02:00 + Generated 2020-09-07T01:54:18.483+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.cpp index 958fd8c43..408ae6bca 100644 --- a/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.cpp @@ -66,6 +66,8 @@ SWGMetisMISOSettings::SWGMetisMISOSettings() { m_dc_block_isSet = false; iq_correction = 0; m_iq_correction_isSet = false; + tx_drive = 0; + m_tx_drive_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = nullptr; @@ -120,6 +122,8 @@ SWGMetisMISOSettings::init() { m_dc_block_isSet = false; iq_correction = 0; m_iq_correction_isSet = false; + tx_drive = 0; + m_tx_drive_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = new QString(""); @@ -151,6 +155,7 @@ SWGMetisMISOSettings::cleanup() { + if(reverse_api_address != nullptr) { delete reverse_api_address; @@ -208,6 +213,8 @@ SWGMetisMISOSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", ""); + ::SWGSDRangel::setValue(&tx_drive, pJson["txDrive"], "qint32", ""); + ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", ""); ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString"); @@ -289,6 +296,9 @@ SWGMetisMISOSettings::asJsonObject() { if(m_iq_correction_isSet){ obj->insert("iqCorrection", QJsonValue(iq_correction)); } + if(m_tx_drive_isSet){ + obj->insert("txDrive", QJsonValue(tx_drive)); + } if(m_use_reverse_api_isSet){ obj->insert("useReverseAPI", QJsonValue(use_reverse_api)); } @@ -495,6 +505,16 @@ SWGMetisMISOSettings::setIqCorrection(qint32 iq_correction) { this->m_iq_correction_isSet = true; } +qint32 +SWGMetisMISOSettings::getTxDrive() { + return tx_drive; +} +void +SWGMetisMISOSettings::setTxDrive(qint32 tx_drive) { + this->tx_drive = tx_drive; + this->m_tx_drive_isSet = true; +} + qint32 SWGMetisMISOSettings::getUseReverseApi() { return use_reverse_api; @@ -597,6 +617,9 @@ SWGMetisMISOSettings::isSet(){ if(m_iq_correction_isSet){ isObjectUpdated = true; break; } + if(m_tx_drive_isSet){ + isObjectUpdated = true; break; + } if(m_use_reverse_api_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.h b/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.h index 3dc3efc1c..a388b798f 100644 --- a/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGMetisMISOSettings.h @@ -99,6 +99,9 @@ public: qint32 getIqCorrection(); void setIqCorrection(qint32 iq_correction); + qint32 getTxDrive(); + void setTxDrive(qint32 tx_drive); + qint32 getUseReverseApi(); void setUseReverseApi(qint32 use_reverse_api); @@ -172,6 +175,9 @@ private: qint32 iq_correction; bool m_iq_correction_isSet; + qint32 tx_drive; + bool m_tx_drive_isSet; + qint32 use_reverse_api; bool m_use_reverse_api_isSet;