can_isotp fix? (#3678)
Co-authored-by: Andrei <andreikagit@users.noreply.github.com>
This commit is contained in:
parent
5f997f9769
commit
6be915f7af
|
@ -141,8 +141,8 @@ int CanStreamerState::receiveFrame(CANRxFrame *rxmsg, uint8_t *buf, int num, can
|
|||
memcpy(buf, srcBuf, numBytesToCopy);
|
||||
}
|
||||
srcBuf += numBytesToCopy;
|
||||
waitingForNumBytes -= numBytesAvailable;
|
||||
numBytesAvailable -= numBytesToCopy;
|
||||
waitingForNumBytes -= numBytesToCopy;
|
||||
// if there are some more bytes left, we save them for the next time
|
||||
for (int i = 0; i < numBytesAvailable; i++) {
|
||||
rxFifoBuf.put(srcBuf[i]);
|
||||
|
|
|
@ -110,13 +110,15 @@ public:
|
|||
for (size_t i = 0; i < totalSize; i++) {
|
||||
EXPECT_EQ(totalData[i], totalReceivedData[i]) << "Rcv. byte #" << i << " differs!";
|
||||
}
|
||||
// check the FIFO buf size
|
||||
EXPECT_EQ(0, rxFifoBuf.getCount());
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
TestCanStreamer streamer;
|
||||
};
|
||||
|
||||
|
||||
TEST(testCanSerial, test1Frame) {
|
||||
|
||||
{
|
||||
|
@ -146,6 +148,10 @@ TEST(testCanSerial, test2Frames) {
|
|||
TestCanStreamerState state;
|
||||
state.test({ "01234567" }, { "\x10"s "\x08"s "012345"s, "\x21"s "67\0\0\0\0\0"s }, 8, { 8 }); // 8 bytes -> 2 8-byte frames, 8 bytes in FIFO
|
||||
}
|
||||
{
|
||||
TestCanStreamerState state;
|
||||
state.test({ "0123456789A" }, { "\x10"s "\x0B"s "012345"s, "\x21"s "6789A\0\0"s }, 11, { 2, 5, 4 }); // 11 bytes -> 2 8-byte frames
|
||||
}
|
||||
/*
|
||||
{
|
||||
TestCanStreamerState state;
|
||||
|
|
Loading…
Reference in New Issue