Skip to content

Commit 3c78368

Browse files
wangcoolcPillar1989
authored andcommitted
Modified mcp2518fd sendmsgbuf() len
1 parent cbe5bf3 commit 3c78368

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mcp2518fd_can.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,13 +2443,14 @@ byte mcp2518fd::mcp2518fd_sendMsg(const byte *buf, byte len, unsigned long id, b
24432443
txObj.bF.ctrl.FDF = 1;
24442444
}
24452445
txObj.bF.ctrl.BRS = true;
2446-
2446+
n = DRV_CANFDSPI_DlcToDataBytes((CAN_DLC)txObj.bF.ctrl.DLC);
24472447
//Prepare data
2448-
for (i = 0; i < len; i++)
2448+
for (i = 0; i < n; i++)
24492449
{
24502450
txd[i] = buf[i];
24512451
}
24522452

2453+
24532454
mcp2518fd_TransmitMessageQueue();
24542455
return spiTransferError;
24552456
}

0 commit comments

Comments
 (0)