kopia lustrzana https://github.com/f4exb/sdrangel
Spectrum markers: implemented histogram markers max power hold
rodzic
111c8d4a99
commit
7a00e51dc6
|
@ -1180,13 +1180,36 @@ void GLSpectrum::drawMarkers()
|
|||
|
||||
if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower)
|
||||
{
|
||||
float power = m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin];
|
||||
ypoint.ry() =
|
||||
(m_powerScale.getRangeMax() - m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin]) / m_powerScale.getRange();
|
||||
(m_powerScale.getRangeMax() - power) / m_powerScale.getRange();
|
||||
ypoint.ry() = ypoint.ry() < 0 ?
|
||||
0 : ypoint.ry() > 1 ?
|
||||
1 : ypoint.ry();
|
||||
powerStr = displayScaledF(
|
||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin],
|
||||
power,
|
||||
m_linear ? 'e' : 'f',
|
||||
m_linear ? 3 : 1,
|
||||
false
|
||||
);
|
||||
}
|
||||
else if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePowerMax)
|
||||
{
|
||||
float power = m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin];
|
||||
|
||||
if ((m_histogramMarkers.at(i).m_holdReset) || (power > m_histogramMarkers[i].m_powerMax))
|
||||
{
|
||||
m_histogramMarkers[i].m_powerMax = power;
|
||||
m_histogramMarkers[i].m_holdReset = false;
|
||||
}
|
||||
|
||||
ypoint.ry() =
|
||||
(m_powerScale.getRangeMax() - m_histogramMarkers[i].m_powerMax) / m_powerScale.getRange();
|
||||
ypoint.ry() = ypoint.ry() < 0 ?
|
||||
0 : ypoint.ry() > 1 ?
|
||||
1 : ypoint.ry();
|
||||
powerStr = displayScaledF(
|
||||
m_histogramMarkers[i].m_powerMax,
|
||||
m_linear ? 'e' : 'f',
|
||||
m_linear ? 3 : 1,
|
||||
false
|
||||
|
@ -1230,12 +1253,24 @@ void GLSpectrum::drawMarkers()
|
|||
else
|
||||
{
|
||||
textColor.setAlpha(192);
|
||||
float power0 = m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePower ?
|
||||
m_currentSpectrum[m_histogramMarkers.at(0).m_fftBin] :
|
||||
m_linear ? m_histogramMarkers.at(0).m_power : CalcDb::dbPower(m_histogramMarkers.at(0).m_power);
|
||||
float poweri = m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower ?
|
||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin] :
|
||||
m_linear ? m_histogramMarkers.at(i).m_power : CalcDb::dbPower(m_histogramMarkers.at(i).m_power);
|
||||
float power0, poweri;
|
||||
|
||||
if (m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePower) {
|
||||
power0 = m_currentSpectrum[m_histogramMarkers.at(0).m_fftBin];
|
||||
} else if (m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePowerMax) {
|
||||
power0 = m_histogramMarkers.at(0).m_powerMax;
|
||||
} else {
|
||||
power0 = m_linear ? m_histogramMarkers.at(0).m_power : CalcDb::dbPower(m_histogramMarkers.at(0).m_power);
|
||||
}
|
||||
|
||||
if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower) {
|
||||
poweri = m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin];
|
||||
} else if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePowerMax) {
|
||||
poweri = m_histogramMarkers.at(i).m_powerMax;
|
||||
} else {
|
||||
poweri = m_linear ? m_histogramMarkers.at(i).m_power : CalcDb::dbPower(m_histogramMarkers.at(i).m_power);
|
||||
}
|
||||
|
||||
QString deltaPowerStr;
|
||||
|
||||
if (m_linear) {
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
|
||||
enum SpectrumHistogramMarkerType {
|
||||
SpectrumHistogramMarkerTypeManual,
|
||||
SpectrumHistogramMarkerTypePower
|
||||
SpectrumHistogramMarkerTypePower,
|
||||
SpectrumHistogramMarkerTypePowerMax
|
||||
};
|
||||
|
||||
struct SpectrumHistogramMarker
|
||||
|
@ -36,6 +37,8 @@ struct SpectrumHistogramMarker
|
|||
float m_frequency;
|
||||
int m_fftBin;
|
||||
float m_power;
|
||||
bool m_holdReset;
|
||||
float m_powerMax;
|
||||
SpectrumHistogramMarkerType m_markerType;
|
||||
QColor m_markerColor;
|
||||
QString m_frequencyStr;
|
||||
|
@ -49,6 +52,8 @@ struct SpectrumHistogramMarker
|
|||
m_frequency(0),
|
||||
m_fftBin(0),
|
||||
m_power(0),
|
||||
m_holdReset(true),
|
||||
m_powerMax(0),
|
||||
m_markerType(SpectrumHistogramMarkerTypeManual),
|
||||
m_markerColor(QColorConstants::White),
|
||||
m_frequencyStr(),
|
||||
|
@ -62,6 +67,8 @@ struct SpectrumHistogramMarker
|
|||
float frequency,
|
||||
int fftBin,
|
||||
float power,
|
||||
bool holdReset,
|
||||
float powerMax,
|
||||
SpectrumHistogramMarkerType markerType,
|
||||
QColor markerColor,
|
||||
const QString& frequencyStr,
|
||||
|
@ -73,6 +80,8 @@ struct SpectrumHistogramMarker
|
|||
m_frequency(frequency),
|
||||
m_fftBin(fftBin),
|
||||
m_power(power),
|
||||
m_holdReset(holdReset),
|
||||
m_powerMax(powerMax),
|
||||
m_markerType(markerType),
|
||||
m_markerColor(markerColor),
|
||||
m_frequencyStr(frequencyStr),
|
||||
|
|
|
@ -250,6 +250,15 @@ void SpectrumMarkersDialog::on_powerMode_currentIndexChanged(int index)
|
|||
m_histogramMarkers[m_histogramMarkerIndex].m_markerType = (SpectrumHistogramMarkerType) index;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_powerHoldReset_clicked()
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_holdReset = true;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_wMarkerFrequency_changed(qint64 value)
|
||||
{
|
||||
if (m_waterfallMarkers.size() == 0) {
|
||||
|
|
|
@ -68,6 +68,7 @@ private slots:
|
|||
void on_markerAdd_clicked();
|
||||
void on_markerDel_clicked();
|
||||
void on_powerMode_currentIndexChanged(int index);
|
||||
void on_powerHoldReset_clicked();
|
||||
void on_wMarkerFrequency_changed(qint64 value);
|
||||
void on_timeCoarse_valueChanged(int value);
|
||||
void on_timeFine_valueChanged(int value);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>390</width>
|
||||
<width>418</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>361</width>
|
||||
<width>391</width>
|
||||
<height>74</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -367,6 +367,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="powerHoldReset">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset power max hold</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>R</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="powerMode">
|
||||
<property name="maximumSize">
|
||||
|
@ -382,7 +398,12 @@
|
|||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pow</string>
|
||||
<string>Cur</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
@ -449,7 +470,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>361</width>
|
||||
<width>391</width>
|
||||
<height>93</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
Ładowanie…
Reference in New Issue