RC522 - Fix error counter error (#5873)

This commit is contained in:
Keith Burzinski 2023-12-05 02:21:12 -06:00 committed by GitHub
parent 7fd08fb816
commit 89d7cdf86b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -397,8 +397,10 @@ RC522::StatusCode RC522::await_transceive_() {
back_length_ = 0; back_length_ = 0;
ESP_LOGW(TAG, "Communication with the MFRC522 might be down, reset in %d", ESP_LOGW(TAG, "Communication with the MFRC522 might be down, reset in %d",
10 - error_counter_); // todo: trigger reset? 10 - error_counter_); // todo: trigger reset?
if (error_counter_++ > 10) if (error_counter_++ >= 10) {
setup(); setup();
error_counter_ = 0; // reset the error counter
}
return STATUS_TIMEOUT; return STATUS_TIMEOUT;
} }