From 544038d90e05c03f6f914c7771ee52dd85784ca8 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Mon, 14 Sep 2015 19:05:54 +0200 Subject: can: Improve stuff bit annotation placement. --- decoders/can/pd.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'decoders/can/pd.py') 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: -- cgit v1.2.3-70-g09d2