mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
ChannelAnalyzerNG: implemented FLL
This commit is contained in:
parent
e723764376
commit
47f214fdf0
@ -51,6 +51,7 @@ ChannelAnalyzerNG::ChannelAnalyzerNG(DeviceSourceAPI *deviceAPI) :
|
||||
DSBFilter = new fftfilt(m_config.m_Bandwidth / m_config.m_inputSampleRate, 2*ssbFftLen);
|
||||
//m_pll.computeCoefficients(0.05f, 0.707f, 1000.0f); // bandwidth, damping factor, loop gain
|
||||
m_pll.computeCoefficients(0.002f, 0.5f, 10.0f); // bandwidth, damping factor, loop gain
|
||||
m_fll.computeCoefficients(0.004f); // ~100Hz @ 48 kHz
|
||||
|
||||
apply(true);
|
||||
|
||||
@ -77,9 +78,10 @@ void ChannelAnalyzerNG::configure(MessageQueue* messageQueue,
|
||||
int spanLog2,
|
||||
bool ssb,
|
||||
bool pll,
|
||||
bool fll,
|
||||
unsigned int pllPskOrder)
|
||||
{
|
||||
Message* cmd = MsgConfigureChannelAnalyzer::create(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb, pll, pllPskOrder);
|
||||
Message* cmd = MsgConfigureChannelAnalyzer::create(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb, pll, fll, pllPskOrder);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
@ -170,6 +172,7 @@ bool ChannelAnalyzerNG::handleMessage(const Message& cmd)
|
||||
m_config.m_spanLog2 = cfg.getSpanLog2();
|
||||
m_config.m_ssb = cfg.getSSB();
|
||||
m_config.m_pll = cfg.getPLL();
|
||||
m_config.m_fll = cfg.getFLL();
|
||||
m_config.m_pllPskOrder = cfg.getPLLPSKOrder();
|
||||
|
||||
qDebug() << "ChannelAnalyzerNG::handleMessage: MsgConfigureChannelAnalyzer:"
|
||||
@ -179,6 +182,7 @@ bool ChannelAnalyzerNG::handleMessage(const Message& cmd)
|
||||
<< " m_spanLog2: " << m_config.m_spanLog2
|
||||
<< " m_ssb: " << m_config.m_ssb
|
||||
<< " m_pll: " << m_config.m_pll
|
||||
<< " m_fll: " << m_config.m_fll
|
||||
<< " m_pllPskOrder: " << m_config.m_pllPskOrder;
|
||||
|
||||
apply();
|
||||
@ -254,7 +258,9 @@ void ChannelAnalyzerNG::apply(bool force)
|
||||
if ((m_running.m_channelSampleRate != m_config.m_channelSampleRate) ||
|
||||
(m_running.m_spanLog2 != m_config.m_spanLog2) || force)
|
||||
{
|
||||
m_pll.setSampleRate(m_running.m_channelSampleRate / (1<<m_running.m_spanLog2));
|
||||
int sampleRate = m_running.m_channelSampleRate / (1<<m_running.m_spanLog2);
|
||||
m_pll.setSampleRate(sampleRate);
|
||||
m_fll.computeCoefficients(200.0f/sampleRate); // 100 Hz
|
||||
}
|
||||
|
||||
if (m_running.m_pll != m_config.m_pll || force)
|
||||
@ -264,9 +270,18 @@ void ChannelAnalyzerNG::apply(bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_running.m_pll != m_config.m_pll || force)
|
||||
if (m_running.m_fll != m_config.m_fll || force)
|
||||
{
|
||||
m_pll.setPskOrder(m_config.m_pllPskOrder);
|
||||
if (m_config.m_fll) {
|
||||
m_fll.reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_running.m_pllPskOrder != m_config.m_pllPskOrder || force)
|
||||
{
|
||||
if (m_config.m_pllPskOrder < 5) {
|
||||
m_pll.setPskOrder(m_config.m_pllPskOrder);
|
||||
}
|
||||
}
|
||||
|
||||
m_running.m_frequency = m_config.m_frequency;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "dsp/ncof.h"
|
||||
#include "dsp/fftfilt.h"
|
||||
#include "dsp/phaselockcomplex.h"
|
||||
#include "dsp/freqlockcomplex.h"
|
||||
#include "audio/audiofifo.h"
|
||||
#include "util/message.h"
|
||||
|
||||
@ -47,6 +48,7 @@ public:
|
||||
int getSpanLog2() const { return m_spanLog2; }
|
||||
bool getSSB() const { return m_ssb; }
|
||||
bool getPLL() const { return m_pll; }
|
||||
bool getFLL() const { return m_fll; }
|
||||
unsigned int getPLLPSKOrder() const { return m_pllPskOrder; }
|
||||
|
||||
static MsgConfigureChannelAnalyzer* create(
|
||||
@ -56,6 +58,7 @@ public:
|
||||
int spanLog2,
|
||||
bool ssb,
|
||||
bool pll,
|
||||
bool fll,
|
||||
unsigned int pllPskOrder)
|
||||
{
|
||||
return new MsgConfigureChannelAnalyzer(
|
||||
@ -65,6 +68,7 @@ public:
|
||||
spanLog2,
|
||||
ssb,
|
||||
pll,
|
||||
fll,
|
||||
pllPskOrder);
|
||||
}
|
||||
|
||||
@ -75,6 +79,7 @@ public:
|
||||
int m_spanLog2;
|
||||
bool m_ssb;
|
||||
bool m_pll;
|
||||
bool m_fll;
|
||||
unsigned int m_pllPskOrder;
|
||||
|
||||
MsgConfigureChannelAnalyzer(
|
||||
@ -84,6 +89,7 @@ public:
|
||||
int spanLog2,
|
||||
bool ssb,
|
||||
bool pll,
|
||||
bool fll,
|
||||
unsigned int pllPskOrder) :
|
||||
Message(),
|
||||
m_channelSampleRate(channelSampleRate),
|
||||
@ -92,6 +98,7 @@ public:
|
||||
m_spanLog2(spanLog2),
|
||||
m_ssb(ssb),
|
||||
m_pll(pll),
|
||||
m_fll(fll),
|
||||
m_pllPskOrder(pllPskOrder)
|
||||
{ }
|
||||
};
|
||||
@ -148,6 +155,7 @@ public:
|
||||
int spanLog2,
|
||||
bool ssb,
|
||||
bool pll,
|
||||
bool fll,
|
||||
unsigned int pllPskOrder);
|
||||
|
||||
DownChannelizer *getChannelizer() { return m_channelizer; }
|
||||
@ -185,6 +193,7 @@ private:
|
||||
int m_spanLog2;
|
||||
bool m_ssb;
|
||||
bool m_pll;
|
||||
bool m_fll;
|
||||
unsigned int m_pllPskOrder;
|
||||
|
||||
Config() :
|
||||
@ -196,6 +205,7 @@ private:
|
||||
m_spanLog2(3),
|
||||
m_ssb(false),
|
||||
m_pll(false),
|
||||
m_fll(false),
|
||||
m_pllPskOrder(1)
|
||||
{}
|
||||
};
|
||||
@ -215,6 +225,7 @@ private:
|
||||
|
||||
NCOF m_nco;
|
||||
PhaseLockComplex m_pll;
|
||||
FreqLockComplex m_fll;
|
||||
Interpolator m_interpolator;
|
||||
Real m_interpolatorDistance;
|
||||
Real m_interpolatorDistanceRemain;
|
||||
@ -258,7 +269,11 @@ private:
|
||||
|
||||
if (m_running.m_pll)
|
||||
{
|
||||
m_pll.feed(re, im);
|
||||
if (m_running.m_fll) {
|
||||
m_fll.feed(re, im);
|
||||
} else {
|
||||
m_pll.feed(re, im);
|
||||
}
|
||||
|
||||
// Use -fPLL to mix (exchange PLL real and image in the complex multiplication)
|
||||
Real mixI = m_sum.real() * m_pll.getImag() - m_sum.imag() * m_pll.getReal();
|
||||
|
@ -251,9 +251,8 @@ void ChannelAnalyzerNGGUI::on_channelSampleRate_changed(quint64 value)
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelAnalyzerNGGUI::on_pll_toggled(bool checked)
|
||||
void ChannelAnalyzerNGGUI::on_pll_toggled(bool checked __attribute__((unused)))
|
||||
{
|
||||
m_usePll = checked;
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -399,8 +398,7 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceUISet *de
|
||||
m_channelMarker(this),
|
||||
m_doApplySettings(true),
|
||||
m_rate(6000),
|
||||
m_spanLog2(0),
|
||||
m_usePll(false)
|
||||
m_spanLog2(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
@ -592,6 +590,7 @@ void ChannelAnalyzerNGGUI::applySettings()
|
||||
m_spanLog2,
|
||||
ui->ssb->isChecked(),
|
||||
ui->pll->isChecked(),
|
||||
ui->pllPskOrder->currentIndex() == 5,
|
||||
1<<ui->pllPskOrder->currentIndex());
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ private:
|
||||
bool m_doApplySettings;
|
||||
int m_rate; //!< sample rate after final in-channel decimation (spanlog2)
|
||||
int m_spanLog2;
|
||||
bool m_usePll;
|
||||
MovingAverageUtil<Real, double, 40> m_channelPowerDbAvg;
|
||||
|
||||
ChannelAnalyzerNG* m_channelAnalyzer;
|
||||
|
@ -233,6 +233,11 @@
|
||||
<string>16</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>F</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user