]> sigrok.org Git - libsigrokdecode.git/commitdiff
microwire: Shorten decode() a bit.
authorUwe Hermann <redacted>
Fri, 5 May 2017 06:11:32 +0000 (08:11 +0200)
committerUwe Hermann <redacted>
Fri, 5 May 2017 17:19:26 +0000 (19:19 +0200)
decoders/microwire/pd.py

index acda96b65daa3f401df0ba4e8589d40cd83eba2e..e64732d5ee9259f44879ff434edb08ef411a662e 100644 (file)
@@ -89,10 +89,8 @@ class Decoder(srd.Decoder):
                 packet.append({'samplenum': self.samplenum,
                               'matched': self.matched,
                               'cs': cs, 'sk': sk, 'si': si, 'so': so})
-                if sk == 0:
-                    cs, sk, si, so = self.wait([{0: 'l'}, {1: 'r'}, {3: 'e'}])
-                else:
-                    cs, sk, si, so = self.wait([{0: 'l'}, {1: 'f'}, {3: 'e'}])
+                edge = 'r' if sk == 0 else 'f'
+                cs, sk, si, so = self.wait([{0: 'l'}, {1: edge}, {3: 'e'}])
             # Save last change.
             packet.append({'samplenum': self.samplenum,
                           'matched': self.matched,