Skip to content

Commit d3f192a

Browse files
committed
Read Ultralight block by block
1 parent 2c70dd5 commit d3f192a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/nfc/protocols/mf_ultralight/mf_ultralight_poller.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,16 +505,14 @@ static NfcCommand mf_ultralight_poller_handler_read_pages(MfUltralightPoller* in
505505
instance->error = mf_ultralight_poller_read_page(instance, start_page, &data);
506506
}
507507

508-
const uint8_t read_cnt = instance->data->type == MfUltralightTypeMfulC ? 1 : 4;
509508
if(instance->error == MfUltralightErrorNone) {
510-
for(size_t i = 0; i < read_cnt; i++) {
511-
if(start_page + i < instance->pages_total) {
512-
FURI_LOG_D(TAG, "Read page %d success", start_page + i);
513-
instance->data->page[start_page + i] = data.page[i];
514-
instance->pages_read++;
515-
instance->data->pages_read = instance->pages_read;
516-
}
517-
}
509+
if (start_page < instance->pages_total) {
510+
FURI_LOG_D(TAG, "Read page %d success", start_page);
511+
instance->data->page[start_page] = data.page[start_page];
512+
instance->pages_read++;
513+
instance->data->pages_read = instance->pages_read;
514+
}
515+
518516
if(instance->pages_read == instance->pages_total) {
519517
instance->state = MfUltralightPollerStateReadCounters;
520518
}

0 commit comments

Comments
 (0)