Skip to content

Commit 70fe6fa

Browse files
committed
Bugfix. Return length instead of 0!
1 parent 71afede commit 70fe6fa

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

hal/transport/CAN/MyTransportCAN.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,16 @@ uint8_t transportReceive(void* data)
258258
}
259259
}
260260
if (slot<bufSize) {
261-
memcpy(data,packets[i].data,packets[i].len);
262-
Serial.println(packets[i].data[0]);
263-
Serial.println(packets[i].data[1]);
264-
Serial.println(packets[i].data[2]);
265-
Serial.println(packets[i].data[3]);
266-
Serial.println(packets[i].data[4]);
267-
Serial.println(packets[i].data[5]);
268-
Serial.println(packets[i].data[6]);
261+
memcpy(data,packets[slot].data,packets[slot].len);
262+
Serial.print("transport receive data: ");
263+
for(uint8_t k=0;k<packets[slot].len;k++){
264+
Serial.print(packets[slot].data[k]);
265+
Serial.print(", ");
266+
}
267+
Serial.println("");
268+
i=packets[slot].len;
269269
_cleanSlot(slot);
270-
return packets[i].len;
270+
return i;
271271
} else {
272272
return (0);
273273
}

0 commit comments

Comments
 (0)