From 7d615572045201256b28569445adecea2dadaac6 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 17 Apr 2017 10:05:05 +0200 Subject: [PATCH] LimeSDR support: ready --- .../limesdrinput/limesdrinput.cpp | 10 ++- .../samplesource/limesdrinput/limesdrinput.h | 9 +-- .../limesdrinput/limesdrinputgui.cpp | 62 ++++++++++++++----- 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/plugins/samplesource/limesdrinput/limesdrinput.cpp b/plugins/samplesource/limesdrinput/limesdrinput.cpp index f479afd1e..326a497cc 100644 --- a/plugins/samplesource/limesdrinput/limesdrinput.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinput.cpp @@ -243,6 +243,12 @@ int LimeSDRInput::getLPIndex(float lpfBW) const return (int) ((lpfBW - range.min) / range.step); } +float LimeSDRInput::getLPValue(int index) const +{ + lms_range_t range = m_deviceShared.m_deviceParams->m_lpfRangeRx; + return range.min + index * range.step; +} + uint32_t LimeSDRInput::getHWLog2Decim() const { return m_deviceShared.m_deviceParams->m_log2OvSRRx; @@ -262,9 +268,9 @@ bool LimeSDRInput::handleMessage(const Message& message) return true; } - else if (MsgSetReferenceLimeSDR::match(message)) + else if (MsgSetReferenceConfig::match(message)) { - MsgSetReferenceLimeSDR& conf = (MsgSetReferenceLimeSDR&) message; + MsgSetReferenceConfig& conf = (MsgSetReferenceConfig&) message; qDebug() << "LimeSDRInput::handleMessage: MsgSetReferenceLimeSDR"; m_settings = conf.getSettings(); return true; diff --git a/plugins/samplesource/limesdrinput/limesdrinput.h b/plugins/samplesource/limesdrinput/limesdrinput.h index e60d2194b..0e720ee9b 100644 --- a/plugins/samplesource/limesdrinput/limesdrinput.h +++ b/plugins/samplesource/limesdrinput/limesdrinput.h @@ -51,21 +51,21 @@ public: { } }; - class MsgSetReferenceLimeSDR : public Message { + class MsgSetReferenceConfig : public Message { MESSAGE_CLASS_DECLARATION public: const LimeSDRInputSettings& getSettings() const { return m_settings; } - static MsgSetReferenceLimeSDR* create(const LimeSDRInputSettings& settings) + static MsgSetReferenceConfig* create(const LimeSDRInputSettings& settings) { - return new MsgSetReferenceLimeSDR(settings); + return new MsgSetReferenceConfig(settings); } private: LimeSDRInputSettings m_settings; - MsgSetReferenceLimeSDR(const LimeSDRInputSettings& settings) : + MsgSetReferenceConfig(const LimeSDRInputSettings& settings) : Message(), m_settings(settings) { } @@ -114,6 +114,7 @@ public: void getSRRange(float& minF, float& maxF, float& stepF) const; void getLPRange(float& minF, float& maxF, float& stepF) const; int getLPIndex(float lpfBW) const; + float getLPValue(int index) const; uint32_t getHWLog2Decim() const; private: diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp index 9d10ac7f2..a4617a6f4 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp @@ -174,7 +174,7 @@ void LimeSDRInputGUI::handleMessagesToGUI() displaySettings(); blockApplySettings(false); - LimeSDRInput::MsgSetReferenceLimeSDR* message = LimeSDRInput::MsgSetReferenceLimeSDR::create(m_settings); + LimeSDRInput::MsgSetReferenceConfig* message = LimeSDRInput::MsgSetReferenceConfig::create(m_settings); m_sampleSource->getInputMessageQueue()->push(message); delete message; @@ -263,60 +263,94 @@ void LimeSDRInputGUI::blockApplySettings(bool block) void LimeSDRInputGUI::on_startStop_toggled(bool checked) { - + if (checked) + { + if (m_deviceAPI->initAcquisition()) + { + m_deviceAPI->startAcquisition(); + DSPEngine::instance()->startAudioOutput(); + } + } + else + { + m_deviceAPI->stopAcquisition(); + DSPEngine::instance()->stopAudioOutput(); + } } void LimeSDRInputGUI::on_record_toggled(bool checked) { - + if (checked) + { + ui->record->setStyleSheet("QToolButton { background-color : red; }"); + m_fileSink->startRecording(); + } + else + { + ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); + m_fileSink->stopRecording(); + } } void LimeSDRInputGUI::on_centerFrequency_changed(quint64 value) { - + m_settings.m_centerFrequency = value * 1000; + sendSettings(); } void LimeSDRInputGUI::on_dcOffset_toggled(bool checked) { - + m_settings.m_dcBlock = checked; + sendSettings(); } void LimeSDRInputGUI::on_iqImbalance_toggled(bool checked) { - + m_settings.m_iqCorrection = checked; + sendSettings(); } void LimeSDRInputGUI::on_sampleRate_changed(quint64 value) { - -} + m_settings.m_devSampleRate = value; + sendSettings();} void LimeSDRInputGUI::on_hwDecim_currentIndexChanged(int index) { - + if ((index <0) || (index > 5)) + return; + m_settings.m_log2HardDecim = index; + sendSettings(); } void LimeSDRInputGUI::on_swDecim_currentIndexChanged(int index) { - + if ((index <0) || (index > 5)) + return; + m_settings.m_log2SoftDecim = index; + sendSettings(); } void LimeSDRInputGUI::on_lpf_valueChanged(int value) { - + m_settings.m_lpfBW = m_limeSDRInput->getLPValue(value); + sendSettings(); } void LimeSDRInputGUI::on_lpFIREnable_toggled(bool checked) { - + m_settings.m_lpfFIREnable = checked; + sendSettings(); } void LimeSDRInputGUI::on_lpFIR_changed(quint64 value) { - + m_settings.m_lpfFIRBW = value; + sendSettings(); } void LimeSDRInputGUI::on_gain_valueChanged(int value) { - + m_settings.m_gain = value; + sendSettings(); }