]> sigrok.org Git - libsigrokdecode.git/commitdiff
ook_vis: Minor code simplifications.
authorUwe Hermann <redacted>
Tue, 11 Sep 2018 19:44:40 +0000 (21:44 +0200)
committerUwe Hermann <redacted>
Tue, 11 Sep 2018 21:44:21 +0000 (23:44 +0200)
decoders/ook_vis/pd.py

index 9bbd37fdf1fd13032bfb60ac34a14870fa8368b3..37853319a358276912a18b7187a07cb0cf105edd 100644 (file)
@@ -113,8 +113,7 @@ class Decoder(srd.Decoder):
 
             if len(ook) >= preamble_end:
                 preamble_end += int(self.sync_offset) - 1
-                self.ss = ook[0][0]
-                self.es = ook[preamble_end][1]
+                self.ss, self.es = ook[0][0], ook[preamble_end][1]
                 self.putx([line, ['Preamble', 'Pre', 'P']])
                 self.decode_pos += preamble_end
 
@@ -149,10 +148,7 @@ class Decoder(srd.Decoder):
         ook = self.decoded
         for i in range(len(ook)):
             self.ookstring += ook[i][2]
-        if 'Nibble' in self.displayas:
-            bits = 4
-        else:
-            bits = 8
+        bits = 4 if 'Nibble' in self.displayas else 8
         rem_nibbles = len(self.ookstring) // bits
         for i in range(rem_nibbles): # Display the rest of the nibbles.
             self.ss = ook[self.decode_pos][0]