Emit annotations for the current IR frame as soon as possible, at the
very end of the STOP bit. Don't defer annotation emission until the
start of the next frame is seen. This unbreaks captures where the last
IR frame would not decode before.
[ gsi: rephrased commit message, updated comment in the implementation ]
(self.ir,) = self.wait({Pin.IR: 'e'})
if self.ir != active:
- # Save the non-active edge, then wait for the next edge.
+ # Save the location of the non-active edge (recessive),
+ # then wait for the next edge. Immediately process the
+ # end of the STOP bit which completes an IR frame.
self.ss_other_edge = self.samplenum
- continue
+ if self.state != 'STOP':
+ continue
# Reset internal state for long periods of idle level.
width = self.samplenum - self.ss_bit