Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions can/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def __init__( # pylint: disable=too-many-locals, too-many-arguments
def __str__(self) -> str:
field_strings = [f"Timestamp: {self.timestamp:>15.6f}"]
if self.is_extended_id:
arbitration_id_string = f"ID: {self.arbitration_id:08x}"
arbitration_id_string = f"{self.arbitration_id:08x}"
else:
arbitration_id_string = f"ID: {self.arbitration_id:04x}"
field_strings.append(arbitration_id_string.rjust(12, " "))
arbitration_id_string = f"{self.arbitration_id:03x}"
field_strings.append(f"ID: {arbitration_id_string:>8}")

flag_string = " ".join(
[
Expand Down
4 changes: 2 additions & 2 deletions doc/message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Message
2\ :sup:`29` - 1 for 29-bit identifiers).

>>> print(Message(is_extended_id=False, arbitration_id=100))
Timestamp: 0.000000 ID: 0064 S Rx DL: 0
Timestamp: 0.000000 ID: 064 S Rx DL: 0


.. attribute:: data
Expand Down Expand Up @@ -106,7 +106,7 @@ Message
Previously this was exposed as `id_type`.

>>> print(Message(is_extended_id=False))
Timestamp: 0.000000 ID: 0000 S Rx DL: 0
Timestamp: 0.000000 ID: 000 S Rx DL: 0
>>> print(Message(is_extended_id=True))
Timestamp: 0.000000 ID: 00000000 X Rx DL: 0

Expand Down