diff --git a/doc/img/ChAnalyzerNG_plugin_overlay_lin.png b/doc/img/ChAnalyzerNG_plugin_overlay_lin.png
new file mode 100644
index 000000000..23706118d
Binary files /dev/null and b/doc/img/ChAnalyzerNG_plugin_overlay_lin.png differ
diff --git a/doc/img/ChAnalyzerNG_plugin_overlay_lin.xcf b/doc/img/ChAnalyzerNG_plugin_overlay_lin.xcf
new file mode 100644
index 000000000..e4bcb58d8
Binary files /dev/null and b/doc/img/ChAnalyzerNG_plugin_overlay_lin.xcf differ
diff --git a/plugins/channelrx/chanalyzer/readme.md b/plugins/channelrx/chanalyzer/readme.md
index 653c76896..e4f069307 100644
--- a/plugins/channelrx/chanalyzer/readme.md
+++ b/plugins/channelrx/chanalyzer/readme.md
@@ -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)
+
5. Source select
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
diff --git a/sdrgui/dsp/scopevisng.cpp b/sdrgui/dsp/scopevisng.cpp
index 70a8044c3..ca6377310 100644
--- a/sdrgui/dsp/scopevisng.cpp
+++ b/sdrgui/dsp/scopevisng.cpp
@@ -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)
{
diff --git a/sdrgui/gui/glscopenggui.cpp b/sdrgui/gui/glscopenggui.cpp
index 425d45f2f..3362ec55f 100644
--- a/sdrgui/gui/glscopenggui.cpp
+++ b/sdrgui/gui/glscopenggui.cpp
@@ -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()];