Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed logic to ignore all unwanted can frames #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

berman00
Copy link

Currently, libcanard only calls the should_accept function on the first frame of a multiframe transfer. This means that the following frames will cause a CANARD_ERROR_RX_MISSED_START. I would be better if it returned a CANARD_ERROR_RX_NOT_WANTED instead, which is a better description of the problem.

The reason I came across this was that I connected a microcontroller with libcanard to a Flight controller running Ardupilot. I don't care about the ardupilot messages, so my should_accept function ignores them. However, I do care about possible errors on the CAN bus to monitor the health of the system, so I keep track of CANARD_ERROR_RX_MISSED_START as well as other CAN bus related errors. The way it is currently implemented, it is impossible to distinguish between a missed started because of an unwanted multiframe message or a missed start caused by an actual problem with the system. With this change all unwanted frames are ignored.

Here is the output of the serial monitor that I was using to debug.

Before the change:

before fix

I was logging all received messages through libcanard, as well as CANARD_ERROR_RX_NOT_WANTED and CANARD_ERROR_RX_MISSED_START. The microcontroller is connected to an ardupilot flight controller that is sendig a bunch of ardupilot messages, which I don't care about. As you can see, both errors are present.

After the change

after fix

Now only the CANARD_ERROR_RX_NOT_WANTED is the only error present, which in my application I can safely ignore.

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