Skip to content

Commit a4625c2

Browse files
committed
Add support for a TextPacket, as sent using the UART module in the AdaFruit BlueTooth app
1 parent c9d2b4d commit a4625c2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

adafruit_bluefruit_connect/packet.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ def from_stream(cls, stream):
104104
break
105105

106106
# Didn't find a packet start.
107-
text_packet_cls = cls._type_to_class.get(b"TX", None)
108-
# Is TextPacket registered?
109-
# If so, read an entire line and pass that to TextPacket.
110-
if text_packet_cls:
111-
packet = bytes(start + stream.readline())
112-
return text_packet_cls(packet)
113-
114-
# else loop and try again.
107+
text_packet_cls = cls._type_to_class.get(b"TX", None)
108+
# Is TextPacket registered?
109+
# If so, read an entire line and pass that to TextPacket.
110+
if text_packet_cls:
111+
packet = bytes(start + stream.readline())
112+
return text_packet_cls(packet)
113+
114+
# else loop and try again.
115115

116116
header = bytes(start + packet_type)
117117
packet_class = cls._type_to_class.get(header, None)

0 commit comments

Comments
 (0)