From b1c1433e4573b5d7d196acda00650bf9a5fa9f40 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 2 Oct 2020 00:58:41 +0200 Subject: [PATCH] 14b: safer handling of corrupted signals --- armsrc/iso14443b.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index c3e1a58d5..be8b820e0 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -893,6 +893,16 @@ static RAMFUNC int Handle14443bSamplesFromTag(int ci, int cq) { break; } } + if (AMPLITUDE(ci, cq) < SUBCARRIER_DETECT_THRESHOLD) { + LED_C_OFF(); + // subcarrier lost + Demod.state = DEMOD_UNSYNCD; + if (Demod.len > 0) { // no EOF but no signal anymore and we got data, e.g. ASK CTx + return true; + } + } + // we have still signal but no proper byte or EOF? this shouldn't happen + Demod.state = WAIT_FOR_RISING_EDGE_OF_SOF; } } Demod.posCount = 0;