File tree 1 file changed +8
-11
lines changed
1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -237,23 +237,20 @@ def read(self) -> None:
237
237
# Consume from PulseIn.
238
238
while self .pulses :
239
239
pulse = self .pulses .popleft ()
240
- self ._unparsed_pulses .append (pulse )
241
- if pulse > self .max_pulse :
240
+ if pulse <= self .max_pulse :
241
+ self ._unparsed_pulses .append (pulse )
242
+ else :
242
243
# End of message! Decode it and yield a BaseIRMessage.
244
+ result = None
243
245
try :
244
- yield decode_bits (self ._unparsed_pulses )
246
+ result = decode_bits (self ._unparsed_pulses )
245
247
except FailedToDecode as err :
246
248
# If you want to debug failed decodes, this would be a good
247
249
# place to print/log or (re-)raise.
248
- unparseable_message = err .args [0 ]
249
- yield unparseable_message
250
+ result = err .args [0 ]
251
+
250
252
self ._unparsed_pulses .clear ()
251
- # TODO Do we need to consume and throw away more pulses here?
252
- # I'm unclear about the role that "pruning" plays in the
253
- # original implementation in GenericDecode._read_pulses_non_blocking.
254
- # When we reach here, we have consumed everything from PulseIn.
255
- # If there are some pulses in self._unparsed_pulses, they represent
256
- # partial messages. We'll finish them next time read() is called.
253
+ yield result
257
254
258
255
259
256
class GenericDecode :
You can’t perform that action at this time.
0 commit comments