From c24625fae835cced6eeb40b39c88bf2bb4b3b6bb Mon Sep 17 00:00:00 2001 From: Methodius Date: Sun, 11 Feb 2024 04:45:07 +0900 Subject: [PATCH] 14_4a poller: send block max attempts increased --- lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c b/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c index 2065b81a2..45f427dc6 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c @@ -7,6 +7,7 @@ #define TAG "Iso14443_4aPoller" #define ISO14443_4A_FSDI_256 (0x8U) +#define ISO14443_4A_SEND_BLOCK_MAX_ATTEMPTS (20) Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance) { furi_assert(instance); @@ -88,7 +89,7 @@ Iso14443_4aError iso14443_4a_poller_send_block_pwt_ext( BitBuffer* rx_buffer) { furi_assert(instance); - uint8_t retry = 5; + uint8_t attempts_left = ISO14443_4A_SEND_BLOCK_MAX_ATTEMPTS; bit_buffer_reset(instance->tx_buffer); iso14443_4_layer_encode_block(instance->iso14443_4_layer, tx_buffer, instance->tx_buffer); @@ -103,6 +104,8 @@ Iso14443_4aError iso14443_4a_poller_send_block_pwt_ext( iso14443_4a_get_fwt_fc_max(instance->data)); if(iso14443_3a_error != Iso14443_3aErrorNone) { + FURI_LOG_T( + TAG, "Attempt: %u", ISO14443_4A_SEND_BLOCK_MAX_ATTEMPTS + 1 - attempts_left); FURI_LOG_RAW_T("RAW RX(%d):", bit_buffer_get_size_bytes(instance->rx_buffer)); for(size_t x = 0; x < bit_buffer_get_size_bytes(instance->rx_buffer); x++) { FURI_LOG_RAW_T("%02X ", bit_buffer_get_byte(instance->rx_buffer, x)); @@ -116,7 +119,7 @@ Iso14443_4aError iso14443_4a_poller_send_block_pwt_ext( error = iso14443_4_layer_decode_block_pwt_ext( instance->iso14443_4_layer, rx_buffer, instance->rx_buffer); if(error == Iso14443_4aErrorSendExtra) { - if(--retry == 0) break; + if(--attempts_left == 0) break; // Send response for Control message if(bit_buffer_get_size_bytes(rx_buffer)) bit_buffer_copy(instance->tx_buffer, rx_buffer);