diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2014-03-05 23:34:50 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2014-03-05 23:34:50 +0100 |
commit | 92d992d2e50a1996fa2f436f5217b5a9fb3b7e62 (patch) | |
tree | 794704dc6e199672313050c78833525d5d0a187d | |
parent | 914f0b99d1f07c351742eaa5c8e397d601996846 (diff) | |
download | libsigrokdecode-92d992d2e50a1996fa2f436f5217b5a9fb3b7e62.tar.gz libsigrokdecode-92d992d2e50a1996fa2f436f5217b5a9fb3b7e62.zip |
ir_rc5: Only determine edge type once.
-rw-r--r-- | decoders/ir_rc5/pd.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/decoders/ir_rc5/pd.py b/decoders/ir_rc5/pd.py index 1abba82..25a4576 100644 --- a/decoders/ir_rc5/pd.py +++ b/decoders/ir_rc5/pd.py @@ -145,20 +145,21 @@ class Decoder(srd.Decoder): self.state = 'MID1' self.old_ir = self.ir continue + edge = self.edge_type() if self.state == 'MID1': - self.state = 'START1' if self.edge_type() == 's' else 'MID0' - bit = None if self.edge_type() == 's' else 0 + self.state = 'START1' if edge == 's' else 'MID0' + bit = None if edge == 's' else 0 elif self.state == 'MID0': - self.state = 'START0' if self.edge_type() == 's' else 'MID1' - bit = None if self.edge_type() == 's' else 1 + self.state = 'START0' if edge == 's' else 'MID1' + bit = None if edge == 's' else 1 elif self.state == 'START1': - if self.edge_type() == 's': + if edge == 's': self.state = 'MID1' - bit = 1 if self.edge_type() == 's' else None + bit = 1 if edge == 's' else None elif self.state == 'START0': - if self.edge_type() == 's': + if edge == 's': self.state = 'MID0' - bit = 0 if self.edge_type() == 's' else None + bit = 0 if edge == 's' else None else: raise Exception('Invalid state: %s' % self.state) |