Skip to content

Commit 9161d2e

Browse files
author
devoh747
authored
fixed C:484, 4:
Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
1 parent b1bc7fc commit 9161d2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_sdcard.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ def calculate_crc(message):
481481
crc_table[i] = crc_table[i] ^ crc_poly
482482

483483
crc = 0
484-
for i in range(len(message)):
484+
# All messages in _cmd are 5 bytes including the cmd.. The 6th byte is the crc value.
485+
for i in range(0, 5):
485486
crc = crc_table[(crc << 1) ^ message[i]]
486487

487488
return ((crc << 1) | 1)

0 commit comments

Comments
 (0)