Skip to content

Commit

Permalink
fix nfc still in field detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rednblkx committed Mar 5, 2024
1 parent d09812d commit 1fb287f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,19 @@ struct LockMechanism : Service::LockMechanism
payload["homekey"] = false;
mqtt.publish(MQTT_AUTH_TOPIC, payload.dump().c_str());
}
delay(1000);
delay(500);
nfc.inRelease();
nfc.setPassiveActivationRetries(10);
bool deviceStillInField = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLen);
LOG(V, "Target still present: %d", deviceStillInField);
while (deviceStillInField) {
LOG(V, "Target still present: %d", deviceStillInField);
delay(1000);
delay(300);
nfc.inRelease();
deviceStillInField = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLen);
LOG(V, "Target still present: %d", deviceStillInField);
}
nfc.inRelease();
nfc.setPassiveActivationRetries(0);
}
else {
uint8_t response[2];
Expand Down

0 comments on commit 1fb287f

Please sign in to comment.