summaryrefslogtreecommitdiff
path: root/decoders/can
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2015-09-14 19:05:54 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2015-09-14 19:05:54 +0200
commit544038d90e05c03f6f914c7771ee52dd85784ca8 (patch)
tree18dedabb81fb990fa5882a91aae45be734935e81 /decoders/can
parentd4a28d0fb6e1380590564be2b47ba3642130555b (diff)
downloadlibsigrokdecode-544038d90e05c03f6f914c7771ee52dd85784ca8.tar.gz
libsigrokdecode-544038d90e05c03f6f914c7771ee52dd85784ca8.zip
can: Improve stuff bit annotation placement.
Diffstat (limited to 'decoders/can')
-rw-r--r--decoders/can/pd.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/decoders/can/pd.py b/decoders/can/pd.py
index 7638c2f..ffc3652 100644
--- a/decoders/can/pd.py
+++ b/decoders/can/pd.py
@@ -57,11 +57,11 @@ class Decoder(srd.Decoder):
('ack-delimiter', 'ACK delimiter'),
('stuff-bit', 'Stuff bit'),
('warnings', 'Human-readable warnings'),
- ('bits', 'Bits'),
+ ('bit', 'Bit'),
)
annotation_rows = (
- ('bits', 'Bits', (17,)),
- ('fields', 'Fields', tuple(range(17))),
+ ('bits', 'Bits', (15, 17)),
+ ('fields', 'Fields', tuple(range(15)) + (16,)),
)
def __init__(self, **kwargs):
@@ -120,8 +120,6 @@ class Decoder(srd.Decoder):
return False
# Stuff bit. Keep it in self.rawbits, but drop it from self.bits.
- self.putx([15, ['Stuff bit: %d' % self.rawbits[-1],
- 'SB: %d' % self.rawbits[-1], 'SB']])
self.bits.pop() # Drop last bit.
return True
@@ -310,13 +308,13 @@ class Decoder(srd.Decoder):
# Get the index of the current CAN frame bit (without stuff bits).
bitnum = len(self.bits) - 1
- # Emit a bit value annotation.
- self.putx([17, [str(can_rx)]])
-
# If this is a stuff bit, remove it from self.bits and ignore it.
if self.is_stuff_bit():
+ self.putx([15, [str(can_rx)]])
self.curbit += 1 # Increase self.curbit (bitnum is not affected).
return
+ else:
+ self.putx([17, [str(can_rx)]])
# Bit 0: Start of frame (SOF) bit
if bitnum == 0: