diff options
Diffstat (limited to 'decoders/lin/pd.py')
-rw-r--r-- | decoders/lin/pd.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/decoders/lin/pd.py b/decoders/lin/pd.py index e0340fc..e1b6d1b 100644 --- a/decoders/lin/pd.py +++ b/decoders/lin/pd.py @@ -150,7 +150,7 @@ class Decoder(srd.Decoder): checksum = self.lin_rsp.pop() if len(self.lin_rsp) else None if pid: - id = pid[2] & 0x3F + id_ = pid[2] & 0x3F parity = pid[2] >> 6 expected_parity = self.calc_parity(pid[2]) @@ -161,8 +161,8 @@ class Decoder(srd.Decoder): ann_class = 0 if parity_valid else 3 self.put(pid[0], pid[1], self.out_ann, [ann_class, [ - 'ID: %02X Parity: %d (%s)' % (id, parity, 'ok' if parity_valid else 'bad'), - 'ID: 0x%02X' % id, 'I: %d' % id + 'ID: %02X Parity: %d (%s)' % (id_, parity, 'ok' if parity_valid else 'bad'), + 'ID: 0x%02X' % id_, 'I: %d' % id_ ]]) if len(self.lin_rsp): @@ -188,9 +188,9 @@ class Decoder(srd.Decoder): def checksum_is_valid(self, pid, data, checksum): if self.lin_version == 2: - id = pid & 0x3F + id_ = pid & 0x3F - if id != 60 and id != 61: + if id_ != 60 and id_ != 61: checksum += pid for d in data: @@ -203,10 +203,10 @@ class Decoder(srd.Decoder): @staticmethod def calc_parity(pid): - id = [((pid & 0x3F) >> i) & 1 for i in range(8)] + id_ = [((pid & 0x3F) >> i) & 1 for i in range(8)] - p0 = id[0] ^ id[1] ^ id[2] ^ id[4] - p1 = not (id[1] ^ id[3] ^ id[4] ^ id[5]) + p0 = id_[0] ^ id_[1] ^ id_[2] ^ id_[4] + p1 = not (id_[1] ^ id_[3] ^ id_[4] ^ id_[5]) return (p0 << 0) | (p1 << 1) |