diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2019-11-06 23:41:48 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2019-11-06 23:57:53 +0100 |
commit | 9e953ff151c5d714dd57ec81eb402ec1d77ab8e7 (patch) | |
tree | c9e318322f3c7c6f457eb58bafe18d1c8580875a /decoders | |
parent | d196b84b1df8130b59b6650c0ee11be0953bb3cd (diff) | |
download | libsigrokdecode-9e953ff151c5d714dd57ec81eb402ec1d77ab8e7.tar.gz libsigrokdecode-9e953ff151c5d714dd57ec81eb402ec1d77ab8e7.zip |
seven_segment: Simplify two code snippets.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/seven_segment/pd.py | 10 |
1 files changed, 3 insertions, 7 deletions
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]]) |