@@ -280,6 +280,7 @@ struct NfcA::Impl : NfcTech
280280 modulation->symbolEndTime = 0 ;
281281 modulation->searchStartTime = 0 ;
282282 modulation->searchEndTime = 0 ;
283+ modulation->searchSyncTime = 0 ;
283284 modulation->detectorPeakTime = 0 ;
284285 modulation->detectorPeakValue = 0 ;
285286 modulation->correlatedPeakTime = 0 ;
@@ -314,11 +315,14 @@ struct NfcA::Impl : NfcTech
314315 }
315316 else
316317 {
317- // detect maximum correlation point
318- if (correlatedSD > modulation->correlatedPeakValue && correlatedSD > modulation->searchValueThreshold )
318+ if (correlatedSD > minimumCorrelationValue)
319319 {
320- modulation->correlatedPeakValue = correlatedSD;
321- modulation->correlatedPeakTime = decoder->signalClock ;
320+ // detect maximum correlation point
321+ if (correlatedSD > modulation->correlatedPeakValue )
322+ {
323+ modulation->correlatedPeakValue = correlatedSD;
324+ modulation->correlatedPeakTime = decoder->signalClock ;
325+ }
322326 }
323327 }
324328
@@ -348,7 +352,6 @@ struct NfcA::Impl : NfcTech
348352 modulation->searchSyncTime = modulation->correlatedPeakTime + bitrate->period2SymbolSamples ;
349353 modulation->searchStartTime = modulation->searchSyncTime - bitrate->period8SymbolSamples ;
350354 modulation->searchEndTime = modulation->searchSyncTime + bitrate->period8SymbolSamples ;
351- modulation->searchValueThreshold = std::abs (modulation->correlatedPeakValue * 0.5 );
352355 modulation->symbolStartTime = modulation->correlatedPeakTime - bitrate->period2SymbolSamples ;
353356 modulation->correlatedPeakTime = 0 ;
354357 modulation->correlatedPeakValue = 0 ;
0 commit comments