Skip to content

Commit 53ecf08

Browse files
committed
fixed decoder NFC-F
1 parent dd8172c commit 53ecf08

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/nfc-lib/lib-nfc/nfc-decode/src/main/cpp/tech/NfcA.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

src/nfc-lib/lib-nfc/nfc-decode/src/main/cpp/tech/NfcB.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ struct NfcB::Impl : NfcTech
272272
modulation->symbolEndTime = 0;
273273
modulation->searchStartTime = 0;
274274
modulation->searchEndTime = 0;
275+
modulation->searchSyncTime = 0;
275276
modulation->detectorPeakTime = 0;
276277
modulation->detectorPeakValue = 0;
277278
}

src/nfc-lib/lib-nfc/nfc-decode/src/main/cpp/tech/NfcF.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ struct NfcF::Impl : NfcTech
266266
modulation->symbolEndTime = 0;
267267
modulation->searchStartTime = 0;
268268
modulation->searchEndTime = 0;
269+
modulation->searchSyncTime = 0;
269270
modulation->detectorPeakTime = 0;
270271
modulation->detectorPeakValue = 0;
271272
modulation->correlatedPeakTime = 0;
@@ -276,7 +277,7 @@ struct NfcF::Impl : NfcTech
276277
if (decoder->signalClock < modulation->searchStartTime)
277278
continue;
278279

279-
if (correlatedSD >= minimumCorrelationValue)
280+
if (correlatedSD > minimumCorrelationValue)
280281
{
281282
// detect modulation peaks
282283
if (correlatedSD > modulation->correlatedPeakValue)

src/nfc-lib/lib-nfc/nfc-decode/src/main/cpp/tech/NfcV.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ struct NfcV::Impl : NfcTech
294294
modulation->symbolEndTime = 0;
295295
modulation->searchStartTime = 0;
296296
modulation->searchEndTime = 0;
297+
modulation->searchSyncTime = 0;
297298
modulation->detectorPeakTime = 0;
298299
modulation->detectorPeakValue = 0;
299300
modulation->correlatedPeakTime = 0;

0 commit comments

Comments
 (0)