Fixed NFM squelch

pull/6/head
f4exb 2015-10-25 14:47:28 +01:00
rodzic d9be377d5b
commit 681863b2a2
2 zmienionych plików z 19 dodań i 2 usunięć

Wyświetl plik

@ -33,6 +33,8 @@ MESSAGE_CLASS_DEFINITION(NFMDemod::MsgConfigureNFMDemod, Message)
NFMDemod::NFMDemod() :
m_ctcssIndex(0),
m_sampleCount(0),
m_squelchCount(0),
m_agcAttack(2400),
m_afSquelch(2, afSqTones),
m_audioFifo(4, 48000),
m_settingsMutex(QMutex::Recursive)
@ -54,7 +56,7 @@ NFMDemod::NFMDemod() :
m_audioBufferFill = 0;
m_agcLevel = 1.0;
m_AGC.resize(240, m_agcLevel);
m_AGC.resize(m_agcAttack, m_agcLevel);
m_magsq = 0;
m_ctcssDetector.setCoefficients(3000, 6000.0); // 0.5s / 2 Hz resolution
@ -173,7 +175,20 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
// AF processing
squelchOpen = (getMag() > m_squelchLevel);
if (getMag() > m_squelchLevel)
{
if (m_squelchCount < m_agcAttack)
{
m_squelchCount++;
}
}
else
{
m_squelchCount = 0;
}
//squelchOpen = (getMag() > m_squelchLevel);
squelchOpen = m_squelchCount == m_agcAttack; // wait for AGC to stabilize
/*
if (m_afSquelch.analyze(demod))

Wyświetl plik

@ -155,6 +155,8 @@ private:
int m_ctcssIndex; // 0 for nothing detected
int m_ctcssIndexSelected;
int m_sampleCount;
int m_squelchCount;
int m_agcAttack;
double m_squelchLevel;