Browse Source

Fix PN5180 to accept same card again

master
Torsten Stauder 4 years ago
parent
commit
a7a7b49efe
  1. 11
      src/RfidPn5180.cpp

11
src/RfidPn5180.cpp

@ -67,7 +67,7 @@ extern unsigned long Rfid_LastRfidCheckTimestamp;
static PN5180ISO14443 nfc14443(RFID_CS, RFID_BUSY, RFID_RST); static PN5180ISO14443 nfc14443(RFID_CS, RFID_BUSY, RFID_RST);
static PN5180ISO15693 nfc15693(RFID_CS, RFID_BUSY, RFID_RST); static PN5180ISO15693 nfc15693(RFID_CS, RFID_BUSY, RFID_RST);
static uint8_t stateMachine = RFID_PN5180_STATE_INIT; static uint8_t stateMachine = RFID_PN5180_STATE_INIT;
byte cardId[cardIdSize], lastCardId[cardIdSize];
byte cardId[cardIdSize];
uint8_t uid[10]; uint8_t uid[10];
String cardIdString; String cardIdString;
bool cardReceived = false; bool cardReceived = false;
@ -123,15 +123,6 @@ extern unsigned long Rfid_LastRfidCheckTimestamp;
if (cardReceived) { if (cardReceived) {
memcpy(cardId, uid, cardIdSize); memcpy(cardId, uid, cardIdSize);
// check for different card id
if (memcmp((const void *)cardId, (const void *)lastCardId, sizeof(cardId)) == 0) {
// reset state machine
stateMachine = RFID_PN5180_NFC14443_STATE_RESET;
return;
}
memcpy(lastCardId, cardId, cardIdSize);
Log_Print((char *) FPSTR(rfidTagDetected), LOGLEVEL_NOTICE); Log_Print((char *) FPSTR(rfidTagDetected), LOGLEVEL_NOTICE);
for (uint8_t i = 0u; i < cardIdSize; i++) { for (uint8_t i = 0u; i < cardIdSize; i++) {
snprintf(Log_Buffer, Log_BufferLength, "%02x%s", cardId[i], (i < cardIdSize - 1u) ? "-" : "\n"); snprintf(Log_Buffer, Log_BufferLength, "%02x%s", cardId[i], (i < cardIdSize - 1u) ? "-" : "\n");

Loading…
Cancel
Save