From 71b095cf2e0da31312a65401813fdcbd92817f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Thu, 11 Nov 2021 22:09:45 +0100 Subject: [PATCH] Fix pointNum in SA result for DFT mode with narrow spans --- Software/VNA_embedded/Application/SpectrumAnalyzer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp b/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp index 0d1d973..e11da5e 100644 --- a/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp +++ b/Software/VNA_embedded/Application/SpectrumAnalyzer.cpp @@ -300,6 +300,10 @@ void SA::Work() { if(!s.SignalID || signalIDstep >= signalIDsteps - 1) { // this measurement point is done, handle result according to detector for(uint16_t i=0;i= points) { + // DFT covered more points than are required for the remaining sweep, can abort here + break; + } uint16_t binIndex = (pointCnt + i) / binSize; uint32_t pointInBin = (pointCnt + i) % binSize; bool lastPointInBin = pointInBin >= binSize - 1; @@ -386,7 +390,7 @@ void SA::Work() { Communication::Send(packet); } - if(pointCnt < points - DFTpoints) { + if(pointCnt + DFTpoints < points) { pointCnt += DFTpoints; } else { pointCnt = 0;