Cleaned up code
This commit is contained in:
17
MFRC522.py
17
MFRC522.py
@@ -287,7 +287,6 @@ class MFRC522:
|
||||
(status, backData, backLen) = self.ToCard(self.PCD_TRANSCEIVE, buf)
|
||||
|
||||
if (status == self.MI_OK) and (backLen == 0x18):
|
||||
# print "Size: " + str(backData[0])
|
||||
return backData[0]
|
||||
else:
|
||||
return 0
|
||||
@@ -316,12 +315,6 @@ class MFRC522:
|
||||
# Now we start the authentication itself
|
||||
(status, backData, backLen) = self.ToCard(self.PCD_AUTHENT,buff)
|
||||
|
||||
# Check if an error occurred
|
||||
# if not(status == self.MI_OK):
|
||||
# print("AUTH ERROR!!")
|
||||
# if not (self.Read_MFRC522(self.Status2Reg) & 0x08) != 0:
|
||||
# print("AUTH ERROR(status2reg & 0x08) != 0")
|
||||
|
||||
# Return the status
|
||||
return status
|
||||
|
||||
@@ -339,10 +332,7 @@ class MFRC522:
|
||||
if not(status == self.MI_OK):
|
||||
print("Error while reading!")
|
||||
i = 0
|
||||
# if len(backData) == 16:
|
||||
return backData
|
||||
# else:
|
||||
# return None
|
||||
|
||||
def Write(self, blockAddr, writeData):
|
||||
buff = []
|
||||
@@ -354,7 +344,6 @@ class MFRC522:
|
||||
(status, backData, backLen) = self.ToCard(self.PCD_TRANSCEIVE, buff)
|
||||
if not(status == self.MI_OK) or not(backLen == 4) or not((backData[0] & 0x0F) == 0x0A):
|
||||
status = self.MI_ERR
|
||||
# print str(backLen)+" backdata &0x0F == 0x0A "+str(backData[0]&0x0F)
|
||||
if status == self.MI_OK:
|
||||
i = 0
|
||||
buf = []
|
||||
@@ -365,10 +354,8 @@ class MFRC522:
|
||||
buf.append(crc[0])
|
||||
buf.append(crc[1])
|
||||
(status, backData, backLen) = self.ToCard(self.PCD_TRANSCEIVE,buf)
|
||||
# if not(status == self.MI_OK) or not(backLen == 4) or not((backData[0] & 0x0F) == 0x0A):
|
||||
# print("Error while writing")
|
||||
# if status == self.MI_OK:
|
||||
# print "Data written"
|
||||
if not(status == self.MI_OK) or not(backLen == 4) or not((backData[0] & 0x0F) == 0x0A):
|
||||
status = self.MI_ERR
|
||||
return status
|
||||
|
||||
def DumpClassic1K(self, key, uid):
|
||||
|
||||
Reference in New Issue
Block a user