From a6782a27802e2c4d7131bb1f6d4d8e94279f6a62 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 25 Aug 2016 01:06:42 +0200 Subject: [PATCH] DSD demod plugin: added button to toggle between transition constellation and symbol synchronization displays --- plugins/channel/demoddsd/dsddemod.cpp | 23 ++++++++++--- plugins/channel/demoddsd/dsddemod.h | 29 ++++++++++++---- plugins/channel/demoddsd/dsddemodgui.cpp | 15 ++++++-- plugins/channel/demoddsd/dsddemodgui.h | 2 ++ plugins/channel/demoddsd/dsddemodgui.ui | 42 +++++++++++------------ sdrbase/resources/constellation.png | Bin 0 -> 838 bytes sdrbase/resources/res.qrc | 1 + 7 files changed, 77 insertions(+), 35 deletions(-) create mode 100644 sdrbase/resources/constellation.png diff --git a/plugins/channel/demoddsd/dsddemod.cpp b/plugins/channel/demoddsd/dsddemod.cpp index 3d1182980..a7edeb696 100644 --- a/plugins/channel/demoddsd/dsddemod.cpp +++ b/plugins/channel/demoddsd/dsddemod.cpp @@ -84,7 +84,8 @@ void DSDDemod::configure(MessageQueue* messageQueue, int squelchGate, Real squelch, bool audioMute, - bool enableCosineFiltering) + bool enableCosineFiltering, + bool syncOrConstellation) { Message* cmd = MsgConfigureDSDDemod::create(rfBandwidth, demodGain, @@ -94,7 +95,8 @@ void DSDDemod::configure(MessageQueue* messageQueue, squelchGate, squelch, audioMute, - enableCosineFiltering); + enableCosineFiltering, + syncOrConstellation); messageQueue->push(cmd); } @@ -175,8 +177,16 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto delayedSample = m_sampleBuffer[m_sampleBufferIndex - samplesPerSymbol]; } - Sample s(sample, delayedSample); // I=signal, Q=signal delayed by 20 samples (2400 baud: lowest rate) - m_scopeSampleBuffer.push_back(s); + if (m_running.m_syncOrConstellation) + { + Sample s(sample, m_dsdDecoder.getSymbolSyncSample()); + m_scopeSampleBuffer.push_back(s); + } + else + { + Sample s(sample, delayedSample); // I=signal, Q=signal delayed by 20 samples (2400 baud: lowest rate) + m_scopeSampleBuffer.push_back(s); + } if (DSPEngine::instance()->hasDVSerialSupport() && m_dsdDecoder.mbeDVReady()) { @@ -255,6 +265,7 @@ bool DSDDemod::handleMessage(const Message& cmd) m_config.m_squelch = cfg.getSquelch(); m_config.m_audioMute = cfg.getAudioMute(); m_config.m_enableCosineFiltering = cfg.getEnableCosineFiltering(); + m_config.m_syncOrConstellation = cfg.getSyncOrConstellation(); apply(); @@ -266,7 +277,8 @@ bool DSDDemod::handleMessage(const Message& cmd) << " m_squelchGate" << m_config.m_squelchGate << " m_squelch: " << m_config.m_squelch << " m_audioMute: " << m_config.m_audioMute - << " m_enableCosineFiltering: " << m_config.m_enableCosineFiltering; + << " m_enableCosineFiltering: " << m_config.m_enableCosineFiltering + << " m_syncOrConstellation: " << m_config.m_syncOrConstellation; return true; } @@ -340,4 +352,5 @@ void DSDDemod::apply() m_running.m_audioSampleRate = m_config.m_audioSampleRate; m_running.m_audioMute = m_config.m_audioMute; m_running.m_enableCosineFiltering = m_config.m_enableCosineFiltering; + m_running.m_syncOrConstellation = m_config.m_syncOrConstellation; } diff --git a/plugins/channel/demoddsd/dsddemod.h b/plugins/channel/demoddsd/dsddemod.h index a43e294c5..3894d8812 100644 --- a/plugins/channel/demoddsd/dsddemod.h +++ b/plugins/channel/demoddsd/dsddemod.h @@ -49,7 +49,8 @@ public: int squelchGate, Real squelch, bool audioMute, - bool enableCosineFiltering); + bool enableCosineFiltering, + bool syncOrConstellation); virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); virtual void start(); @@ -79,6 +80,7 @@ private: Real getSquelch() const { return m_squelch; } bool getAudioMute() const { return m_audioMute; } bool getEnableCosineFiltering() const { return m_enableCosineFiltering; } + bool getSyncOrConstellation() const { return m_syncOrConstellation; } static MsgConfigureDSDDemod* create(int rfBandwidth, int demodGain, @@ -88,9 +90,19 @@ private: int squelchGate, Real squelch, bool audioMute, - bool enableCosineFiltering) + bool enableCosineFiltering, + bool syncOrConstellation) { - return new MsgConfigureDSDDemod(rfBandwidth, demodGain, fmDeviation, volume, baudRate, squelchGate, squelch, audioMute, enableCosineFiltering); + return new MsgConfigureDSDDemod(rfBandwidth, + demodGain, + fmDeviation, + volume, + baudRate, + squelchGate, + squelch, + audioMute, + enableCosineFiltering, + syncOrConstellation); } private: @@ -103,6 +115,7 @@ private: Real m_squelch; bool m_audioMute; bool m_enableCosineFiltering; + bool m_syncOrConstellation; MsgConfigureDSDDemod(int rfBandwidth, int demodGain, @@ -112,7 +125,8 @@ private: int squelchGate, Real squelch, bool audioMute, - bool enableCosineFiltering) : + bool enableCosineFiltering, + bool syncOrConstellation) : Message(), m_rfBandwidth(rfBandwidth), m_demodGain(demodGain), @@ -122,7 +136,8 @@ private: m_squelchGate(squelchGate), m_squelch(squelch), m_audioMute(audioMute), - m_enableCosineFiltering(enableCosineFiltering) + m_enableCosineFiltering(enableCosineFiltering), + m_syncOrConstellation(syncOrConstellation) { } }; @@ -150,6 +165,7 @@ private: bool m_audioMute; quint32 m_audioSampleRate; bool m_enableCosineFiltering; + bool m_syncOrConstellation; Config() : m_inputSampleRate(-1), @@ -163,7 +179,8 @@ private: m_squelch(0), m_audioMute(false), m_audioSampleRate(0), - m_enableCosineFiltering(false) + m_enableCosineFiltering(false), + m_syncOrConstellation(false) { } }; diff --git a/plugins/channel/demoddsd/dsddemodgui.cpp b/plugins/channel/demoddsd/dsddemodgui.cpp index 014850035..d16373d48 100644 --- a/plugins/channel/demoddsd/dsddemodgui.cpp +++ b/plugins/channel/demoddsd/dsddemodgui.cpp @@ -115,6 +115,7 @@ QByteArray DSDDemodGUI::serialize() const s.writeBlob(10, ui->scopeGUI->serialize()); s.writeS32(11, ui->baudRate->currentIndex()); s.writeBool(12, m_enableCosineFiltering); + s.writeBool(13, m_syncOrConstellation); return s.final(); } @@ -163,6 +164,7 @@ bool DSDDemodGUI::deserialize(const QByteArray& data) d.readS32(11, &tmp, 20); ui->baudRate->setCurrentIndex(tmp); d.readBool(12, &m_enableCosineFiltering, false); + d.readBool(13, &m_syncOrConstellation, false); blockApplySettings(false); m_channelMarker.blockSignals(false); @@ -243,6 +245,12 @@ void DSDDemodGUI::on_enableCosineFiltering_toggled(bool enable) applySettings(); } +void DSDDemodGUI::on_syncOrConstellation_toggled(bool checked) +{ + m_syncOrConstellation = checked; + applySettings(); +} + void DSDDemodGUI::on_squelchGate_valueChanged(int value) { applySettings(); @@ -288,6 +296,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa m_doApplySettings(true), m_signalFormat(signalFormatNone), m_enableCosineFiltering(false), + m_syncOrConstellation(false), m_squelchOpen(false), m_channelPowerDbAvg(20,0), m_tickCount(0) @@ -363,8 +372,7 @@ void DSDDemodGUI::applySettings() ui->squelchGateText->setText(QString("%1").arg(ui->squelchGate->value() * 10.0, 0, 'f', 0)); ui->volumeText->setText(QString("%1").arg(ui->volume->value() / 10.0, 0, 'f', 1)); ui->enableCosineFiltering->setChecked(m_enableCosineFiltering); - - // TODO: pass m_enableCosineFiltering + ui->syncOrConstellation->setChecked(m_syncOrConstellation); m_dsdDemod->configure(m_dsdDemod->getInputMessageQueue(), ui->rfBW->value(), @@ -375,7 +383,8 @@ void DSDDemodGUI::applySettings() ui->squelchGate->value(), // in 10ths of ms ui->squelch->value(), ui->audioMute->isChecked(), - m_enableCosineFiltering); + m_enableCosineFiltering, + m_syncOrConstellation); } } diff --git a/plugins/channel/demoddsd/dsddemodgui.h b/plugins/channel/demoddsd/dsddemodgui.h index f0973f892..361a5e208 100644 --- a/plugins/channel/demoddsd/dsddemodgui.h +++ b/plugins/channel/demoddsd/dsddemodgui.h @@ -66,6 +66,7 @@ private slots: void on_volume_valueChanged(int value); void on_baudRate_currentIndexChanged(int index); void on_enableCosineFiltering_toggled(bool enable); + void on_syncOrConstellation_toggled(bool checked); void on_fmDeviation_valueChanged(int value); void on_squelchGate_valueChanged(int value); void on_squelch_valueChanged(int value); @@ -98,6 +99,7 @@ private: DSDDemod* m_dsdDemod; bool m_enableCosineFiltering; + bool m_syncOrConstellation; bool m_audioMute; bool m_squelchOpen; MovingAverage m_channelPowerDbAvg; diff --git a/plugins/channel/demoddsd/dsddemodgui.ui b/plugins/channel/demoddsd/dsddemodgui.ui index 2e5b975f0..2bf19a498 100644 --- a/plugins/channel/demoddsd/dsddemodgui.ui +++ b/plugins/channel/demoddsd/dsddemodgui.ui @@ -59,16 +59,7 @@ 3 - - 2 - - - 2 - - - 2 - - + 2 @@ -210,7 +201,7 @@ - Symbol synchronization quality (%) + Symbol synchronization rate (%) 00 @@ -253,6 +244,24 @@ + + + + Toggle between transition constellation and symbol synchronization displays + + + + + + + :/constellation.png + :/slopep_icon.png:/constellation.png + + + true + + + @@ -775,16 +784,7 @@ Discriminator Scope - - 2 - - - 2 - - - 2 - - + 2 diff --git a/sdrbase/resources/constellation.png b/sdrbase/resources/constellation.png new file mode 100644 index 0000000000000000000000000000000000000000..b18300f37a201334e2170ba90c1b13fee72c2bb5 GIT binary patch literal 838 zcmV-M1G)T(P)pAjJRx0@F!E zK~zY`jh4ZyRaF#+zjfce@5NJ6)6fSsb5af@L_~3*19K3BMTiak7i<&}h$!`(G-whD zArI$4YBp-11U1Q=G-wtj3ZjT*Veg*%IdJXE>Tn;=1BZLh?|ggjbJqH;wNI!Ez?f%8 z00MJ)-K9qAqr#f^Ccv=APx5yGwM{lX)PWi^^dU2jM`}Sx}&bLpoV(MXUDD7=hV&Ws`^+xlI()|VX{9Kc8B_B@}H#s z!Vnlogz7iI8^9O2_9P-6Cj2V!3$U6`dK0(}TrKQf^(SB-@N?>8)cJnA)nPtWU!QNW zPIHiNKi6`pZZ7)#undm164+v2wTO69#zdPV-#RKh%SDlAU!TRU>!NmXO8rgU9}xmX z1nQUS*XmMXm((ljN<>r_Evxs`cM=`6cyCazrZYY&-hNU2SN%&psE$%UnA)nksf9%S zA?G;Taz;to9`&TUt>z@{c}!hwg_i%{Rgd=A*VPm1_Gw|(xVD(L9L&&1eQg$B^ikxX zNpVA0ddsBOcZR81oFy@3uK~w_tr4-B1=s<*fW0}%IPWb2Zvnfqt#lDF z26h7P0o!wIM<#BAdN~txt|WP@dOObp$IMwgY|#{s6A`LU|+SxHZ++D3B=57^+*=DYVM}uK**h*Y(ELq>;^VkQ-4~l3X7y z@(sbL2Dm9mK}rS^~dW^30u(IfRqI;}16UGf)Op|uU?KlK9e0QkIYB6rl&z((L^ zvTeip6nGdB_e&Ko19yOn&+Vf1+Vy&TsPk)lwnVS=Nqt-#)LKjbGpF&xr};cU(ud>L QJ^%m!07*qoM6N<$f}~uIW&i*H literal 0 HcmV?d00001 diff --git a/sdrbase/resources/res.qrc b/sdrbase/resources/res.qrc index 7a23b04d3..96a4350c3 100644 --- a/sdrbase/resources/res.qrc +++ b/sdrbase/resources/res.qrc @@ -57,5 +57,6 @@ rds.png recycle.png lsb.png + constellation.png