From: Uwe Hermann Date: Wed, 11 Sep 2013 17:53:31 +0000 (+0200) Subject: uart: Don't prefix databyte output numbers. X-Git-Tag: libsigrokdecode-0.3.0~327 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=9300bc22bad033204d369884b0f548b1e2a9bc59;hp=83be7b8384e0dc20b84de831e5922fb9c6d0762d uart: Don't prefix databyte output numbers. Previously the output was 0x41 or 0o101 or 0b1000001, now it is 41 or 101 or 1000001. We drop these prefixes, since they decrease the readability of the PD output (especially when displayed in GUIs) and are not needed anyway since the user knowingly selected the number format before running the respective PD. --- diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index cca8952..c0968fb 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -206,14 +206,12 @@ class Decoder(srd.Decoder): self.putp(['DATA', rxtx, self.databyte[rxtx]]) s = 'RX: ' if (rxtx == RX) else 'TX: ' - self.putx(rxtx, [ANN_ASCII, [s + chr(self.databyte[rxtx])]]) - self.putx(rxtx, [ANN_DEC, [s + str(self.databyte[rxtx])]]) - self.putx(rxtx, [ANN_HEX, [s + hex(self.databyte[rxtx]), - s + hex(self.databyte[rxtx])[2:]]]) - self.putx(rxtx, [ANN_OCT, [s + oct(self.databyte[rxtx]), - s + oct(self.databyte[rxtx])[2:]]]) - self.putx(rxtx, [ANN_BITS, [s + bin(self.databyte[rxtx]), - s + bin(self.databyte[rxtx])[2:]]]) + b = self.databyte[rxtx] + self.putx(rxtx, [ANN_ASCII, [s + chr(b)]]) + self.putx(rxtx, [ANN_DEC, [s + str(b)]]) + self.putx(rxtx, [ANN_HEX, [s + hex(b)[2:]]]) + self.putx(rxtx, [ANN_OCT, [s + oct(b)[2:]]]) + self.putx(rxtx, [ANN_BITS, [s + bin(b)[2:]]]) def get_parity_bit(self, rxtx, signal): # If no parity is used/configured, skip to the next state immediately.