Skip to content

Commit

Permalink
parser_pyx: build value maps for requied messages (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee authored Sep 8, 2023
1 parent 33c7097 commit 5386951
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions can/parser_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand All @@ -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([])

Expand Down

0 comments on commit 5386951

Please sign in to comment.