From 45d3b17726ff9dae899dbd2b23d9b87f357558a8 Mon Sep 17 00:00:00 2001 From: Ben Gardiner Date: Sun, 22 Nov 2020 20:40:44 +0000 Subject: 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 --- decoders/seven_segment/pd.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'decoders/seven_segment') 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] -- cgit v1.2.3-70-g09d2