summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decoders/uart/pd.py6
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)