diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2013-09-12 09:32:28 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2013-09-12 15:56:06 +0200 |
commit | 1f224555348ff440bdbd7014f66ac5ce44eb4d27 (patch) | |
tree | 9e88e269a8f24c112ad83ad205da6f90c27e04fb /decoders/uart | |
parent | 3a1803b09807eafba04c5e9fb0110d1c0d9f0eaf (diff) | |
download | libsigrokdecode-1f224555348ff440bdbd7014f66ac5ce44eb4d27.tar.gz libsigrokdecode-1f224555348ff440bdbd7014f66ac5ce44eb4d27.zip |
uart: Use same length for data output in all cases.
Until now you could get e.g. "d" or "df" as hex output from the UART PD.
This will now be a common-length "0D" and "DF". When all data byte
annotations are of the same lengths the readability in GUI traces is a lot
better. Also, hardcode hex characters to be upper-case (for now).
The same applies to oct ("021" instead of "21") and bin output
("00001001" instead of "1001").
Diffstat (limited to 'decoders/uart')
-rw-r--r-- | decoders/uart/pd.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index 5a6dfc0..e67da57 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -227,11 +227,11 @@ class Decoder(srd.Decoder): elif f == 'dec': self.putx(rxtx, [0, [s + str(b)]]) elif f == 'hex': - self.putx(rxtx, [0, [s + hex(b)[2:]]]) + self.putx(rxtx, [0, [s + hex(b)[2:].zfill(2).upper()]]) elif f == 'oct': - self.putx(rxtx, [0, [s + oct(b)[2:]]]) + self.putx(rxtx, [0, [s + oct(b)[2:].zfill(3)]]) elif f == 'bin': - self.putx(rxtx, [0, [s + bin(b)[2:]]]) + self.putx(rxtx, [0, [s + bin(b)[2:].zfill(8)]]) else: raise Exception('Invalid data format option: %s' % f) |