Skip to content

Commit

Permalink
When there is an invalid frame on CAN bus (in our case CAN FD), PCAN …
Browse files Browse the repository at this point in the history
…first reports result PCAN_ERROR_ILLDATA and then it send the error frame. If the PCAN_ERROR_ILLDATA is not ignored, python-can throws an exception.

This fix add the ignore on the PCAN_ERROR_ILLDATA.
  • Loading branch information
bures committed Sep 4, 2024
1 parent c712131 commit 2ec8ac2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions can/interfaces/pcan/pcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
PCAN_ERROR_BUSLIGHT,
PCAN_ERROR_OK,
PCAN_ERROR_QRCVEMPTY,
PCAN_ERROR_ILLDATA,
PCAN_FD_PARAMETER_LIST,
PCAN_LANBUS1,
PCAN_LISTEN_ONLY,
Expand Down Expand Up @@ -555,6 +556,10 @@ def _recv_internal(
elif result & (PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY):
log.warning(self._get_formatted_error(result))

elif result == PCAN_ERROR_ILLDATA:
# Ignore this
pass

else:
raise PcanCanOperationError(self._get_formatted_error(result))

Expand Down

0 comments on commit 2ec8ac2

Please sign in to comment.