From a4ea78f03755b732d4b3586b1b38ba05ff2b3686 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 14 Oct 2017 09:35:39 +0200 Subject: [PATCH] FCD Pro: force settings at startup and on deserialize --- fcdlib/fcdtraits.cpp | 4 ++-- plugins/samplesource/fcdpro/fcdprogui.cpp | 5 ++++- plugins/samplesource/fcdpro/fcdprogui.h | 1 + plugins/samplesource/fcdpro/fcdproinput.cpp | 2 +- plugins/samplesource/fcdpro/fcdproinput.h | 11 +++++++---- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fcdlib/fcdtraits.cpp b/fcdlib/fcdtraits.cpp index 980f9400d..99f97baed 100644 --- a/fcdlib/fcdtraits.cpp +++ b/fcdlib/fcdtraits.cpp @@ -22,8 +22,8 @@ const char *fcd_traits::displayedName = "FunCube Dongle Pro+"; const char *fcd_traits::pluginDisplayedName = "FunCube Pro Input"; const char *fcd_traits::pluginDisplayedName = "FunCube Pro+ Input"; -const char *fcd_traits::pluginVersion = "3.7.3"; -const char *fcd_traits::pluginVersion = "3.7.3"; +const char *fcd_traits::pluginVersion = "3.7.4"; +const char *fcd_traits::pluginVersion = "3.7.4"; const int64_t fcd_traits::loLowLimitFreq = 64000000L; const int64_t fcd_traits::loLowLimitFreq = 150000L; diff --git a/plugins/samplesource/fcdpro/fcdprogui.cpp b/plugins/samplesource/fcdpro/fcdprogui.cpp index e07dd8304..6a65feb94 100644 --- a/plugins/samplesource/fcdpro/fcdprogui.cpp +++ b/plugins/samplesource/fcdpro/fcdprogui.cpp @@ -31,6 +31,7 @@ FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) : QWidget(parent), ui(new Ui::FCDProGui), m_deviceAPI(deviceAPI), + m_forceSettings(true), m_settings(), m_sampleSource(NULL), m_lastEngineState((DSPDeviceSourceEngine::State)-1) @@ -195,6 +196,7 @@ bool FCDProGui::deserialize(const QByteArray& data) if(m_settings.deserialize(data)) { displaySettings(); + m_forceSettings = true; sendSettings(); return true; } @@ -500,8 +502,9 @@ void FCDProGui::updateStatus() void FCDProGui::updateHardware() { - FCDProInput::MsgConfigureFCD* message = FCDProInput::MsgConfigureFCD::create(m_settings); + FCDProInput::MsgConfigureFCD* message = FCDProInput::MsgConfigureFCD::create(m_settings, m_forceSettings); m_sampleSource->getInputMessageQueue()->push(message); + m_forceSettings = false; m_updateTimer.stop(); } diff --git a/plugins/samplesource/fcdpro/fcdprogui.h b/plugins/samplesource/fcdpro/fcdprogui.h index d9c1a1742..792f7c827 100644 --- a/plugins/samplesource/fcdpro/fcdprogui.h +++ b/plugins/samplesource/fcdpro/fcdprogui.h @@ -55,6 +55,7 @@ private: Ui::FCDProGui* ui; DeviceSourceAPI* m_deviceAPI; + bool m_forceSettings; FCDProSettings m_settings; QTimer m_updateTimer; QTimer m_statusTimer; diff --git a/plugins/samplesource/fcdpro/fcdproinput.cpp b/plugins/samplesource/fcdpro/fcdproinput.cpp index 764ce22e7..5665b721f 100644 --- a/plugins/samplesource/fcdpro/fcdproinput.cpp +++ b/plugins/samplesource/fcdpro/fcdproinput.cpp @@ -175,7 +175,7 @@ bool FCDProInput::handleMessage(const Message& message) { qDebug() << "FCDProInput::handleMessage: MsgConfigureFCD"; MsgConfigureFCD& conf = (MsgConfigureFCD&) message; - applySettings(conf.getSettings(), false); + applySettings(conf.getSettings(), conf.getForce()); return true; } else if (MsgFileRecord::match(message)) diff --git a/plugins/samplesource/fcdpro/fcdproinput.h b/plugins/samplesource/fcdpro/fcdproinput.h index 7c757f894..c325c3b61 100644 --- a/plugins/samplesource/fcdpro/fcdproinput.h +++ b/plugins/samplesource/fcdpro/fcdproinput.h @@ -41,18 +41,21 @@ public: public: const FCDProSettings& getSettings() const { return m_settings; } + bool getForce() const { return m_force; } - static MsgConfigureFCD* create(const FCDProSettings& settings) + static MsgConfigureFCD* create(const FCDProSettings& settings, bool force) { - return new MsgConfigureFCD(settings); + return new MsgConfigureFCD(settings, force); } private: FCDProSettings m_settings; + bool m_force; - MsgConfigureFCD(const FCDProSettings& settings) : + MsgConfigureFCD(const FCDProSettings& settings, bool force) : Message(), - m_settings(settings) + m_settings(settings), + m_force(force) { } };