From 71e9556b6fbd2617330028260533f6c56a71fd97 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 17 Oct 2018 14:21:25 +0200 Subject: [PATCH] Spectrum: restore holdoff to what it should actually do (trim transient contribution). Reviewed decay, holdoff and stoke limits --- sdrgui/gui/glspectrum.cpp | 24 ++++++------------------ sdrgui/gui/glspectrum.h | 2 +- sdrgui/gui/glspectrumgui.cpp | 18 +++++++++--------- sdrgui/gui/glspectrumgui.h | 2 +- sdrgui/gui/glspectrumgui.ui | 4 ++-- 5 files changed, 19 insertions(+), 31 deletions(-) diff --git a/sdrgui/gui/glspectrum.cpp b/sdrgui/gui/glspectrum.cpp index f96a8f624..eaf6e8b62 100644 --- a/sdrgui/gui/glspectrum.cpp +++ b/sdrgui/gui/glspectrum.cpp @@ -104,9 +104,9 @@ GLSpectrum::GLSpectrum(QWidget* parent) : ((quint8*)&m_histogramPalette[i])[3] = c.alpha(); } - m_histogramHoldoffBase = 2; // was 4 + m_histogramHoldoffBase = 4; // was 2 m_histogramHoldoffCount = m_histogramHoldoffBase; - m_histogramLateHoldoff = 1; // was 20 + m_histogramLateHoldoff = 20; // was 1 m_histogramStroke = 40; // was 4 m_timeScale.setFont(font()); @@ -170,29 +170,17 @@ void GLSpectrum::setPowerRange(Real powerRange) void GLSpectrum::setDecay(int decay) { - m_decay = decay; - if(m_decay < 0) - m_decay = 0; - else if(m_decay > 10) - m_decay = 10; + m_decay = decay < 0 ? 0 : decay > 20 ? 20 : decay; } -void GLSpectrum::setHistoLateHoldoff(int lateHoldoff) +void GLSpectrum::setHistoHoldoffBase(int holdoffBase) { - m_histogramLateHoldoff = lateHoldoff; - if(m_histogramLateHoldoff < 0) - m_histogramLateHoldoff = 0; - else if(m_histogramLateHoldoff > 20) - m_histogramLateHoldoff = 20; + m_histogramHoldoffBase = holdoffBase < 0 ? 0 : holdoffBase > 20 ? 20 : holdoffBase; } void GLSpectrum::setHistoStroke(int stroke) { - m_histogramStroke = stroke; - if(m_histogramStroke < 4) - m_histogramStroke = 4; - else if(m_histogramStroke > 240) - m_histogramStroke = 240; + m_histogramStroke = stroke < 4 ? 4 : stroke > 240 ? 240 : stroke; } void GLSpectrum::setSampleRate(qint32 sampleRate) diff --git a/sdrgui/gui/glspectrum.h b/sdrgui/gui/glspectrum.h index c1be4bdf9..0ecbfbb85 100644 --- a/sdrgui/gui/glspectrum.h +++ b/sdrgui/gui/glspectrum.h @@ -69,7 +69,7 @@ public: void setReferenceLevel(Real referenceLevel); void setPowerRange(Real powerRange); void setDecay(int decay); - void setHistoLateHoldoff(int lateHoldoff); + void setHistoHoldoffBase(int holdoffBase); void setHistoStroke(int stroke); void setDisplayWaterfall(bool display); void setSsbSpectrum(bool ssbSpectrum); diff --git a/sdrgui/gui/glspectrumgui.cpp b/sdrgui/gui/glspectrumgui.cpp index 0d2dc6814..b131664f7 100644 --- a/sdrgui/gui/glspectrumgui.cpp +++ b/sdrgui/gui/glspectrumgui.cpp @@ -17,7 +17,7 @@ GLSpectrumGUI::GLSpectrumGUI(QWidget* parent) : m_refLevel(0), m_powerRange(100), m_decay(0), - m_histogramLateHoldoff(1), + m_histogramHoldoffBase(0), m_histogramStroke(40), m_displayGridIntensity(5), m_displayTraceIntensity(50), @@ -67,7 +67,7 @@ void GLSpectrumGUI::resetToDefaults() m_refLevel = 0; m_powerRange = 100; m_decay = 0; - m_histogramLateHoldoff = 1; + m_histogramHoldoffBase = 0; m_histogramStroke = 40; m_displayGridIntensity = 5, m_displayWaterfall = true; @@ -98,7 +98,7 @@ QByteArray GLSpectrumGUI::serialize() const s.writeBool(11, m_displayGrid); s.writeBool(12, m_invert); s.writeS32(13, m_displayGridIntensity); - s.writeS32(14, m_histogramLateHoldoff); + s.writeS32(14, m_histogramHoldoffBase); s.writeS32(15, m_histogramStroke); s.writeBool(16, m_displayCurrent); s.writeS32(17, m_displayTraceIntensity); @@ -134,7 +134,7 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data) d.readBool(11, &m_displayGrid, false); d.readBool(12, &m_invert, true); d.readS32(13, &m_displayGridIntensity, 5); - d.readS32(14, &m_histogramLateHoldoff, 1); + d.readS32(14, &m_histogramHoldoffBase, 0); d.readS32(15, &m_histogramStroke, 40); d.readBool(16, &m_displayCurrent, false); d.readS32(17, &m_displayTraceIntensity, 50); @@ -171,7 +171,7 @@ void GLSpectrumGUI::applySettings() ui->averagingMode->setCurrentIndex((int) m_averagingMode); ui->linscale->setChecked(m_linear); ui->decay->setSliderPosition(m_decay); - ui->holdoff->setSliderPosition(m_histogramLateHoldoff); + ui->holdoff->setSliderPosition(m_histogramHoldoffBase); ui->stroke->setSliderPosition(m_histogramStroke); ui->waterfall->setChecked(m_displayWaterfall); ui->maxHold->setChecked(m_displayMaxHold); @@ -182,7 +182,7 @@ void GLSpectrumGUI::applySettings() ui->gridIntensity->setSliderPosition(m_displayGridIntensity); ui->decay->setToolTip(QString("Decay: %1").arg(m_decay)); - ui->holdoff->setToolTip(QString("Holdoff: %1").arg(m_histogramLateHoldoff)); + ui->holdoff->setToolTip(QString("Holdoff: %1").arg(m_histogramHoldoffBase)); ui->stroke->setToolTip(QString("Stroke: %1").arg(m_histogramStroke)); ui->gridIntensity->setToolTip(QString("Grid intensity: %1").arg(m_displayGridIntensity)); ui->traceIntensity->setToolTip(QString("Trace intensity: %1").arg(m_displayTraceIntensity)); @@ -193,7 +193,7 @@ void GLSpectrumGUI::applySettings() m_glSpectrum->setDisplayCurrent(m_displayCurrent); m_glSpectrum->setDisplayHistogram(m_displayHistogram); m_glSpectrum->setDecay(m_decay); - m_glSpectrum->setHistoLateHoldoff(m_histogramLateHoldoff); + m_glSpectrum->setHistoHoldoffBase(m_histogramHoldoffBase); m_glSpectrum->setHistoStroke(m_histogramStroke); m_glSpectrum->setInvertedWaterfall(m_invert); m_glSpectrum->setDisplayGrid(m_displayGrid); @@ -372,8 +372,8 @@ void GLSpectrumGUI::on_holdoff_valueChanged(int index) if (index < 0) { return; } - m_histogramLateHoldoff = index; - //ui->holdoff->setToolTip(QString("Holdoff: %1").arg(m_histogramLateHoldoff)); + m_histogramHoldoffBase = index; + //ui->holdoff->setToolTip(QString("Holdoff: %1").arg(m_histogramHoldoffBase)); if(m_glSpectrum != 0) { applySettings(); } diff --git a/sdrgui/gui/glspectrumgui.h b/sdrgui/gui/glspectrumgui.h index 9cf02a20d..d3f4537d4 100644 --- a/sdrgui/gui/glspectrumgui.h +++ b/sdrgui/gui/glspectrumgui.h @@ -49,7 +49,7 @@ private: Real m_refLevel; Real m_powerRange; int m_decay; - int m_histogramLateHoldoff; + int m_histogramHoldoffBase; int m_histogramStroke; int m_displayGridIntensity; int m_displayTraceIntensity; diff --git a/sdrgui/gui/glspectrumgui.ui b/sdrgui/gui/glspectrumgui.ui index 6c81795fb..bf898392f 100644 --- a/sdrgui/gui/glspectrumgui.ui +++ b/sdrgui/gui/glspectrumgui.ui @@ -17,7 +17,7 @@ - Oscilloscope + Spectrum @@ -52,7 +52,7 @@ Decay: - 240 + 20 1