diff options
author | BenediktO <benedikt_o@web.de> | 2019-11-30 18:57:32 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2019-12-01 18:36:50 +0100 |
commit | 681bad2a4da0ba8c0c5fb76980cf8515e381750d (patch) | |
tree | db0f1208e06a254e31816f9c4279c5037f70e5b9 /decoders/ir_rc5 | |
parent | 88b84b3ce771a49680644c4a30819ccd90030018 (diff) | |
download | libsigrokdecode-681bad2a4da0ba8c0c5fb76980cf8515e381750d.tar.gz libsigrokdecode-681bad2a4da0ba8c0c5fb76980cf8515e381750d.zip |
ir_rc5: improved performance
Diffstat (limited to 'decoders/ir_rc5')
-rw-r--r-- | decoders/ir_rc5/pd.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/decoders/ir_rc5/pd.py b/decoders/ir_rc5/pd.py index e18a90b..e1c47b6 100644 --- a/decoders/ir_rc5/pd.py +++ b/decoders/ir_rc5/pd.py @@ -67,7 +67,7 @@ class Decoder(srd.Decoder): def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) - self.old_ir = 1 if self.options['polarity'] == 'active-low' else 0 + self.next_edge = 'l' if self.options['polarity'] == 'active-low' else 'h' def metadata(self, key, value): if key == srd.SRD_CONF_SAMPLERATE: @@ -143,11 +143,7 @@ class Decoder(srd.Decoder): raise SamplerateError('Cannot decode without samplerate.') while True: - (self.ir,) = self.wait() - - # Wait for any edge (rising or falling). - if self.old_ir == self.ir: - continue + (self.ir,) = self.wait({0: self.next_edge}) # State machine. if self.state == 'IDLE': @@ -155,7 +151,7 @@ class Decoder(srd.Decoder): self.edges.append(self.samplenum) self.bits.append([self.samplenum, bit]) self.state = 'MID1' - self.old_ir = self.ir + self.next_edge = 'l' if self.ir else 'h' continue edge = self.edge_type() if edge == 'e': @@ -184,4 +180,4 @@ class Decoder(srd.Decoder): self.handle_bits() self.reset_decoder_state() - self.old_ir = self.ir + self.next_edge = 'l' if self.ir else 'h' |