Repository navigation
pcan: keep a received frame read with a bus-load warning - #2130
adambodurka-lime wants to merge 2 commits into
Conversation
PCAN-Basic can report BUSLIGHT or BUSHEAVY together with a frame it received. PcanBus dropped the frame in that case. Keep it when those are the only flags and the message is not a status or error frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
||
| elif result & (PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY): | ||
| log.warning(self._get_formatted_error(result)) | ||
| if result & ~(PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY) == 0 and not ( |
There was a problem hiding this comment.
i'd prefer intermediate variables for better readability like
no_other_errors = result & ~(PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY) == 0
AI Review: pcan: keep a received frame read with a bus-load warningThe fix is correct: PCAN-Basic documents the message buffer as valid for these status codes (PEAK-System PCAN-Basic V5.1.0.1194 help, Findings
Verdictrequest changes |
|
Implemented the requested error-frame/readability changes in c2eb406, available to cherry-pick onto this branch. The six new error-frame cases fail on the current PR head; all 62 PCAN tests pass with the correction (mocked PCAN, no adapter tested). The broader run passed 540 tests with 95 skips; 20 multicast tests and four type-check errors also fail unchanged on the original head, and the upstream rebase is still outstanding. |
Summary of Changes
PcanBusdrops a received frame whenRead()also reportsPCAN_ERROR_BUSLIGHTorPCAN_ERROR_BUSHEAVY. This keeps the frame when those are the only flags and the message is a data frame. Status frames, error frames and other errors are handled as before.Type of Change
Checklist
tox). Rantest/test_pcan.pyandblack --checkonly.🤖 Generated with Claude Code