1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Spectrum: restore holdoff to what it should actually do (trim transient contribution). Reviewed decay, holdoff and stoke limits

This commit is contained in:
f4exb 2018-10-17 14:21:25 +02:00
parent 9eb08541ee
commit 71e9556b6f
5 changed files with 19 additions and 31 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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();
}

View File

@ -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;

View File

@ -17,7 +17,7 @@
</font>
</property>
<property name="windowTitle">
<string>Oscilloscope</string>
<string>Spectrum</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="1,0,0">
<property name="leftMargin">
@ -52,7 +52,7 @@
<string>Decay:</string>
</property>
<property name="maximum">
<number>240</number>
<number>20</number>
</property>
<property name="pageStep">
<number>1</number>