From 79290d0f3680f0e8beed57706f0a91cce729f85d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Tue, 24 Oct 2023 17:41:45 +0200 Subject: [PATCH] Use trace data after math operations for eye diagram plot --- .../PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp | 6 +++++- Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp | 1 + Software/PC_Application/LibreVNA-GUI/Traces/trace.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp index 323aa34..118f990 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/eyediagramplot.cpp @@ -82,9 +82,13 @@ void EyeDiagramPlot::enableTrace(Trace *t, bool enabled) TracePlot::enableTrace(t, enabled); if(enabled) { trace = t; - tdr->assignInput(trace); + tdr->assignInput(trace->getLastMath()); + connect(trace, &Trace::lastMathChanged, this, [=](){ + tdr->assignInput(trace->getLastMath()); + }); } else { if(trace) { + disconnect(trace, &Trace::lastMathChanged, this, nullptr); tdr->removeInput(); std::lock_guard calc(calcMutex); displayData->clear(); diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp index 7a12ebc..4e982be 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp @@ -1103,6 +1103,7 @@ void Trace::updateLastMath(vector::reverse_iterator start) lastMath = newLast; // relay signals of end of math chain connect(lastMath, &TraceMath::outputSamplesChanged, this, &Trace::dataChanged); + emit lastMathChanged(); emit typeChanged(this); emit outputSamplesChanged(0, data.size()); } diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/trace.h b/Software/PC_Application/LibreVNA-GUI/Traces/trace.h index ac0b6b8..0599e2b 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/trace.h +++ b/Software/PC_Application/LibreVNA-GUI/Traces/trace.h @@ -66,6 +66,7 @@ public: QString liveParameter() { return liveParam; } LivedataType liveType() { return _liveType; } TraceMath::DataType outputType() const { return lastMath->getDataType(); } + TraceMath *getLastMath() { return lastMath;} unsigned int size() const; bool isDeembeddingActive(); @@ -211,6 +212,7 @@ signals: void markerAdded(Marker *m); void markerRemoved(Marker *m); void markerFormatChanged(Marker *m); + void lastMathChanged(); private slots: void markerVisibilityChanged(Marker *m);