From c8bd0e8e85b8d30aee3b594849667865356bb1ce Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 30 May 2017 20:31:15 +0200 Subject: [PATCH] AF squelch: try to fix max = 0 state --- sdrbase/dsp/afsquelch.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sdrbase/dsp/afsquelch.cpp b/sdrbase/dsp/afsquelch.cpp index ac600af30..cc61e43c8 100644 --- a/sdrbase/dsp/afsquelch.cpp +++ b/sdrbase/dsp/afsquelch.cpp @@ -224,6 +224,11 @@ bool AFSquelch::evaluate() } } + if (maxPower == 0.0) + { + return m_isOpen; + } + minPower = maxPower; for (unsigned int j = 0; j < m_nTones; ++j) @@ -234,11 +239,7 @@ bool AFSquelch::evaluate() } } - // principle is to open if power is uneven because noise gives even power - bool open = maxPower > 0.0 ? (minPower/maxPower < m_threshold) && (minIndex > maxIndex) : true; - //qDebug("AFSquelch::evaluate: %g : %g", minPower/maxPower, m_threshold); - - if (open) + if ((minPower/maxPower < m_threshold) && (minIndex > maxIndex)) // open condition { if ((m_samplesAttack > 0) && (m_attackCount < m_samplesAttack)) {