due_can
due_can copied to clipboard
Can0.available() return 0 all the time
trafficstars
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?
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.