diff --git a/plugins/samplesource/bladerfinput/bladerfinputgui.cpp b/plugins/samplesource/bladerfinput/bladerfinputgui.cpp index 13b8b5b5c..d7236cb36 100644 --- a/plugins/samplesource/bladerfinput/bladerfinputgui.cpp +++ b/plugins/samplesource/bladerfinput/bladerfinputgui.cpp @@ -34,6 +34,7 @@ BladerfInputGui::BladerfInputGui(DeviceUISet *deviceUISet, QWidget* parent) : ui(new Ui::BladerfInputGui), m_deviceUISet(deviceUISet), m_forceSettings(true), + m_doApplySettings(true), m_settings(), m_sampleSource(NULL), m_sampleRate(0), @@ -158,7 +159,9 @@ void BladerfInputGui::updateSampleRateAndFrequency() void BladerfInputGui::displaySettings() { - ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); + blockApplySettings(true); + + ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->sampleRate->setValue(m_settings.m_devSampleRate); ui->dcOffset->setChecked(m_settings.m_dcBlock); @@ -180,6 +183,8 @@ void BladerfInputGui::displaySettings() ui->vga2->setValue(m_settings.m_vga2); ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter)); + + blockApplySettings(false); } void BladerfInputGui::sendSettings() @@ -363,11 +368,19 @@ void BladerfInputGui::on_record_toggled(bool checked) void BladerfInputGui::updateHardware() { - qDebug() << "BladerfGui::updateHardware"; - BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create(m_settings, m_forceSettings); - m_sampleSource->getInputMessageQueue()->push(message); - m_forceSettings = false; - m_updateTimer.stop(); + if (m_doApplySettings) + { + qDebug() << "BladerfGui::updateHardware"; + BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create(m_settings, m_forceSettings); + m_sampleSource->getInputMessageQueue()->push(message); + m_forceSettings = false; + m_updateTimer.stop(); + } +} + +void BladerfInputGui::blockApplySettings(bool block) +{ + m_doApplySettings = !block; } void BladerfInputGui::updateStatus() diff --git a/plugins/samplesource/bladerfinput/bladerfinputgui.h b/plugins/samplesource/bladerfinput/bladerfinputgui.h index 094cda356..cc7ca4da4 100644 --- a/plugins/samplesource/bladerfinput/bladerfinputgui.h +++ b/plugins/samplesource/bladerfinput/bladerfinputgui.h @@ -55,6 +55,7 @@ private: DeviceUISet* m_deviceUISet; bool m_forceSettings; + bool m_doApplySettings; BladeRFInputSettings m_settings; QTimer m_updateTimer; QTimer m_statusTimer; @@ -69,6 +70,7 @@ private: void sendSettings(); unsigned int getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter); void updateSampleRateAndFrequency(); + void blockApplySettings(bool block); private slots: void handleInputMessages(); diff --git a/plugins/samplesource/hackrfinput/hackrfinputgui.cpp b/plugins/samplesource/hackrfinput/hackrfinputgui.cpp index d790eb4bd..fc1a89b34 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputgui.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinputgui.cpp @@ -38,6 +38,7 @@ HackRFInputGui::HackRFInputGui(DeviceUISet *deviceUISet, QWidget* parent) : m_deviceUISet(deviceUISet), m_settings(), m_forceSettings(true), + m_doApplySettings(true), m_sampleSource(NULL), m_lastEngineState((DSPDeviceSourceEngine::State)-1) { @@ -172,6 +173,8 @@ void HackRFInputGui::updateSampleRateAndFrequency() void HackRFInputGui::displaySettings() { + blockApplySettings(true); + ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->LOppm->setValue(m_settings.m_LOppmTenths); @@ -197,6 +200,8 @@ void HackRFInputGui::displaySettings() ui->vgaText->setText(tr("%1dB").arg(m_settings.m_vgaGain)); ui->vga->setValue(m_settings.m_vgaGain); + + blockApplySettings(false); } void HackRFInputGui::displayBandwidths() @@ -364,11 +369,19 @@ void HackRFInputGui::on_record_toggled(bool checked) void HackRFInputGui::updateHardware() { - qDebug() << "HackRFGui::updateHardware"; - HackRFInput::MsgConfigureHackRF* message = HackRFInput::MsgConfigureHackRF::create(m_settings, m_forceSettings); - m_sampleSource->getInputMessageQueue()->push(message); - m_forceSettings = false; - m_updateTimer.stop(); + if (m_doApplySettings) + { + qDebug() << "HackRFGui::updateHardware"; + HackRFInput::MsgConfigureHackRF* message = HackRFInput::MsgConfigureHackRF::create(m_settings, m_forceSettings); + m_sampleSource->getInputMessageQueue()->push(message); + m_forceSettings = false; + m_updateTimer.stop(); + } +} + +void HackRFInputGui::blockApplySettings(bool block) +{ + m_doApplySettings = !block; } void HackRFInputGui::updateStatus() diff --git a/plugins/samplesource/hackrfinput/hackrfinputgui.h b/plugins/samplesource/hackrfinput/hackrfinputgui.h index 5a47a2fa0..0f714af56 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputgui.h +++ b/plugins/samplesource/hackrfinput/hackrfinputgui.h @@ -66,6 +66,7 @@ private: DeviceUISet* m_deviceUISet; HackRFInputSettings m_settings; bool m_forceSettings; + bool m_doApplySettings; QTimer m_updateTimer; QTimer m_statusTimer; DeviceSampleSource* m_sampleSource; @@ -78,6 +79,7 @@ private: void displayBandwidths(); void sendSettings(); void updateSampleRateAndFrequency(); + void blockApplySettings(bool block); private slots: void handleInputMessages();