Skip to content

Commit 4a41409

Browse files
authored
Add ability to pass explicit dlc value to send() using the SYSTEC interface (#1756)
* Add ability to pass explicit dlc value to SYSTEC interface when sending a message (closes #1755) * run linter
1 parent 71f54cc commit 4a41409

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

can/interfaces/systec/structures.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ class CanMsg(Structure):
5252
), # Receive time stamp in ms (for transmit messages no meaning)
5353
]
5454

55-
def __init__(self, id_=0, frame_format=MsgFrameFormat.MSG_FF_STD, data=None):
55+
def __init__(
56+
self, id_=0, frame_format=MsgFrameFormat.MSG_FF_STD, data=None, dlc=None
57+
):
5658
data = [] if data is None else data
57-
super().__init__(id_, frame_format, len(data), (BYTE * 8)(*data), 0)
59+
dlc = len(data) if dlc is None else dlc
60+
super().__init__(id_, frame_format, dlc, (BYTE * 8)(*data), 0)
5861

5962
def __eq__(self, other):
6063
if not isinstance(other, CanMsg):

can/interfaces/systec/ucanbus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def send(self, msg, timeout=None):
207207
| (MsgFrameFormat.MSG_FF_EXT if msg.is_extended_id else 0)
208208
| (MsgFrameFormat.MSG_FF_RTR if msg.is_remote_frame else 0),
209209
msg.data,
210+
msg.dlc,
210211
)
211212
self._ucan.write_can_msg(self.channel, [message])
212213
except UcanException as exception:

0 commit comments

Comments
 (0)