fix default_keys example for avoid skipping first key

This commit is contained in:
Poroh
2018-12-24 19:34:17 +03:00
parent 703a5f362e
commit fa8df2cc64

View File

@@ -82,11 +82,6 @@ bool try_key(MFRC522::MIFARE_Key *key)
byte block = 0;
MFRC522::StatusCode status;
// http://arduino.stackexchange.com/a/14316
if ( ! mfrc522.PICC_IsNewCardPresent())
return false;
if ( ! mfrc522.PICC_ReadCardSerial())
return false;
// Serial.println(F("Authenticating using key A..."));
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK) {
@@ -153,5 +148,11 @@ void loop() {
// no need to try other keys for this PICC
break;
}
// http://arduino.stackexchange.com/a/14316
if ( ! mfrc522.PICC_IsNewCardPresent())
break;
if ( ! mfrc522.PICC_ReadCardSerial())
break;
}
}