From 42f4888f1c9bae09f065974d80ebf0e683036c09 Mon Sep 17 00:00:00 2001 From: giraut <> Date: Mon, 21 Mar 2022 20:22:27 +0200 Subject: [PATCH] Encode ISO15693 response as tag byte by byte, instead of 2 bytes by 2 bytes, so that responses with an odd number of bytes don't end up encoded and transmitted with an extraneous uninitialized byte after the CRC. --- armsrc/iso15693.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index adba61be6..32a23d2e0 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -252,11 +252,9 @@ void CodeIso15693AsTag(const uint8_t *cmd, size_t len) { ts->buf[++ts->max] = 0x1D; // 00011101 // data - for (size_t i = 0; i < len; i += 2) { + for (size_t i = 0; i < len; i ++) { ts->buf[++ts->max] = encode_4bits[cmd[i] & 0xF]; ts->buf[++ts->max] = encode_4bits[cmd[i] >> 4]; - ts->buf[++ts->max] = encode_4bits[cmd[i + 1] & 0xF]; - ts->buf[++ts->max] = encode_4bits[cmd[i + 1] >> 4]; } // EOF