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

NFM demod: optimized feed routine. Fixed channel power calculation

This commit is contained in:
f4exb 2015-10-11 06:34:12 +02:00
parent 23f773c111
commit e9f122fac1
3 changed files with 7 additions and 6 deletions

View File

@ -122,7 +122,8 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
for (SampleVector::const_iterator it = begin; it != end; ++it)
{
Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
//Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
Complex c(it->real(), it->imag());
c *= m_nco.nextIQ();
{
@ -135,7 +136,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
//ci *= (m_agcLevel / m_AGC.getValue());
m_AGC.feed(ci);
m_magsq = m_AGC.getMagSq();
//m_magsq = m_AGC.getMagSq() / (1<<30);
// demod
/*
@ -172,7 +173,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
// AF processing
squelchOpen = (getMagSq() > m_squelchLevel);
squelchOpen = (getMag() > m_squelchLevel);
/*
if (m_afSquelch.analyze(demod))
@ -355,7 +356,7 @@ void NFMDemod::apply()
if (m_config.m_squelch != m_running.m_squelch)
{
// input is a value in tenths of dB
m_squelchLevel = pow(10.0, m_config.m_squelch / 100.0);
m_squelchLevel = pow(10.0, m_config.m_squelch / 200.0);
//m_squelchLevel *= m_squelchLevel;
m_afSquelch.setThreshold(m_squelchLevel);
}

View File

@ -64,7 +64,7 @@ public:
m_ctcssIndexSelected = selectedCtcssIndex;
}
Real getMagSq() { return m_AGC.getAverage() / 4534.0; }
Real getMag() { return m_AGC.getAverage() / (1<<15); }
private:
class MsgConfigureNFMDemod : public Message {

View File

@ -341,7 +341,7 @@ void NFMDemodGUI::blockApplySettings(bool block)
void NFMDemodGUI::tick()
{
Real powDb = CalcDb::dbPower(m_nfmDemod->getMagSq());
Real powDb = CalcDb::dbPower(m_nfmDemod->getMag()) * 2;
m_channelPowerDbAvg.feed(powDb);
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
}