From 7430dee09acdc5f53f88ba388b1d0e8ae3c3c3d5 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 13 May 2017 16:01:41 +0200 Subject: [PATCH] AF squelch --- sdrbase/dsp/afsquelch.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sdrbase/dsp/afsquelch.cpp b/sdrbase/dsp/afsquelch.cpp index 441b95b77..9fa0c7fcc 100644 --- a/sdrbase/dsp/afsquelch.cpp +++ b/sdrbase/dsp/afsquelch.cpp @@ -117,7 +117,7 @@ void AFSquelch::setCoefficients(int N, unsigned int nbAvg, int _samplerate, int // for each of the frequencies (tones) of interest calculate // k and the associated filter coefficient as per the Goertzel - // algorithm. Note: we are using a real value (as apposed to + // algorithm. Note: we are using a real value (as opposed to // an integer as described in some references. k is retained // for later display. The tone set is specified in the // constructor. Notice that the resulting coefficients are @@ -182,7 +182,8 @@ void AFSquelch::feedForward() { m_power[j] = (m_u0[j] * m_u0[j]) + (m_u1[j] * m_u1[j]) - (m_coef[j] * m_u0[j] * m_u1[j]); m_movingAverages[j].feed(m_power[j]); - m_u0[j] = m_u1[j] = 0.0; // reset for next block. + m_u0[j] = 0.0; + m_u1[j] = 0.0; // reset for next block. } evaluate(); @@ -229,7 +230,7 @@ bool AFSquelch::evaluate() } // principle is to open if power is uneven because noise gives even power - bool open = maxPower == 0.0 ? true : (minPower/maxPower < m_threshold) && (minIndex > maxIndex); + bool open = maxPower > 0.0 ? (minPower/maxPower < m_threshold) && (minIndex > maxIndex) : true; //qDebug("AFSquelch::evaluate: %g : %g", minPower/maxPower, m_threshold); if (open)