From: Uwe Hermann Date: Thu, 30 Jan 2014 14:26:06 +0000 (+0100) Subject: uart: Better fix for ASCII output. X-Git-Tag: libsigrokdecode-0.3.0~145 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e0a0123d2f7f1039fe52f24591dff262b4f8935c;p=libsigrokdecode.git uart: Better fix for ASCII output. This is a temporary thing, later there'll be some facility to let frontends handle any annotations marked as "this is a number" (as opposed to "this is a string") in a generic manner and display them in any supported (by that frontend) format, e.g. ascii, hex, oct, decimal, binary, big-endian vs. little-endian, and so on. This is a fix related to #201. --- diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index f1c8323..00be94b 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -230,7 +230,7 @@ class Decoder(srd.Decoder): b, f = self.databyte[rxtx], self.options['format'] if f == 'ascii': - c = chr(b) if chr(b).isprintable() else '[%02X]' % b + c = chr(b) if b in range(30, 126 + 1) else '[%02X]' % b self.putx(rxtx, [rxtx, [c]]) elif f == 'dec': self.putx(rxtx, [rxtx, [str(b)]])