From a509d6a2c3722c5b0d28371afe179030ad956e12 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 8 Dec 2021 22:52:34 -0500 Subject: [PATCH] CAN: That's an abnormal situation, and we probably should react? waitingForNumBytes=37 waitingForFrameIndex=4 frameIdx=3 #3682 --- .../io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java b/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java index 19585ce2c0..4b693771f0 100644 --- a/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java +++ b/java_console/io/src/main/java/com/rusefi/io/can/IsoTpCanDecoder.java @@ -51,6 +51,11 @@ public class IsoTpCanDecoder { break; case ISO_TP_FRAME_CONSECUTIVE: frameIdx = data[0] & 0xf; + if (frameIdx < waitingForFrameIndex) { + // todo: open question why we see message duplicates but we see those + // is that rusEFI firmware bug or is that an OK thingy for CAN physical level? + return new byte[0]; + } if (this.waitingForNumBytes < 0 || this.waitingForFrameIndex != frameIdx) { throw new IllegalStateException("ISO_TP_FRAME_CONSECUTIVE: That's an abnormal situation, and we probably should react? waitingForNumBytes=" + waitingForNumBytes + " waitingForFrameIndex=" + waitingForFrameIndex + " frameIdx=" + frameIdx); }