Skip to content

Conversation

andrejrcarvalho
Copy link

Try to fix a type error on the _send_frame function of the slcan.py driver.
I found this bug while using the Jupyter console of the Dronecan GUI app:
25-09-2025 12h02m28s

After some tinkering with the pydronecan module, I've found that the marker variable was being put in the wrong place when we try to send a standard frame (11 bit identifier) in the following function of the TxWorker:

def _send_frame(self, frame):
        marker = 'D' if frame.canfd else 'T'
        dlc_len = CANFrame.datalength_to_dlc(len(frame.data))
        line = '%s%X%s\r' % (('%c%08X' if frame.extended else 't%03X') % (marker, frame.id),
                             dlc_len,
                             binascii.b2a_hex(frame.data).decode('ascii'))

        self._conn.write(line.encode('ascii'))
        self._conn.flush()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant