Skip to content

Commit

Permalink
Support python-can 2.1 flag format
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkarlsson committed Mar 5, 2018
1 parent 912f968 commit c29e1f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tool/modules/send.py
Expand Up @@ -98,7 +98,7 @@ def parse_pythoncan_line(curr_line, prev_timestamp=None):
:param prev_timestamp: datetime object containing timestamp of previous message (to calculate delay)
:return: CanMessage representing 'curr_line', datetime.datetime timestamp of 'curr_line'
"""
line_regex = re.compile(r"Timestamp: (?P<timestamp>\d+\.\d+) +ID: (?P<arb_id>[0-9a-fA-F]+) + \d+ +"
line_regex = re.compile(r"Timestamp: (?P<timestamp>\d+\.\d+) +ID: (?P<arb_id>[0-9a-fA-F]+) + \w+ +"
r"DLC: [0-8] +(?P<data>(?:[0-9a-fA-F]{2} ?){0,8})")
parsed_msg = line_regex.match(curr_line)
arb_id = int(parsed_msg.group("arb_id"), 16)
Expand Down

1 comment on commit c29e1f9

@kasperkarlsson
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Message flags in python-can have been changed from binary to letter code format. See examples below:

Old format:

Timestamp: 1520243311.052827    ID: 00000033    010    DLC: 8    00 c9 00 00 00 00 00 01
Timestamp: 1520243312.052694    ID: 00000033    010    DLC: 8    00 d3 00 00 00 00 00 02
Timestamp: 1520243313.052506    ID: 00000033    010    DLC: 8    00 dd 00 00 00 00 00 03

New format:

Timestamp: 1520243336.049232    ID: 00000033    X          DLC: 8    00 c9 00 00 00 00 00 01
Timestamp: 1520243337.049055    ID: 00000033    X          DLC: 8    00 d3 00 00 00 00 00 02
Timestamp: 1520243338.048918    ID: 00000033    X          DLC: 8    00 dd 00 00 00 00 00 03

Please sign in to comment.