From: Ben Gardiner Date: Sun, 22 Nov 2020 20:40:44 +0000 (+0000) Subject: seven_segment: add option to display unknown characters X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=45d3b17726ff9dae899dbd2b23d9b87f357558a8;p=libsigrokdecode.git 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 --- 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]