mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-09-28 15:56:33 -04:00
Channel Analyzer: corrected suqared magnitude (power) display in dB
This commit is contained in:
parent
23ba4b9ec8
commit
7365b2dece
@ -156,6 +156,7 @@ void ChannelAnalyzer::processOneSample(Complex& c, fftfilt::cmplx *sideband)
|
|||||||
Real re = m_sum.real() / SDR_RX_SCALEF;
|
Real re = m_sum.real() / SDR_RX_SCALEF;
|
||||||
Real im = m_sum.imag() / SDR_RX_SCALEF;
|
Real im = m_sum.imag() / SDR_RX_SCALEF;
|
||||||
m_magsq = re*re + im*im;
|
m_magsq = re*re + im*im;
|
||||||
|
m_channelPowerAvg(m_magsq);
|
||||||
std::complex<float> mix;
|
std::complex<float> mix;
|
||||||
|
|
||||||
if (m_settings.m_pll)
|
if (m_settings.m_pll)
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "dsp/freqlockcomplex.h"
|
#include "dsp/freqlockcomplex.h"
|
||||||
#include "audio/audiofifo.h"
|
#include "audio/audiofifo.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
|
#include "util/movingaverage.h"
|
||||||
|
|
||||||
#include "chanalyzersettings.h"
|
#include "chanalyzersettings.h"
|
||||||
|
|
||||||
@ -188,6 +189,7 @@ public:
|
|||||||
int getInputSampleRate() const { return m_inputSampleRate; }
|
int getInputSampleRate() const { return m_inputSampleRate; }
|
||||||
int getChannelSampleRate() const { return m_settings.m_downSample ? m_settings.m_downSampleRate : m_inputSampleRate; }
|
int getChannelSampleRate() const { return m_settings.m_downSample ? m_settings.m_downSampleRate : m_inputSampleRate; }
|
||||||
double getMagSq() const { return m_magsq; }
|
double getMagSq() const { return m_magsq; }
|
||||||
|
double getMagSqAvg() const { return (double) m_channelPowerAvg; }
|
||||||
bool isPllLocked() const { return m_settings.m_pll && m_pll.locked(); }
|
bool isPllLocked() const { return m_settings.m_pll && m_pll.locked(); }
|
||||||
Real getPllFrequency() const { return m_pll.getFreq(); }
|
Real getPllFrequency() const { return m_pll.getFreq(); }
|
||||||
Real getPllDeltaPhase() const { return m_pll.getDeltaPhi(); }
|
Real getPllDeltaPhase() const { return m_pll.getDeltaPhi(); }
|
||||||
@ -236,6 +238,7 @@ private:
|
|||||||
|
|
||||||
BasebandSampleSink* m_sampleSink;
|
BasebandSampleSink* m_sampleSink;
|
||||||
SampleVector m_sampleBuffer;
|
SampleVector m_sampleBuffer;
|
||||||
|
MovingAverageUtil<double, double, 480> m_channelPowerAvg;
|
||||||
QMutex m_settingsMutex;
|
QMutex m_settingsMutex;
|
||||||
|
|
||||||
// void apply(bool force = false);
|
// void apply(bool force = false);
|
||||||
|
@ -226,9 +226,9 @@ void ChannelAnalyzerGUI::channelMarkerHighlightedByCursor()
|
|||||||
|
|
||||||
void ChannelAnalyzerGUI::tick()
|
void ChannelAnalyzerGUI::tick()
|
||||||
{
|
{
|
||||||
double powDb = CalcDb::dbPower(m_channelAnalyzer->getMagSq());
|
m_channelPowerAvg(m_channelAnalyzer->getMagSqAvg());
|
||||||
m_channelPowerDbAvg(powDb);
|
double powDb = CalcDb::dbPower((double) m_channelPowerAvg);
|
||||||
ui->channelPower->setText(tr("%1 dB").arg((Real) m_channelPowerDbAvg, 0, 'f', 1));
|
ui->channelPower->setText(tr("%1 dB").arg(powDb, 0, 'f', 1));
|
||||||
|
|
||||||
if (m_channelAnalyzer->isPllLocked()) {
|
if (m_channelAnalyzer->isPllLocked()) {
|
||||||
ui->pll->setStyleSheet("QToolButton { background-color : green; }");
|
ui->pll->setStyleSheet("QToolButton { background-color : green; }");
|
||||||
|
@ -68,7 +68,7 @@ private:
|
|||||||
ChannelAnalyzerSettings m_settings;
|
ChannelAnalyzerSettings m_settings;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
int m_rate; //!< sample rate after final in-channel decimation (spanlog2)
|
int m_rate; //!< sample rate after final in-channel decimation (spanlog2)
|
||||||
MovingAverageUtil<Real, double, 40> m_channelPowerDbAvg;
|
MovingAverageUtil<double, double, 40> m_channelPowerAvg;
|
||||||
|
|
||||||
ChannelAnalyzer* m_channelAnalyzer;
|
ChannelAnalyzer* m_channelAnalyzer;
|
||||||
SpectrumScopeNGComboVis* m_spectrumScopeComboVis;
|
SpectrumScopeNGComboVis* m_spectrumScopeComboVis;
|
||||||
|
Loading…
Reference in New Issue
Block a user