]> sigrok.org Git - libsigrokdecode.git/commitdiff
seven_segment: Simplify two code snippets.
authorUwe Hermann <redacted>
Wed, 6 Nov 2019 22:41:48 +0000 (23:41 +0100)
committerUwe Hermann <redacted>
Wed, 6 Nov 2019 22:57:53 +0000 (23:57 +0100)
decoders/seven_segment/pd.py

index 26d1d83b294bb48a61ab26d9f58456ef45bb08f4..87714bbcd81483df06817f9aa374c0b31d2bd293 100644 (file)
@@ -88,10 +88,7 @@ class Decoder(srd.Decoder):
         self.put(ss_block, es_block, self.out_ann, data)
 
     def pins_to_hex(self, pins):
-        if pins in digits:
-            return digits[pins]
-        else:
-            return None
+        return digits.get(pins, None)
 
     def decode(self):
         oldpins = self.wait()
@@ -127,9 +124,8 @@ class Decoder(srd.Decoder):
                 dp = oldpins[7]
 
                 # Check if decimal point is present and active.
-                if self.have_dp:
-                    if dp == 1:
-                        digit = digit + '.'
+                if self.have_dp and dp == 1:
+                    digit += '.'
 
                 self.putb(lastpos, self.samplenum, [0, [digit]])