From db5597f24824ff2827f962e9066f7b63fb0f8c9e Mon Sep 17 00:00:00 2001 From: rusefillc Date: Fri, 22 Jul 2022 07:21:35 -0400 Subject: [PATCH] https://github.com/rusefi/rusefi/issues/4370 questionable work-around --- .../io/src/main/java/com/rusefi/io/stream/PCanIoStream.java | 4 +++- java_console/io/src/main/java/peak/can/basic/TPCANMsg.java | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/java_console/io/src/main/java/com/rusefi/io/stream/PCanIoStream.java b/java_console/io/src/main/java/com/rusefi/io/stream/PCanIoStream.java index 6dea6b2242..c486a2e666 100644 --- a/java_console/io/src/main/java/com/rusefi/io/stream/PCanIoStream.java +++ b/java_console/io/src/main/java/com/rusefi/io/stream/PCanIoStream.java @@ -97,7 +97,9 @@ public class PCanIoStream extends AbstractIoStream { private void readOnePacket(DataListener listener) { // todo: can we reuse instance? - TPCANMsg rx = new TPCANMsg(); + // todo: should be? TPCANMsg rx = new TPCANMsg(); + // https://github.com/rusefi/rusefi/issues/4370 nasty work-around + TPCANMsg rx = new TPCANMsg((byte) 255); TPCANStatus status = can.Read(CHANNEL, rx, null); if (status == TPCANStatus.PCAN_ERROR_OK) { if (log.debugEnabled()) diff --git a/java_console/io/src/main/java/peak/can/basic/TPCANMsg.java b/java_console/io/src/main/java/peak/can/basic/TPCANMsg.java index e54be5ce6a..93fa964ea4 100644 --- a/java_console/io/src/main/java/peak/can/basic/TPCANMsg.java +++ b/java_console/io/src/main/java/peak/can/basic/TPCANMsg.java @@ -69,6 +69,12 @@ public class TPCANMsg implements Cloneable _data = new byte[8]; } + // rusEFI custom https://github.com/rusefi/rusefi/issues/4370 workaround + public TPCANMsg(byte length) + { + _data = new byte[length]; + } + /** * Constructs a new message object. * @param id the message id