abobija / esp-idf-rc522

ESP-IDF component for communication with MFRC522 RFID scanner
https://components.espressif.com/components/abobija/rc522
MIT License
135 stars 39 forks source link

Different Serials #23

Open amoopoori opened 10 months ago

amoopoori commented 10 months ago

Hello, I read an RFID card using this library and received the value 1007534008355, which in hexadecimal is EA 95B4 E823. However, when I read the same card with the Arduino library, it provides the following value: 95 B4 E8 23. How can I convert these values to each other?

Spritetm commented 3 months ago

For anyone else reading this: it's likely a bug in the library in rc522_sn_to_u64; the original code tries to parse 5 bytes out of a 4-byte serial number. From what I can tell, for(int i = 4; i >= 0; i--) { should be changed to for(int i = 3; i >= 0; i--) {