Skip to content

Commit b7e40dd

Browse files
emekBarisemekBarisHRIsandeepmistry
authored
reception of empty packets with and without callback (sandeepmistry#103)
* allows receiving empty packets with and without callback * bug fix * Update examples/CANReceiver/CANReceiver.ino Co-authored-by: emekBaris <[email protected]> Co-authored-by: Sandeep Mistry <[email protected]>
1 parent 382fff7 commit b7e40dd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/CANReceiver/CANReceiver.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void loop() {
2020
// try to parse packet
2121
int packetSize = CAN.parsePacket();
2222

23-
if (packetSize) {
23+
if (packetSize || CAN.packetId() != -1) {
2424
// received a packet
2525
Serial.print("Received ");
2626

src/MCP2515.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ void MCP2515Class::handleInterrupt()
442442
return;
443443
}
444444

445-
while (parsePacket()) {
445+
while (parsePacket() || _rxId != -1) {
446446
_onReceive(available());
447447
}
448448
}

0 commit comments

Comments
 (0)