1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-01-29 22:42:24 -05:00

Metis MISO: added Tx drive control

This commit is contained in:
f4exb 2020-09-07 02:18:58 +02:00
parent 25ff9acb8e
commit 08b86062aa
13 changed files with 144 additions and 11 deletions

View File

@ -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<QString>& 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)

View File

@ -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();

View File

@ -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();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>483</width>
<height>200</height>
<height>228</height>
</rect>
</property>
<property name="sizePolicy">
@ -626,6 +626,62 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="miscControlsLayout">
<item>
<widget class="QLabel" name="txDriveLabel">
<property name="text">
<string>Tx Drv</string>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="txDrive">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Tx drive level (0: off)</string>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>15</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="txDriveText">
<property name="text">
<string>00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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:
</div>
<div id="generator">
<div class="content">
Generated 2020-09-05T23:57:54.369+02:00
Generated 2020-09-07T01:54:18.483+02:00
</div>
</div>
</div>

View File

@ -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: >

View File

@ -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: >

View File

@ -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:
</div>
<div id="generator">
<div class="content">
Generated 2020-09-05T23:57:54.369+02:00
Generated 2020-09-07T01:54:18.483+02:00
</div>
</div>
</div>

View File

@ -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;
}

View File

@ -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;