Skip to content

Commit 2a40016

Browse files
authored
Replaced pycrc with crc16 (#220)
1 parent b419eef commit 2a40016

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

dpsctl/dpsctl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
unpack_cal_report, unpack_query_response, unpack_version_response)
6161

6262
try:
63-
from PyCRC.CRCCCITT import CRCCCITT
63+
import crc16
6464
except ImportError:
65-
print("Missing dependency pycrc:")
66-
print(" sudo pip{} install pycrc"
65+
print("Missing dependency crc16:")
66+
print(" sudo pip{} install crc16"
6767
.format("3" if sys.version_info.major == 3 else ""))
6868
raise SystemExit()
6969
try:
@@ -616,7 +616,7 @@ def run_upgrade(comms, fw_file_name, args):
616616
content = file.read()
617617
if codecs.encode(content, 'hex')[6:8] != b'20' and not args.force:
618618
fail("The firmware file does not seem valid, use --force to force upgrade")
619-
crc = CRCCCITT().calculate(content)
619+
crc = crc16.crc16xmodem(content)
620620
chunk_size = 1024
621621
ret_dict = communicate(comms, create_upgrade_start(chunk_size, crc), args)
622622
if ret_dict["status"] == protocol.UPGRADE_CONTINUE:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
git+https://github.com/alexbutirskiy/PyCRC
1+
crc16==0.1.1
22
pyserial==3.4

0 commit comments

Comments
 (0)