From: Uwe Hermann Date: Fri, 5 May 2017 06:11:32 +0000 (+0200) Subject: microwire: Shorten decode() a bit. X-Git-Tag: libsigrokdecode-0.5.0~38 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=13c484ddd3156c70bb1257208bdae839e463a24e;hp=0e081655c049245c2215ed5fb14bcecdf57ca9df microwire: Shorten decode() a bit. --- diff --git a/decoders/microwire/pd.py b/decoders/microwire/pd.py index acda96b..e64732d 100644 --- a/decoders/microwire/pd.py +++ b/decoders/microwire/pd.py @@ -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,