Skip to content

Commit

Permalink
Change the behaviour of autostart parameter in socketcan implementati…
Browse files Browse the repository at this point in the history
…on of CyclicSendTask to not call _tx_setup() method instead of adding a parameter to it.
  • Loading branch information
SWolfSchunk committed Oct 7, 2024
1 parent 1a7f3a1 commit 9b11310
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions can/interfaces/socketcan/socketcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ def __init__(

self.bcm_socket = bcm_socket
self.task_id = task_id
self._tx_setup(self.messages, send=autostart)
if autostart:
self._tx_setup(self.messages)

def _tx_setup(
self,
messages: Sequence[Message],
raise_if_task_exists: bool = True,
send: bool = True,
) -> None:
# Create a low level packed frame to pass to the kernel
body = bytearray()
Expand All @@ -380,9 +380,7 @@ def _tx_setup(
for message in messages:
body += build_can_frame(message)
log.debug("Sending BCM command")

if send:
send_bcm(self.bcm_socket, header + body)
send_bcm(self.bcm_socket, header + body)

def _check_bcm_task(self) -> None:
# Do a TX_READ on a task ID, and check if we get EINVAL. If so,
Expand Down

0 comments on commit 9b11310

Please sign in to comment.