From: Uwe Hermann Date: Mon, 14 Sep 2015 17:05:54 +0000 (+0200) Subject: can: Improve stuff bit annotation placement. X-Git-Tag: libsigrokdecode-0.4.0~60 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=544038d90e05c03f6f914c7771ee52dd85784ca8;p=libsigrokdecode.git can: Improve stuff bit annotation placement. --- 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: