14_4a poller: send block max attempts increased

This commit is contained in:
Methodius 2024-02-11 04:45:07 +09:00
parent c35f258ab8
commit c24625fae8
No known key found for this signature in database
GPG Key ID: 122FA99A00B41679

View File

@ -7,6 +7,7 @@
#define TAG "Iso14443_4aPoller" #define TAG "Iso14443_4aPoller"
#define ISO14443_4A_FSDI_256 (0x8U) #define ISO14443_4A_FSDI_256 (0x8U)
#define ISO14443_4A_SEND_BLOCK_MAX_ATTEMPTS (20)
Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance) { Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance) {
furi_assert(instance); furi_assert(instance);
@ -88,7 +89,7 @@ Iso14443_4aError iso14443_4a_poller_send_block_pwt_ext(
BitBuffer* rx_buffer) { BitBuffer* rx_buffer) {
furi_assert(instance); furi_assert(instance);
uint8_t retry = 5; uint8_t attempts_left = ISO14443_4A_SEND_BLOCK_MAX_ATTEMPTS;
bit_buffer_reset(instance->tx_buffer); bit_buffer_reset(instance->tx_buffer);
iso14443_4_layer_encode_block(instance->iso14443_4_layer, tx_buffer, 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)); iso14443_4a_get_fwt_fc_max(instance->data));
if(iso14443_3a_error != Iso14443_3aErrorNone) { 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)); 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++) { 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)); 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( error = iso14443_4_layer_decode_block_pwt_ext(
instance->iso14443_4_layer, rx_buffer, instance->rx_buffer); instance->iso14443_4_layer, rx_buffer, instance->rx_buffer);
if(error == Iso14443_4aErrorSendExtra) { if(error == Iso14443_4aErrorSendExtra) {
if(--retry == 0) break; if(--attempts_left == 0) break;
// Send response for Control message // Send response for Control message
if(bit_buffer_get_size_bytes(rx_buffer)) if(bit_buffer_get_size_bytes(rx_buffer))
bit_buffer_copy(instance->tx_buffer, rx_buffer); bit_buffer_copy(instance->tx_buffer, rx_buffer);