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

Can0.available() return 0 all the time #40

Open
Bozili opened this issue Apr 16, 2019 · 1 comment
Open

Can0.available() return 0 all the time #40

Bozili opened this issue Apr 16, 2019 · 1 comment

Comments

@Bozili
Copy link

Bozili commented Apr 16, 2019

In the example of CAN_SendingTest I just put some println and It seems that the function Can0.available() isn't working (return 0 all the time), the sending frames works (returning 1), and I don't have any idea why is available() not working...Is there some trick?? Are there some connections missed?

@tfeldmann
Copy link

Which version of the library do you use? In older versions this code was included:

int CANRaw::available()
{
	int val;
	if (rx_avail())
	{
		val = rx_buffer_head - rx_buffer_tail;
		//Now, because this is a cyclic buffer it is possible that the ordering was reversed
		//So, handle that case
		if (val < 0) val += SIZE_RX_BUFFER;
	}
	else return 0;
}

which missed a return statement in the condition.

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

No branches or pull requests

2 participants