From b4a77e08c8907137941e4b54b89d2783c3a8e845 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 21 Apr 2018 17:22:07 +0200 Subject: [PATCH] DSD demod: symmetrical attack and decay for squelch like NFM --- plugins/channelrx/demoddsd/dsddemod.cpp | 38 +++++++++++++------ plugins/channelrx/demoddsd/dsddemodplugin.cpp | 2 +- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/plugins/channelrx/demoddsd/dsddemod.cpp b/plugins/channelrx/demoddsd/dsddemod.cpp index 1dde3f556..481716fb2 100644 --- a/plugins/channelrx/demoddsd/dsddemod.cpp +++ b/plugins/channelrx/demoddsd/dsddemod.cpp @@ -144,15 +144,15 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto if (m_movingAverage.asDouble() > m_squelchLevel) { - m_squelchDelayLine.write(demod); - if (m_squelchGate > 0) { - if (m_squelchCount < m_squelchGate) { + + if (m_squelchCount < m_squelchGate*2) { m_squelchCount++; } - m_squelchOpen = m_squelchCount == m_squelchGate; + m_squelchDelayLine.write(demod); + m_squelchOpen = m_squelchCount > m_squelchGate; } else { @@ -161,17 +161,33 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto } else { - m_squelchDelayLine.write(0); - m_squelchCount = 0; - m_squelchOpen = false; + if (m_squelchGate > 0) + { + if (m_squelchCount > 0) { + m_squelchCount--; + } + + m_squelchDelayLine.write(0); + m_squelchOpen = m_squelchCount > m_squelchGate; + } + else + { + m_squelchOpen = false; + } } if (m_squelchOpen) { - sampleDSD = m_squelchDelayLine.readBack(m_squelchGate) * 32768.0f; // DSD decoder takes int16 samples - sample = m_squelchDelayLine.readBack(m_squelchGate) * SDR_RX_SCALEF; // scale to sample size -// sampleDSD = demod * 32768.0f; // DSD decoder takes int16 samples -// sample = demod * SDR_RX_SCALEF; // scale to sample size + if (m_squelchGate > 0) + { + sampleDSD = m_squelchDelayLine.readBack(m_squelchGate) * 32768.0f; // DSD decoder takes int16 samples + sample = m_squelchDelayLine.readBack(m_squelchGate) * SDR_RX_SCALEF; // scale to sample size + } + else + { + sampleDSD = demod * 32768.0f; // DSD decoder takes int16 samples + sample = demod * SDR_RX_SCALEF; // scale to sample size + } } else { diff --git a/plugins/channelrx/demoddsd/dsddemodplugin.cpp b/plugins/channelrx/demoddsd/dsddemodplugin.cpp index beff73f71..c4b190b5e 100644 --- a/plugins/channelrx/demoddsd/dsddemodplugin.cpp +++ b/plugins/channelrx/demoddsd/dsddemodplugin.cpp @@ -25,7 +25,7 @@ const PluginDescriptor DSDDemodPlugin::m_pluginDescriptor = { QString("DSD Demodulator"), - QString("3.14.1"), + QString("3.14.4"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true,