mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
PlutoSDR output: Make settings assignments atomic. Part of #1329
This commit is contained in:
parent
3449293b6a
commit
79b174bf36
@ -94,7 +94,7 @@ void PlutoSDROutput::destroy()
|
||||
|
||||
void PlutoSDROutput::init()
|
||||
{
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
}
|
||||
|
||||
bool PlutoSDROutput::start()
|
||||
@ -114,7 +114,7 @@ bool PlutoSDROutput::start()
|
||||
m_plutoSDROutputThread = new PlutoSDROutputThread(PLUTOSDR_BLOCKSIZE_SAMPLES, m_deviceShared.m_deviceParams->getBox(), &m_sampleSourceFifo);
|
||||
qDebug("PlutoSDROutput::start: thread created");
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
|
||||
m_plutoSDROutputThread->setLog2Interpolation(m_settings.m_log2Interp);
|
||||
m_plutoSDROutputThread->startWork();
|
||||
@ -153,12 +153,12 @@ bool PlutoSDROutput::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigurePlutoSDR* message = MsgConfigurePlutoSDR::create(m_settings, true);
|
||||
MsgConfigurePlutoSDR* message = MsgConfigurePlutoSDR::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigurePlutoSDR* messageToGUI = MsgConfigurePlutoSDR::create(m_settings, true);
|
||||
MsgConfigurePlutoSDR* messageToGUI = MsgConfigurePlutoSDR::create(m_settings, QList<QString>(), true);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
|
||||
@ -184,12 +184,12 @@ void PlutoSDROutput::setCenterFrequency(qint64 centerFrequency)
|
||||
PlutoSDROutputSettings settings = m_settings;
|
||||
settings.m_centerFrequency = centerFrequency;
|
||||
|
||||
MsgConfigurePlutoSDR* message = MsgConfigurePlutoSDR::create(settings, false);
|
||||
MsgConfigurePlutoSDR* message = MsgConfigurePlutoSDR::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue)
|
||||
{
|
||||
MsgConfigurePlutoSDR* messageToGUI = MsgConfigurePlutoSDR::create(settings, false);
|
||||
MsgConfigurePlutoSDR* messageToGUI = MsgConfigurePlutoSDR::create(settings, QList<QString>{"centerFrequency"}, false);
|
||||
m_guiMessageQueue->push(messageToGUI);
|
||||
}
|
||||
}
|
||||
@ -201,8 +201,7 @@ bool PlutoSDROutput::handleMessage(const Message& message)
|
||||
MsgConfigurePlutoSDR& conf = (MsgConfigurePlutoSDR&) message;
|
||||
qDebug() << "PlutoSDROutput::handleMessage: MsgConfigurePlutoSDR";
|
||||
|
||||
if (!applySettings(conf.getSettings(), conf.getForce()))
|
||||
{
|
||||
if (!applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce())) {
|
||||
qDebug("PlutoSDROutput::handleMessage config error");
|
||||
}
|
||||
|
||||
@ -217,7 +216,8 @@ bool PlutoSDROutput::handleMessage(const Message& message)
|
||||
m_settings.m_LOppmTenths = conf.getLoPPMTenths();
|
||||
PlutoSDROutputSettings newSettings = m_settings;
|
||||
newSettings.m_lpfFIREnable = conf.isLpfFirEnable();
|
||||
applySettings(newSettings);
|
||||
|
||||
applySettings(newSettings, QList<QString>{"lpfFIREnable"});
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -228,8 +228,7 @@ bool PlutoSDROutput::handleMessage(const Message& message)
|
||||
|
||||
if (cmd.getStartStop())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine())
|
||||
{
|
||||
if (m_deviceAPI->initDeviceEngine()) {
|
||||
m_deviceAPI->startDeviceEngine();
|
||||
}
|
||||
}
|
||||
@ -379,7 +378,7 @@ void PlutoSDROutput::resumeBuddies()
|
||||
}
|
||||
}
|
||||
|
||||
bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool force)
|
||||
bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
if (!m_open)
|
||||
{
|
||||
@ -387,47 +386,14 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
return false;
|
||||
}
|
||||
|
||||
qDebug().noquote() << "PlutoSDROutput::applySettings: force:" << force << settings.getDebugString(settingsKeys, force);
|
||||
|
||||
bool forwardChangeOwnDSP = false;
|
||||
bool forwardChangeOtherDSP = false;
|
||||
bool ownThreadWasRunning = false;
|
||||
bool suspendAllOtherThreads = false; // All others means Rx in fact
|
||||
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
||||
QLocale loc;
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
qDebug().noquote() << "PlutoSDROutput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
|
||||
<< " m_devSampleRate: " << loc.toString(m_settings.m_devSampleRate) << "S/s"
|
||||
<< " m_LOppmTenths: " << m_settings.m_LOppmTenths
|
||||
<< " m_lpfFIREnable: " << m_settings.m_lpfFIREnable
|
||||
<< " m_lpfFIRBW: " << loc.toString(m_settings.m_lpfFIRBW)
|
||||
<< " m_lpfFIRlog2Interp: " << m_settings.m_lpfFIRlog2Interp
|
||||
<< " m_lpfFIRGain: " << m_settings.m_lpfFIRGain
|
||||
<< " m_log2Interp: " << loc.toString(1<<m_settings.m_log2Interp)
|
||||
<< " m_lpfBW: " << loc.toString(m_settings.m_lpfBW)
|
||||
<< " m_att: " << m_settings.m_att
|
||||
<< " m_antennaPath: " << (int) m_settings.m_antennaPath
|
||||
<< " m_transverterMode: " << m_settings.m_transverterMode
|
||||
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
|
||||
<< " force: " << force;
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) {
|
||||
reverseAPIKeys.append("devSampleRate");
|
||||
}
|
||||
if ((m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || force) {
|
||||
reverseAPIKeys.append("lpfFIREnable");
|
||||
}
|
||||
if ((m_settings.m_lpfFIRlog2Interp != settings.m_lpfFIRlog2Interp) || force) {
|
||||
reverseAPIKeys.append("lpfFIRlog2Interp");
|
||||
}
|
||||
if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) || force) {
|
||||
reverseAPIKeys.append("lpfFIRBW");
|
||||
}
|
||||
if ((m_settings.m_lpfFIRGain != settings.m_lpfFIRGain) || force) {
|
||||
reverseAPIKeys.append("lpfFIRGain");
|
||||
}
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
|
||||
reverseAPIKeys.append("LOppmTenths");
|
||||
}
|
||||
|
||||
// determine if buddies threads or own thread need to be suspended
|
||||
|
||||
@ -436,12 +402,12 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
// - FIR filter is enabled or disabled
|
||||
// - FIR filter is changed
|
||||
// - LO correction is changed
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) ||
|
||||
(m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) ||
|
||||
(m_settings.m_lpfFIRlog2Interp != settings.m_lpfFIRlog2Interp) ||
|
||||
(settings.m_lpfFIRBW != m_settings.m_lpfFIRBW) ||
|
||||
(settings.m_lpfFIRGain != m_settings.m_lpfFIRGain) ||
|
||||
(m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
||||
if (settingsKeys.contains("devSampleRate") ||
|
||||
settingsKeys.contains("lpfFIREnable") ||
|
||||
settingsKeys.contains("lpfFIRlog2Interp") ||
|
||||
settingsKeys.contains("lpfFIRBW") ||
|
||||
settingsKeys.contains("lpfFIRGain") ||
|
||||
settingsKeys.contains("LOppmTenths") || force)
|
||||
{
|
||||
suspendAllOtherThreads = true;
|
||||
}
|
||||
@ -475,11 +441,11 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
// apply settings
|
||||
|
||||
// Change affecting device sample rate chain and other buddies
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) ||
|
||||
(m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) ||
|
||||
(m_settings.m_lpfFIRlog2Interp != settings.m_lpfFIRlog2Interp) ||
|
||||
(settings.m_lpfFIRBW != m_settings.m_lpfFIRBW) ||
|
||||
(settings.m_lpfFIRGain != m_settings.m_lpfFIRGain) || force)
|
||||
if (settingsKeys.contains("devSampleRate") ||
|
||||
settingsKeys.contains("lpfFIREnable") ||
|
||||
settingsKeys.contains("lpfFIRlog2Interp") ||
|
||||
settingsKeys.contains("lpfFIRBW") ||
|
||||
settingsKeys.contains("lpfFIRGain") || force)
|
||||
{
|
||||
plutoBox->setFIR(settings.m_devSampleRate, settings.m_lpfFIRlog2Interp, DevicePlutoSDRBox::USE_TX, settings.m_lpfFIRBW, settings.m_lpfFIRGain);
|
||||
plutoBox->setFIREnable(settings.m_lpfFIREnable); // eventually enable/disable FIR
|
||||
@ -497,7 +463,8 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
forwardChangeOwnDSP = (m_settings.m_devSampleRate != settings.m_devSampleRate) || force;
|
||||
}
|
||||
|
||||
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force)
|
||||
if (settingsKeys.contains("devSampleRate") ||
|
||||
settingsKeys.contains("log2Interp") || force)
|
||||
{
|
||||
unsigned int fifoRate = std::max(
|
||||
(unsigned int) settings.m_devSampleRate / (1<<settings.m_log2Interp),
|
||||
@ -505,10 +472,8 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(fifoRate));
|
||||
}
|
||||
|
||||
if ((m_settings.m_log2Interp != settings.m_log2Interp) || force)
|
||||
if (settingsKeys.contains("log2Interp") || force)
|
||||
{
|
||||
reverseAPIKeys.append("log2Interp");
|
||||
|
||||
if (m_plutoSDROutputThread != 0)
|
||||
{
|
||||
m_plutoSDROutputThread->setLog2Interpolation(settings.m_log2Interp);
|
||||
@ -518,7 +483,7 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
forwardChangeOwnDSP = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
|
||||
if (settingsKeys.contains("LOppmTenths") || force)
|
||||
{
|
||||
plutoBox->setLOPPMTenths(settings.m_LOppmTenths);
|
||||
forwardChangeOtherDSP = true;
|
||||
@ -527,20 +492,9 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
std::vector<std::string> params;
|
||||
bool paramsToSet = false;
|
||||
|
||||
if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
|
||||
reverseAPIKeys.append("centerFrequency");
|
||||
}
|
||||
if ((m_settings.m_transverterMode != settings.m_transverterMode) || force) {
|
||||
reverseAPIKeys.append("transverterMode");
|
||||
}
|
||||
if ((m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force) {
|
||||
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||
}
|
||||
|
||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
|
||||
|
||||
if (force || settingsKeys.contains("centerFrequency")
|
||||
|| settingsKeys.contains("transverterMode")
|
||||
|| settingsKeys.contains("transverterDeltaFrequency"))
|
||||
{
|
||||
qint64 deviceCenterFrequency = settings.m_centerFrequency;
|
||||
deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
|
||||
@ -556,45 +510,45 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
|
||||
|
||||
}
|
||||
|
||||
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
|
||||
if (settingsKeys.contains("lpfBW") || force)
|
||||
{
|
||||
reverseAPIKeys.append("lpfBW");
|
||||
params.push_back(QString(tr("out_voltage_rf_bandwidth=%1").arg(settings.m_lpfBW)).toStdString());
|
||||
paramsToSet = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
|
||||
if (settingsKeys.contains("antennaPath") || force)
|
||||
{
|
||||
reverseAPIKeys.append("antennaPath");
|
||||
QString rfPortStr;
|
||||
PlutoSDROutputSettings::translateRFPath(settings.m_antennaPath, rfPortStr);
|
||||
params.push_back(QString(tr("out_voltage0_rf_port_select=%1").arg(rfPortStr)).toStdString());
|
||||
paramsToSet = true;
|
||||
}
|
||||
|
||||
if ((m_settings.m_att != settings.m_att) || force)
|
||||
if (settingsKeys.contains("att") || force)
|
||||
{
|
||||
reverseAPIKeys.append("att");
|
||||
float attF = settings.m_att * 0.25f;
|
||||
params.push_back(QString(tr("out_voltage0_hardwaregain=%1").arg(attF)).toStdString());
|
||||
paramsToSet = true;
|
||||
}
|
||||
|
||||
if (paramsToSet)
|
||||
{
|
||||
if (paramsToSet) {
|
||||
plutoBox->set_params(DevicePlutoSDRBox::DEVICE_PHY, params);
|
||||
}
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
if (settingsKeys.contains("useReverseAPI"))
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) ||
|
||||
settingsKeys.contains("reverseAPIAddress") ||
|
||||
settingsKeys.contains("reverseAPIPort") ||
|
||||
settingsKeys.contains("reverseAPIDeviceIndex");
|
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
if (suspendAllOtherThreads)
|
||||
{
|
||||
@ -774,12 +728,12 @@ int PlutoSDROutput::webapiSettingsPutPatch(
|
||||
PlutoSDROutputSettings settings = m_settings;
|
||||
webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response);
|
||||
|
||||
MsgConfigurePlutoSDR *msg = MsgConfigurePlutoSDR::create(settings, force);
|
||||
MsgConfigurePlutoSDR *msg = MsgConfigurePlutoSDR::create(settings, deviceSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigurePlutoSDR *msgToGUI = MsgConfigurePlutoSDR::create(settings, force);
|
||||
MsgConfigurePlutoSDR *msgToGUI = MsgConfigurePlutoSDR::create(settings, deviceSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@ -895,7 +849,7 @@ void PlutoSDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
|
||||
response.getPlutoSdrOutputReport()->setTemperature(getTemperature());
|
||||
}
|
||||
|
||||
void PlutoSDROutput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PlutoSDROutputSettings& settings, bool force)
|
||||
void PlutoSDROutput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const PlutoSDROutputSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||
swgDeviceSettings->setDirection(1); // single Tx
|
||||
|
@ -41,20 +41,22 @@ public:
|
||||
|
||||
public:
|
||||
const PlutoSDROutputSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigurePlutoSDR* create(const PlutoSDROutputSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigurePlutoSDR(settings, force);
|
||||
static MsgConfigurePlutoSDR* create(const PlutoSDROutputSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigurePlutoSDR(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
PlutoSDROutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigurePlutoSDR(const PlutoSDROutputSettings& settings, bool force) :
|
||||
MsgConfigurePlutoSDR(const PlutoSDROutputSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@ -156,9 +158,9 @@ public:
|
||||
void closeDevice();
|
||||
void suspendBuddies();
|
||||
void resumeBuddies();
|
||||
bool applySettings(const PlutoSDROutputSettings& settings, bool force = false);
|
||||
bool applySettings(const PlutoSDROutputSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PlutoSDROutputSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const PlutoSDROutputSettings& settings, bool force);
|
||||
void webapiReverseSendStartStop(bool start);
|
||||
|
||||
private slots:
|
||||
|
@ -98,7 +98,9 @@ void PlutoSDROutputGUI::destroy()
|
||||
|
||||
void PlutoSDROutputGUI::resetToDefaults()
|
||||
{
|
||||
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
sendSettings(true);
|
||||
}
|
||||
|
||||
QByteArray PlutoSDROutputGUI::serialize() const
|
||||
@ -135,7 +137,13 @@ bool PlutoSDROutputGUI::handleMessage(const Message& message)
|
||||
if (PlutoSDROutput::MsgConfigurePlutoSDR::match(message))
|
||||
{
|
||||
const PlutoSDROutput::MsgConfigurePlutoSDR& cfg = (PlutoSDROutput::MsgConfigurePlutoSDR&) message;
|
||||
|
||||
if (cfg.getForce()) {
|
||||
m_settings = cfg.getSettings();
|
||||
} else {
|
||||
m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings());
|
||||
}
|
||||
|
||||
blockApplySettings(true);
|
||||
displaySettings();
|
||||
blockApplySettings(false);
|
||||
@ -181,6 +189,7 @@ void PlutoSDROutputGUI::on_startStop_toggled(bool checked)
|
||||
void PlutoSDROutputGUI::on_centerFrequency_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_centerFrequency = value * 1000;
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -188,6 +197,7 @@ void PlutoSDROutputGUI::on_loPPM_valueChanged(int value)
|
||||
{
|
||||
ui->loPPMText->setText(QString("%1").arg(QString::number(value/10.0, 'f', 1)));
|
||||
m_settings.m_LOppmTenths = value;
|
||||
m_settingsKeys.append("LOppmTenths");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -201,6 +211,8 @@ void PlutoSDROutputGUI::on_swInterp_currentIndexChanged(int index)
|
||||
m_settings.m_devSampleRate <<= m_settings.m_log2Interp;
|
||||
}
|
||||
|
||||
m_settingsKeys.append("log2Interp");
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -212,12 +224,14 @@ void PlutoSDROutputGUI::on_sampleRate_changed(quint64 value)
|
||||
m_settings.m_devSampleRate <<= m_settings.m_log2Interp;
|
||||
}
|
||||
|
||||
m_settingsKeys.append("devSampleRate");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void PlutoSDROutputGUI::on_lpf_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_lpfBW = value * 1000;
|
||||
m_settingsKeys.append("lpfBW");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -226,18 +240,21 @@ void PlutoSDROutputGUI::on_lpFIREnable_toggled(bool checked)
|
||||
m_settings.m_lpfFIREnable = checked;
|
||||
ui->lpFIRInterpolation->setEnabled(checked);
|
||||
ui->lpFIRGain->setEnabled(checked);
|
||||
m_settingsKeys.append("lpfFIREnable");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void PlutoSDROutputGUI::on_lpFIR_changed(quint64 value)
|
||||
{
|
||||
m_settings.m_lpfFIRBW = value * 1000;
|
||||
m_settingsKeys.append("lpfFIRBW");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void PlutoSDROutputGUI::on_lpFIRInterpolation_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_lpfFIRlog2Interp = index > 2 ? 2 : index;
|
||||
m_settingsKeys.append("lpfFIRlog2Interp");
|
||||
setSampleRateLimits();
|
||||
sendSettings();
|
||||
}
|
||||
@ -245,6 +262,7 @@ void PlutoSDROutputGUI::on_lpFIRInterpolation_currentIndexChanged(int index)
|
||||
void PlutoSDROutputGUI::on_lpFIRGain_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_lpfFIRGain = 6*(index > 1 ? 1 : index) - 6;
|
||||
m_settingsKeys.append("lpfFIRGain");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -252,12 +270,14 @@ void PlutoSDROutputGUI::on_att_valueChanged(int value)
|
||||
{
|
||||
ui->attText->setText(QString("%1 dB").arg(QString::number(value*0.25, 'f', 2)));
|
||||
m_settings.m_att = value;
|
||||
m_settingsKeys.append("att");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void PlutoSDROutputGUI::on_antenna_currentIndexChanged(int index)
|
||||
{
|
||||
m_settings.m_antennaPath = (PlutoSDROutputSettings::RFPath) (index < PlutoSDROutputSettings::RFPATH_END ? index : 0);
|
||||
m_settingsKeys.append("antennaPath");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -268,6 +288,9 @@ void PlutoSDROutputGUI::on_transverter_clicked()
|
||||
qDebug("PlutoSDROutputGUI::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||
updateFrequencyLimits();
|
||||
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
|
||||
m_settingsKeys.append("transverterMode");
|
||||
m_settingsKeys.append("transverterDeltaFrequency");
|
||||
m_settingsKeys.append("centerFrequency");
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
@ -340,7 +363,10 @@ void PlutoSDROutputGUI::displaySettings()
|
||||
void PlutoSDROutputGUI::sendSettings(bool forceSettings)
|
||||
{
|
||||
m_forceSettings = forceSettings;
|
||||
if(!m_updateTimer.isActive()) { m_updateTimer.start(100); }
|
||||
|
||||
if (!m_updateTimer.isActive()) {
|
||||
m_updateTimer.start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void PlutoSDROutputGUI::updateHardware()
|
||||
@ -348,9 +374,10 @@ void PlutoSDROutputGUI::updateHardware()
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
qDebug() << "PlutoSDROutputGUI::updateHardware";
|
||||
PlutoSDROutput::MsgConfigurePlutoSDR* message = PlutoSDROutput::MsgConfigurePlutoSDR::create(m_settings, m_forceSettings);
|
||||
PlutoSDROutput::MsgConfigurePlutoSDR* message = PlutoSDROutput::MsgConfigurePlutoSDR::create(m_settings, m_settingsKeys, m_forceSettings);
|
||||
m_sampleSink->getInputMessageQueue()->push(message);
|
||||
m_forceSettings = false;
|
||||
m_settingsKeys.clear();
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
@ -511,6 +538,10 @@ void PlutoSDROutputGUI::openDeviceSettingsDialog(const QPoint& p)
|
||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
|
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
|
||||
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
|
||||
m_settingsKeys.append("useReverseAPI");
|
||||
m_settingsKeys.append("reverseAPIAddress");
|
||||
m_settingsKeys.append("reverseAPIPort");
|
||||
m_settingsKeys.append("reverseAPIDeviceIndex");
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ protected:
|
||||
private:
|
||||
Ui::PlutoSDROutputGUI* ui;
|
||||
PlutoSDROutputSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode
|
||||
bool m_forceSettings;
|
||||
QTimer m_updateTimer;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>197</height>
|
||||
<height>246</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,13 +19,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>197</height>
|
||||
<height>240</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>250</height>
|
||||
<height>246</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
|
@ -129,6 +129,120 @@ bool PlutoSDROutputSettings::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
void PlutoSDROutputSettings::applySettings(const QStringList& settingsKeys, const PlutoSDROutputSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("centerFrequency")) {
|
||||
m_centerFrequency = settings.m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths")) {
|
||||
m_LOppmTenths = settings.m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("log2Interp")) {
|
||||
m_log2Interp = settings.m_log2Interp;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate")) {
|
||||
m_devSampleRate = settings.m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("lpfBW")) {
|
||||
m_lpfBW = settings.m_lpfBW;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIREnable")) {
|
||||
m_lpfFIREnable = settings.m_lpfFIREnable;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRBW")) {
|
||||
m_lpfFIRBW = settings.m_lpfFIRBW;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRlog2Interp")) {
|
||||
m_lpfFIRlog2Interp = settings.m_lpfFIRlog2Interp;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRGain")) {
|
||||
m_lpfFIRGain = settings.m_lpfFIRGain;
|
||||
}
|
||||
if (settingsKeys.contains("att")) {
|
||||
m_att = settings.m_att;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath")) {
|
||||
m_antennaPath = settings.m_antennaPath;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode")) {
|
||||
m_transverterMode = settings.m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency")) {
|
||||
m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI")) {
|
||||
m_useReverseAPI = settings.m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress")) {
|
||||
m_reverseAPIAddress = settings.m_reverseAPIAddress;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort")) {
|
||||
m_reverseAPIPort = settings.m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
QString PlutoSDROutputSettings::getDebugString(const QStringList& settingsKeys, bool force) const
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
||||
if (settingsKeys.contains("centerFrequency") || force) {
|
||||
ostr << " m_centerFrequency: " << m_centerFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("LOppmTenths") || force) {
|
||||
ostr << " m_LOppmTenths: " << m_LOppmTenths;
|
||||
}
|
||||
if (settingsKeys.contains("log2Interp") || force) {
|
||||
ostr << " m_log2Interp: " << m_log2Interp;
|
||||
}
|
||||
if (settingsKeys.contains("devSampleRate") || force) {
|
||||
ostr << " m_devSampleRate: " << m_devSampleRate;
|
||||
}
|
||||
if (settingsKeys.contains("lpfBW") || force) {
|
||||
ostr << " m_lpfBW: " << m_lpfBW;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIREnable") || force) {
|
||||
ostr << " m_lpfFIREnable: " << m_lpfFIREnable;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRBW") || force) {
|
||||
ostr << " m_lpfFIRBW: " << m_lpfFIRBW;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRlog2Interp") || force) {
|
||||
ostr << " m_lpfFIRlog2Interp: " << m_lpfFIRlog2Interp;
|
||||
}
|
||||
if (settingsKeys.contains("lpfFIRGain") || force) {
|
||||
ostr << " m_lpfFIRGain: " << m_lpfFIRGain;
|
||||
}
|
||||
if (settingsKeys.contains("att") || force) {
|
||||
ostr << " m_att: " << m_att;
|
||||
}
|
||||
if (settingsKeys.contains("antennaPath") || force) {
|
||||
ostr << " m_antennaPath: " << m_antennaPath;
|
||||
}
|
||||
if (settingsKeys.contains("transverterMode") || force) {
|
||||
ostr << " m_transverterMode: " << m_transverterMode;
|
||||
}
|
||||
if (settingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||
ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI") || force) {
|
||||
ostr << " m_useReverseAPI: " << m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress") || force) {
|
||||
ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString();
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort") || force) {
|
||||
ostr << " m_reverseAPIPort: " << m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex") || force) {
|
||||
ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex;
|
||||
}
|
||||
|
||||
return QString(ostr.str().c_str());
|
||||
}
|
||||
|
||||
void PlutoSDROutputSettings::translateRFPath(RFPath path, QString& s)
|
||||
{
|
||||
switch(path)
|
||||
|
@ -56,6 +56,8 @@ struct PlutoSDROutputSettings {
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const PlutoSDROutputSettings& settings);
|
||||
QString getDebugString(const QStringList& settingsKeys, bool force=false) const;
|
||||
static void translateRFPath(RFPath path, QString& s);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user