diff --git a/plugins/channelrx/demodnfm/nfmdemod.cpp b/plugins/channelrx/demodnfm/nfmdemod.cpp index 24d4aecfa..d35f41ac8 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.cpp +++ b/plugins/channelrx/demodnfm/nfmdemod.cpp @@ -75,7 +75,7 @@ NFMDemod::NFMDemod() : m_movingAverage.resize(32, 0); m_ctcssDetector.setCoefficients(3000, 6000.0); // 0.5s / 2 Hz resolution - m_afSquelch.setCoefficients(24, 60, 48000.0, 20, 0); // 0.5ms test period, 30ms average span, 48kS/s SR, 10ms attack, no decay + m_afSquelch.setCoefficients(24, 600, 48000.0, 200, 0); // 0.5ms test period, 300ms average span, 48kS/s SR, 100ms attack, no decay DSPEngine::instance()->addAudioSink(&m_audioFifo); } @@ -445,6 +445,7 @@ void NFMDemod::apply(bool force) { // input is a value in negative millis m_squelchLevel = (- m_config.m_squelch) / 1000.0; m_afSquelch.setThreshold(m_squelchLevel); + m_afSquelch.reset(); } else { // input is a value in centi-Bels diff --git a/sdrbase/dsp/afsquelch.cpp b/sdrbase/dsp/afsquelch.cpp index 44844bc30..fa0a8599e 100644 --- a/sdrbase/dsp/afsquelch.cpp +++ b/sdrbase/dsp/afsquelch.cpp @@ -51,6 +51,7 @@ AFSquelch::AFSquelch() : m_u0[j] = 0.0; m_u1[j] = 0.0; m_power[j] = 0.0; + m_movingAverages[j].fill(0.0); } } @@ -86,6 +87,7 @@ AFSquelch::AFSquelch(unsigned int nbTones, const double *tones) : m_u0[j] = 0.0; m_u1[j] = 0.0; m_power[j] = 0.0; + m_movingAverages[j].fill(0.0); } } @@ -137,6 +139,7 @@ void AFSquelch::setCoefficients( m_u0[j] = 0.0; m_u1[j] = 0.0; m_power[j] = 0.0; + m_movingAverages[j].fill(0.0); } }