Skip to content

Commit c8556d5

Browse files
committed
Change order of TX buffer fill to ensure in-order sending of frames.
1 parent c991cac commit c8556d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mcp2515_can.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ byte mcp2515_can::mcp2515_getNextFreeTXBuf(byte* txbuf_n) { // get
10321032
}
10331033

10341034
// check all 3 TX-Buffers except reserved
1035-
for (i = 0; i < MCP_N_TXBUFFERS - nReservedTx; i++) {
1035+
for (i = MCP_N_TXBUFFERS - nReservedTx; i >= 0; i--) {
10361036
if ((status & txStatusPendingFlag(i)) == 0) {
10371037
*txbuf_n = txCtrlReg(i) + 1; // return SIDH-address of Buffer
10381038
mcp2515_modifyRegister(MCP_CANINTF, txIfFlag(i), 0);

0 commit comments

Comments
 (0)