From d57038fcabb9901e6e5b0948bdb4c9d885467e71 Mon Sep 17 00:00:00 2001 From: Torsten Stauder Date: Sun, 9 May 2021 00:01:58 +0200 Subject: [PATCH] Fixing PN5180-issue with multiple card-detection --- src/RfidPn5180.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/RfidPn5180.cpp b/src/RfidPn5180.cpp index 99d1e49..c26afbe 100644 --- a/src/RfidPn5180.cpp +++ b/src/RfidPn5180.cpp @@ -67,7 +67,7 @@ extern unsigned long Rfid_LastRfidCheckTimestamp; static PN5180ISO14443 nfc14443(RFID_CS, RFID_BUSY, RFID_RST); static PN5180ISO15693 nfc15693(RFID_CS, RFID_BUSY, RFID_RST); static uint8_t stateMachine = RFID_PN5180_STATE_INIT; - byte cardId[cardIdSize]; + byte cardId[cardIdSize], lastCardId[cardIdSize]; uint8_t uid[10]; String cardIdString; bool cardReceived = false; @@ -95,6 +95,12 @@ extern unsigned long Rfid_LastRfidCheckTimestamp; } else if (RFID_PN5180_NFC14443_STATE_READCARD == stateMachine) { if (nfc14443.readCardSerial(uid) >= 4u) { cardReceived = true; + } else { + // Reset to dummy-value if no card is there + // Necessary to differentiate between "card is still applied" and "card is re-applied again after removal" + for (uint8_t i=0; i