Skip to content

Commit c4ccdd0

Browse files
committed
Pass can message fields as named arguments
1 parent 80f8a9f commit c4ccdd0

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

can/interfaces/gs_usb.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@ def _recv_internal(
8686
if not self.gs_usb.read(frame=frame, timeout_ms=timeout_ms):
8787
return None, False
8888

89-
msg = can.Message()
90-
msg.arbitration_id = frame.arbitration_id
91-
msg.dlc = frame.can_dlc
92-
msg.data = bytearray(frame.data)[0 : msg.dlc]
93-
msg.timestamp = frame.timestamp
94-
msg.channel = self.channel_info
95-
msg.is_extended_id = frame.is_extended_id
96-
msg.is_remote_frame = frame.is_remote_frame
97-
msg.is_error_frame = frame.is_error_frame
98-
msg.is_rx = True
89+
msg = can.Message(
90+
timestamp=frame.timestamp,
91+
arbitration_id=frame.arbitration_id,
92+
is_extended_id=frame.can_dlc,
93+
is_remote_frame=frame.is_remote_frame,
94+
is_error_frame=frame.is_error_frame,
95+
channel=self.channel_info,
96+
dlc=frame.can_dlc,
97+
data=bytearray(frame.data)[0 : msg.dlc],
98+
is_rx=True,
99+
)
100+
99101
return msg, False
100102

101103
def shutdown(self):

0 commit comments

Comments
 (0)