1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

AF squelch: try to fix max = 0 state

This commit is contained in:
f4exb 2017-05-30 20:31:15 +02:00
parent a217312032
commit c8bd0e8e85

View File

@ -224,6 +224,11 @@ bool AFSquelch::evaluate()
} }
} }
if (maxPower == 0.0)
{
return m_isOpen;
}
minPower = maxPower; minPower = maxPower;
for (unsigned int j = 0; j < m_nTones; ++j) 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 if ((minPower/maxPower < m_threshold) && (minIndex > maxIndex)) // open condition
bool open = maxPower > 0.0 ? (minPower/maxPower < m_threshold) && (minIndex > maxIndex) : true;
//qDebug("AFSquelch::evaluate: %g : %g", minPower/maxPower, m_threshold);
if (open)
{ {
if ((m_samplesAttack > 0) && (m_attackCount < m_samplesAttack)) if ((m_samplesAttack > 0) && (m_attackCount < m_samplesAttack))
{ {