1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Scope: added magnitude squared (linear power) display overlays

This commit is contained in:
f4exb 2018-06-26 01:06:45 +02:00
parent 80b7829bf7
commit fd915613e4
5 changed files with 35 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

View File

@ -269,6 +269,10 @@ The signal is synchronized with the PLL in 4 phase mode (locker icon is green).
![Channel Analyzer NG plugin scope1 controls](../../../doc/img/ChAnalyzerNG_plugin_overlay_dB.png)
**Note3**: in the MagSq mode when the trace is selected (1) the display overlay on the top right of the trace shows 2 figures in scientific notation. From left to right: peak power and average power.
![Channel Analyzer NG plugin scope2 controls](../../../doc/img/ChAnalyzerNG_plugin_overlay_lin.png)
<h3>5. Source select</h3>
This is for future use when more than one incoming complex signals can be applied. The signal index appears on the right of the button

View File

@ -465,8 +465,36 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
}
else if (projectionType == Projector::ProjectionMagSq)
{
v = ((*itCtl)->m_projector.run(*begin) - itData->m_ofs)*itData->m_amp - 1.0f;
// TODO: power display overlay for squared magnitude
Real magsq = (*itCtl)->m_projector.run(*begin);
v = (magsq - itData->m_ofs)*itData->m_amp - 1.0f;
if ((traceCount >= shift) && (traceCount < shift+length)) // power display overlay values construction
{
if (traceCount == shift)
{
(*itCtl)->m_maxPow = 0.0f;
(*itCtl)->m_sumPow = 0.0f;
(*itCtl)->m_nbPow = 1;
}
if (magsq > 0.0f)
{
if (magsq > (*itCtl)->m_maxPow)
{
(*itCtl)->m_maxPow = magsq;
}
(*itCtl)->m_sumPow += magsq;
(*itCtl)->m_nbPow++;
}
}
if ((m_nbSamples == 1) && ((*itCtl)->m_nbPow > 0)) // on last sample create power display overlay
{
double avgPow = (*itCtl)->m_sumPow / (*itCtl)->m_nbPow;
itData->m_textOverlay = QString("%1 %2").arg((*itCtl)->m_maxPow, 0, 'e', 2).arg(avgPow, 0, 'e', 2);
(*itCtl)->m_nbPow = 0;
}
}
else if (projectionType == Projector::ProjectionMagDB)
{

View File

@ -1217,7 +1217,7 @@ void GLScopeNGGUI::disableLiveMode(bool disable)
void GLScopeNGGUI::fillTraceData(ScopeVisNG::TraceData& traceData)
{
traceData.m_projectionType = (Projector::ProjectionType) ui->traceMode->currentIndex();
traceData.m_hasTextOverlay = (traceData.m_projectionType == Projector::ProjectionMagDB);
traceData.m_hasTextOverlay = (traceData.m_projectionType == Projector::ProjectionMagDB) || (traceData.m_projectionType == Projector::ProjectionMagSq);
traceData.m_textOverlay.clear();
traceData.m_inputIndex = 0;
traceData.m_amp = 0.2 / amps[ui->amp->value()];