Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6092e06

Browse files
Fix: only store message in receive buffer if a message had been received.
1 parent 2bb0f46 commit 6092e06

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎libraries/Arduino_CAN/src/Arduino_CAN.cpp‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,16 @@ size_t Arduino_CAN::available()
6363
mbed::CANMessage can_msg;
6464
bool const msg_read = _can.read(can_msg) > 0;
6565

66-
CanMsg const msg(
67-
can_msg.id,
68-
can_msg.len,
69-
can_msg.data);
66+
if (msg_read)
67+
{
68+
CanMsg const msg(
69+
can_msg.id,
70+
can_msg.len,
71+
can_msg.data);
72+
73+
_rx_msg_buf.enqueue(msg);
74+
}
7075

71-
_rx_msg_buf.enqueue(msg);
7276
return _rx_msg_buf.available();
7377
}
7478

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /