Skip to content

Commit

Permalink
Merge pull request #14 from jerryneedell/jerryn_unpack
Browse files Browse the repository at this point in the history
fix struct unpack issue
  • Loading branch information
ladyada committed Feb 27, 2020
2 parents fad9710 + 2ed1d18 commit aad0b23
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions adafruit_bluefruitspi.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _cmd(self, cmd): # pylint: disable=too-many-branches
spi.readinto(self._buf_rx)

# Read the message envelope and contents
msgtype, rspid, rsplen = struct.unpack('>BHB', self._buf_rx)
msgtype, rspid, rsplen = struct.unpack('>BHB', self._buf_rx[0:4])
if rsplen >= 16:
rsp += self._buf_rx[4:20]
else:
Expand Down Expand Up @@ -242,8 +242,7 @@ def command(self, string):
raise RuntimeError("Error (id:{0})".format(hex(msgid)))
if msgtype == _MSG_RESPONSE:
return rsp
else:
raise RuntimeError("Unknown response (id:{0})".format(hex(msgid)))
raise RuntimeError("Unknown response (id:{0})".format(hex(msgid)))
except RuntimeError as error:
raise RuntimeError("AT command failure: " + repr(error))

Expand Down

0 comments on commit aad0b23

Please sign in to comment.