From c69c15b1bee682c5ba26073b6c1ba3a62f7aa37c Mon Sep 17 00:00:00 2001 From: deanlee Date: Wed, 6 Sep 2023 14:49:46 +0800 Subject: [PATCH] less keys --- can/parser_pyx.pyx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/can/parser_pyx.pyx b/can/parser_pyx.pyx index 81d3e06ff4..808610e87a 100644 --- a/can/parser_pyx.pyx +++ b/can/parser_pyx.pyx @@ -46,13 +46,6 @@ cdef class CANParser: msg_name_to_address[name] = msg.address address_to_msg_name[msg.address] = name - self.vl[msg.address] = {} - self.vl[name] = self.vl[msg.address] - self.vl_all[msg.address] = {} - self.vl_all[name] = self.vl_all[msg.address] - self.ts_nanos[msg.address] = {} - self.ts_nanos[name] = self.ts_nanos[msg.address] - # Convert message names into addresses and check existence in DBC cdef vector[pair[uint32_t, int]] message_v for i in range(len(messages)): @@ -62,6 +55,14 @@ cdef class CANParser: raise RuntimeError(f"could not find message {repr(c[0])} in DBC {self.dbc_name}") message_v.push_back((address, c[1])) + name = address_to_msg_name[address] + self.vl[address] = {} + self.vl[name] = self.vl[address] + self.vl_all[address] = {} + self.vl_all[name] = self.vl_all[address] + self.ts_nanos[address] = {} + self.ts_nanos[name] = self.ts_nanos[address] + self.can = new cpp_CANParser(bus, dbc_name, message_v) self.update_strings([])