From 9e953ff151c5d714dd57ec81eb402ec1d77ab8e7 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 6 Nov 2019 23:41:48 +0100 Subject: seven_segment: Simplify two code snippets. --- decoders/seven_segment/pd.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'decoders/seven_segment') diff --git a/decoders/seven_segment/pd.py b/decoders/seven_segment/pd.py index 26d1d83..87714bb 100644 --- a/decoders/seven_segment/pd.py +++ b/decoders/seven_segment/pd.py @@ -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]]) -- cgit v1.2.3-70-g09d2