Fix AccessControl.ino (#353)

* Fix AccessControl.ino

The function checkTwo not work with some cards with 0-index key ID equals to 0 not found in storeCard..then they add fullstack of the same card.
This commit is contained in:
thoaitrieu
2018-01-13 17:00:58 +07:00
committed by Rotzbua
parent fdb1090516
commit 1e9ca23890

View File

@@ -429,19 +429,13 @@ void deleteID( byte a[] ) {
}
///////////////////////////////////////// Check Bytes ///////////////////////////////////
boolean checkTwo ( byte a[], byte b[] ) {
if ( a[0] != 0 ) // Make sure there is something in the array first
match = true; // Assume they match at first
boolean checkTwo ( byte a[], byte b[] ) {
for ( uint8_t k = 0; k < 4; k++ ) { // Loop 4 times
if ( a[k] != b[k] ) // IF a != b then set match = false, one fails, all fail
match = false;
}
if ( match ) { // Check to see if if match is still true
return true; // Return true
}
else {
return false; // Return false
if ( a[k] != b[k] ) { // IF a != b then set match = false, one fails, all fail
return false;
}
}
return true;
}
///////////////////////////////////////// Find Slot ///////////////////////////////////