Skip to content

Commit

Permalink
Replaced pycrc with crc16 (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanflo authored Jun 22, 2020
1 parent b419eef commit 2a40016
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions dpsctl/dpsctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
unpack_cal_report, unpack_query_response, unpack_version_response)

try:
from PyCRC.CRCCCITT import CRCCCITT
import crc16
except ImportError:
print("Missing dependency pycrc:")
print(" sudo pip{} install pycrc"
print("Missing dependency crc16:")
print(" sudo pip{} install crc16"
.format("3" if sys.version_info.major == 3 else ""))
raise SystemExit()
try:
Expand Down Expand Up @@ -616,7 +616,7 @@ def run_upgrade(comms, fw_file_name, args):
content = file.read()
if codecs.encode(content, 'hex')[6:8] != b'20' and not args.force:
fail("The firmware file does not seem valid, use --force to force upgrade")
crc = CRCCCITT().calculate(content)
crc = crc16.crc16xmodem(content)
chunk_size = 1024
ret_dict = communicate(comms, create_upgrade_start(chunk_size, crc), args)
if ret_dict["status"] == protocol.UPGRADE_CONTINUE:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
git+https://github.com/alexbutirskiy/PyCRC
crc16==0.1.1
pyserial==3.4

0 comments on commit 2a40016

Please sign in to comment.