Browse Source

Finally fixing single "no card"-events for PN5180

master
Torsten Stauder 4 years ago
parent
commit
8edf0e1c1a
  1. 8
      src/RfidPn5180.cpp
  2. 2
      src/main.cpp

8
src/RfidPn5180.cpp

@ -87,11 +87,13 @@ extern unsigned long Rfid_LastRfidCheckTimestamp;
// Reset to dummy-value if no card is there // 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" // Necessary to differentiate between "card is still applied" and "card is re-applied again after removal"
// lastTimeDetected14443 is used to prevent "new card detection with old card" with single events where no card was detected // lastTimeDetected14443 is used to prevent "new card detection with old card" with single events where no card was detected
if (!lastTimeDetected14443 || (millis() - lastTimeDetected14443 >= 300)) {
if (!lastTimeDetected14443 || (millis() - lastTimeDetected14443 >= 400)) {
lastTimeDetected14443 = 0; lastTimeDetected14443 = 0;
for (uint8_t i=0; i<cardIdSize; i++) { for (uint8_t i=0; i<cardIdSize; i++) {
lastCardId[i] = 0; lastCardId[i] = 0;
} }
} else {
stateMachine = RFID_PN5180_NFC14443_STATE_ACTIVE; // Still consider first event as "active"
} }
} }
@ -118,11 +120,13 @@ extern unsigned long Rfid_LastRfidCheckTimestamp;
lastTimeDetected15693 = millis(); lastTimeDetected15693 = millis();
} else { } else {
// lastTimeDetected15693 is used to prevent "new card detection with old card" with single events where no card was detected // lastTimeDetected15693 is used to prevent "new card detection with old card" with single events where no card was detected
if (!lastTimeDetected15693 || (millis() - lastTimeDetected15693 >= 300)) {
if (!lastTimeDetected15693 || (millis() - lastTimeDetected15693 >= 400)) {
lastTimeDetected15693 = 0; lastTimeDetected15693 = 0;
for (uint8_t i=0; i<cardIdSize; i++) { for (uint8_t i=0; i<cardIdSize; i++) {
lastCardId[i] = 0; lastCardId[i] = 0;
} }
} else {
stateMachine = RFID_PN5180_NFC15693_STATE_ACTIVE;
} }
} }
} }

2
src/main.cpp

@ -185,7 +185,7 @@ void setup()
Serial.println(F(" | |___ ___) | | __/ | |_| | | | | | | | | (_) |")); Serial.println(F(" | |___ ___) | | __/ | |_| | | | | | | | | (_) |"));
Serial.println(F(" |_____| |____/ |_| \\__,_| |_| |_| |_| \\___/ ")); Serial.println(F(" |_____| |____/ |_| \\__,_| |_| |_| |_| \\___/ "));
Serial.println(F(" Rfid-controlled musicplayer\n")); Serial.println(F(" Rfid-controlled musicplayer\n"));
Serial.println(F(" Rev 20210630-2\n"));
Serial.println(F(" Rev 20210705-1\n"));
// print wake-up reason // print wake-up reason
printWakeUpReason(); printWakeUpReason();

Loading…
Cancel
Save