NFM demod: quadrature squelch attack and decay

This commit is contained in:
f4exb 2017-05-12 10:45:18 +02:00
parent 67f318e6ed
commit 07fc282d89
1 changed files with 6 additions and 9 deletions

View File

@ -183,25 +183,21 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
if ( (m_running.m_deltaSquelch && ((deviation > m_squelchLevel) || (deviation < -m_squelchLevel))) || if ( (m_running.m_deltaSquelch && ((deviation > m_squelchLevel) || (deviation < -m_squelchLevel))) ||
(!m_running.m_deltaSquelch && (m_movingAverage.average() < m_squelchLevel)) ) (!m_running.m_deltaSquelch && (m_movingAverage.average() < m_squelchLevel)) )
{ {
if (m_squelchCount < m_squelchGate) if (m_squelchCount > 0)
{ {
m_squelchCount = 0; // return to 0 m_squelchCount--;
}
else
{
m_squelchCount--; // grace period
} }
} }
else else
{ {
if (m_squelchCount < m_squelchGate + 2) if (m_squelchCount < m_squelchGate + 480)
{ {
m_squelchCount++; m_squelchCount++;
} }
} }
//squelchOpen = (getMag() > m_squelchLevel); //squelchOpen = (getMag() > m_squelchLevel);
m_squelchOpen = m_squelchCount >= m_squelchGate; // wait for AGC to stabilize m_squelchOpen = (m_squelchCount > m_squelchGate);
/* /*
if (m_afSquelch.analyze(demod)) if (m_afSquelch.analyze(demod))
@ -248,8 +244,9 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
} }
else else
{ {
Real squelchFactor = (Real) (m_squelchCount - m_squelchGate) / 480.0f;
demod = m_bandpass.filter(demod); demod = m_bandpass.filter(demod);
sample = demod * m_running.m_volume; sample = demod * m_running.m_volume * squelchFactor * squelchFactor;
} }
} }
else else