1
0
Fork 0

RFID: Fix buffer size for writes

The RFID library expects a 16 bytes buffer for writing blocks.
However, we re-use the 18 bytes buffer needed for reading blocks.
Properly remove those two extra bytes when writing blocks.
This commit is contained in:
Teo-CD 2024-03-05 23:54:24 +00:00
parent 5618f52a0e
commit c92c8ce11f

View file

@ -161,7 +161,8 @@ bool RFID::writeBlock(MFRC522Constants::Uid &uidToRead, byte blockAddr, uint8_t
return false;
}
byte size = sizeof(comData);
// Take into account the two bytes used only for the read commands.
byte size = sizeof(comData) - 2;
for (byte& bufferByte: comData)
bufferByte = 0;