Skip to content

Commit 6f865f1

Browse files
author
biologist79
committed
Fix for flood of privacy disabled msg
1 parent d0c0ef8 commit 6f865f1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/RfidPn5180.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ extern unsigned long Rfid_LastRfidCheckTimestamp;
9393
uint8_t stateMachine = RFID_PN5180_STATE_INIT;
9494
static byte cardId[cardIdSize], lastCardId[cardIdSize];
9595
uint8_t uid[10];
96+
bool showDisablePrivacyNotification = true;
9697

9798
// wait until queues are created
98-
while(gRfidCardQueue == NULL){
99+
while (gRfidCardQueue == NULL) {
99100
Log_Println((char *) FPSTR(waitingForTaskQueues), LOGLEVEL_DEBUG);
100101
vTaskDelay(50);
101102
}
@@ -173,7 +174,10 @@ extern unsigned long Rfid_LastRfidCheckTimestamp;
173174
uint8_t password[] = {0x01, 0x02, 0x03, 0x04};
174175
ISO15693ErrorCode myrc = nfc15693.disablePrivacyMode(password);
175176
if (ISO15693_EC_OK == myrc) {
176-
Log_Println((char *) F("disabling privacy-mode successful"), LOGLEVEL_NOTICE);
177+
if (showDisablePrivacyNotification) {
178+
showDisablePrivacyNotification = false;
179+
Log_Println((char *) F("disabling privacy-mode successful"), LOGLEVEL_NOTICE);
180+
}
177181
}
178182
} else if (RFID_PN5180_NFC15693_STATE_GETINVENTORY == stateMachine) {
179183
// try to read ISO15693 inventory
@@ -226,6 +230,7 @@ extern unsigned long Rfid_LastRfidCheckTimestamp;
226230
}
227231

228232
memcpy(lastCardId, cardId, cardIdSize);
233+
showDisablePrivacyNotification = true;
229234

230235
#ifdef PAUSE_WHEN_RFID_REMOVED
231236
if (memcmp((const void *)lastValidcardId, (const void *)cardId, sizeof(cardId)) == 0) {

0 commit comments

Comments
 (0)