From e0a0123d2f7f1039fe52f24591dff262b4f8935c Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 30 Jan 2014 15:26:06 +0100 Subject: 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. --- decoders/uart/pd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'decoders/uart') 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)]]) -- cgit v1.2.3-70-g09d2