Skip to content

Commit aad0b23

Browse files
authored
Merge pull request #14 from jerryneedell/jerryn_unpack
fix struct unpack issue
2 parents fad9710 + 2ed1d18 commit aad0b23

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

adafruit_bluefruitspi.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _cmd(self, cmd): # pylint: disable=too-many-branches
179179
spi.readinto(self._buf_rx)
180180

181181
# Read the message envelope and contents
182-
msgtype, rspid, rsplen = struct.unpack('>BHB', self._buf_rx)
182+
msgtype, rspid, rsplen = struct.unpack('>BHB', self._buf_rx[0:4])
183183
if rsplen >= 16:
184184
rsp += self._buf_rx[4:20]
185185
else:
@@ -242,8 +242,7 @@ def command(self, string):
242242
raise RuntimeError("Error (id:{0})".format(hex(msgid)))
243243
if msgtype == _MSG_RESPONSE:
244244
return rsp
245-
else:
246-
raise RuntimeError("Unknown response (id:{0})".format(hex(msgid)))
245+
raise RuntimeError("Unknown response (id:{0})".format(hex(msgid)))
247246
except RuntimeError as error:
248247
raise RuntimeError("AT command failure: " + repr(error))
249248

0 commit comments

Comments
 (0)