1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-03 05:37:50 -04:00

New scope: mag (dB) power overlay considering time base and time offset

This commit is contained in:
f4exb 2017-02-26 05:26:42 +01:00
parent 9a48e8b090
commit ede5990191

View File

@ -446,25 +446,28 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
float p = pdB - (100.0f * itData->m_ofs); float p = pdB - (100.0f * itData->m_ofs);
v = ((p/50.0f) + 2.0f)*itData->m_amp - 1.0f; v = ((p/50.0f) + 2.0f)*itData->m_amp - 1.0f;
if ((traceCount - shift) == 0) if ((traceCount >= shift) && (traceCount < shift+length)) // power display overlay values construction
{ {
itCtl->m_maxPow = -200.0f; if (traceCount == shift)
itCtl->m_sumPow = 0.0f;
itCtl->m_nbPow = 1;
}
if (pdB > -200.0f)
{
if (pdB > itCtl->m_maxPow)
{ {
itCtl->m_maxPow = pdB; itCtl->m_maxPow = -200.0f;
itCtl->m_sumPow = 0.0f;
itCtl->m_nbPow = 1;
} }
itCtl->m_sumPow += pdB; if (pdB > -200.0f)
itCtl->m_nbPow++; {
if (pdB > itCtl->m_maxPow)
{
itCtl->m_maxPow = pdB;
}
itCtl->m_sumPow += pdB;
itCtl->m_nbPow++;
}
} }
if ((m_nbSamples == 1) && (itCtl->m_nbPow > 0)) if ((m_nbSamples == 1) && (itCtl->m_nbPow > 0)) // on last sample create power display overlay
{ {
double avgPow = itCtl->m_sumPow / itCtl->m_nbPow; double avgPow = itCtl->m_sumPow / itCtl->m_nbPow;
double peakToAvgPow = itCtl->m_maxPow - avgPow; double peakToAvgPow = itCtl->m_maxPow - avgPow;
@ -488,12 +491,6 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
(*itTrace)[2*traceCount + 1] = v; // display y (*itTrace)[2*traceCount + 1] = v; // display y
traceCount++; traceCount++;
} }
else
{
// if (projectionType == ProjectionMagDB) // create power display overlay
// {
// }
}
} }
++begin; ++begin;