Method to get frequency from FLL. Fixed Channel Analyzer lock delta frequency display in case of decimation

This commit is contained in:
f4exb 2019-05-04 04:54:16 +02:00
parent b4b157a9a4
commit fc650c5fd1
4 changed files with 16 additions and 2 deletions

View File

@ -379,3 +379,14 @@ void ChannelAnalyzer::applySettings(const ChannelAnalyzerSettings& settings, boo
m_settings = settings;
}
Real ChannelAnalyzer::getPllFrequency() const
{
if (m_settings.m_fll) {
return m_fll.getFreq();
} else if (m_settings.m_pll) {
return m_pll.getFreq();
} else {
return 0.0;
}
}

View File

@ -124,10 +124,11 @@ public:
DownChannelizer *getChannelizer() { return m_channelizer; }
int getInputSampleRate() const { return m_inputSampleRate; }
int getChannelSampleRate() const { return m_settings.m_downSample ? m_settings.m_downSampleRate : m_inputSampleRate; }
int getDecimation() const { return 1<<m_settings.m_spanLog2; }
double getMagSq() const { return m_magsq; }
double getMagSqAvg() const { return (double) m_channelPowerAvg; }
bool isPllLocked() const { return m_settings.m_pll && m_pll.locked(); }
Real getPllFrequency() const { return m_pll.getFreq(); }
Real getPllFrequency() const;
Real getPllDeltaPhase() const { return m_pll.getDeltaPhi(); }
Real getPllPhase() const { return m_pll.getPhiHat(); }

View File

@ -241,7 +241,8 @@ void ChannelAnalyzerGUI::tick()
if (ui->pll->isChecked())
{
int freq = (m_channelAnalyzer->getPllFrequency() * m_channelAnalyzer->getChannelSampleRate()) / (2.0*M_PI);
double sampleRate = ((double) m_channelAnalyzer->getChannelSampleRate()) / m_channelAnalyzer->getDecimation();
int freq = (m_channelAnalyzer->getPllFrequency() * sampleRate) / (2.0*M_PI);
ui->pll->setToolTip(tr("PLL lock. Freq = %1 Hz").arg(freq));
}
}

View File

@ -41,6 +41,7 @@ public:
const std::complex<float>& getComplex() const { return m_y; }
float getReal() const { return m_yRe; }
float getImag() const { return m_yIm; }
float getFreq() const { return m_freq; }
private:
/** Normalize angle in radians into the [-pi,+pi] region */