esp-rfid icon indicating copy to clipboard operation
esp-rfid copied to clipboard

RC522 ,UID “0” maybe ignored

Open kkstun opened this issue 4 years ago • 1 comments

rfid.esp uid += String(mfrc522.uid.uidByte[i], HEX);

if uid is 1bec07ec , will be 1bec7ec . The "0x07" ->7

for (int i = 0; i < mfrc522.uid.size; ++i) { if(mfrc522.uid.uidByte[i] < 16) uid += "0"; uid += String(mfrc522.uid.uidByte[i], HEX); } work well

any other good idea?

kkstun avatar Feb 08 '21 04:02 kkstun

Good finding, maybe we should get rid of string conversion.

omersiar avatar Feb 10 '21 08:02 omersiar

I had not seen this issue and have added the same fix to the issue I rasied 466. They could both be combined and go with this fix or the one Hinkma suggested as a reply to 466 uid += String(mfrc522.uid.uidByte[mfrc522.uid.size - (i + 1)] < 0x10 ? "0" : ""); uid += String(mfrc522.uid.uidByte[mfrc522.uid.size - (i + 1)], HEX);

windy54 avatar Jan 19 '23 12:01 windy54

nice

kkstun avatar Feb 28 '23 01:02 kkstun