File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
adafruit_bluefruit_connect Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -94,24 +94,24 @@ def from_stream(cls, stream):
94
94
if not start :
95
95
# Timeout: nothing read.
96
96
return None
97
+
97
98
if start == b"!" :
98
99
# Found start of packet.
99
100
packet_type = stream .read (1 )
100
101
if not packet_type :
101
102
# Timeout: nothing more read.
102
103
return None
103
104
break
105
+
104
106
# Didn't find a packet start.
105
- else :
106
- text_packet_cls = cls ._type_to_class .get (b"TX" , None )
107
- # Is TextPacket registered?
108
- # If so, read an entire line and pass that to TextPacket.
109
- if text_packet_cls :
110
- ln = stream .readline ()
111
- packet = bytes (start + ln )
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.
115
115
116
116
header = bytes (start + packet_type )
117
117
packet_class = cls ._type_to_class .get (header , None )
You can’t perform that action at this time.
0 commit comments