diff options
author | Ben Gardiner <ben.l.gardiner@gmail.com> | 2020-11-22 20:40:44 +0000 |
---|---|---|
committer | Ben Gardiner <ben.l.gardiner@gmail.com> | 2020-11-22 20:40:57 +0000 |
commit | 45d3b17726ff9dae899dbd2b23d9b87f357558a8 (patch) | |
tree | 349a0afa79d8ae398565fe65a97a267cde9da9e4 /decoders | |
parent | 3f77dc2aae971c4ba97ad81c851c63b681074410 (diff) | |
download | libsigrokdecode-45d3b17726ff9dae899dbd2b23d9b87f357558a8.tar.gz libsigrokdecode-45d3b17726ff9dae899dbd2b23d9b87f357558a8.zip |
seven_segment: add option to display unknown characters
option show_unknown=yes will display unknown 7-segment characters as
an octothorpe ('#').
Signed-off-by: Ben Gardiner <ben.l.gardiner@gmail.com>
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/seven_segment/pd.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/decoders/seven_segment/pd.py b/decoders/seven_segment/pd.py index 87714bb..eedacf9 100644 --- a/decoders/seven_segment/pd.py +++ b/decoders/seven_segment/pd.py @@ -67,6 +67,8 @@ class Decoder(srd.Decoder): options = ( {'id': 'polarity', 'desc': 'Expected polarity', 'default': 'common-cathode', 'values': ('common-cathode', 'common-anode')}, + {'id': 'show_unknown', 'desc': 'Display Unknown characters as #', + 'default': 'no', 'values': ('yes', 'no')}, ) annotations = ( ('decoded-digit', 'Decoded digit'), @@ -120,6 +122,9 @@ class Decoder(srd.Decoder): # Convert to character string. digit = self.pins_to_hex(oldpins[:7]) + if digit is None and self.options['show_unknown'] == 'yes': + digit = '#' + if digit is not None: dp = oldpins[7] |