diff --git a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java index 729fc8f0c9..71cea81ba8 100644 --- a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -546,11 +546,11 @@ public class BinaryProtocol { // TODO: Get rid of the +1. This adds a byte at the front to tack a fake TS response code on the front // of the reassembled packet. - byte[] reassemblyBuffer = new byte[GetOutputsCommand.OUTPUT_SIZE + 1]; + byte[] reassemblyBuffer = new byte[TS_TOTAL_OUTPUT_SIZE + 1]; reassemblyBuffer[0] = Fields.TS_RESPONSE_OK; int reassemblyIdx = 0; - int remaining = GetOutputsCommand.OUTPUT_SIZE; + int remaining = TS_TOTAL_OUTPUT_SIZE; while (remaining > 0) { // If less than one full chunk left, do a smaller read diff --git a/java_console/io/src/main/java/com/rusefi/io/commands/GetOutputsCommand.java b/java_console/io/src/main/java/com/rusefi/io/commands/GetOutputsCommand.java index d9cdfd62fc..ed2c5fb418 100644 --- a/java_console/io/src/main/java/com/rusefi/io/commands/GetOutputsCommand.java +++ b/java_console/io/src/main/java/com/rusefi/io/commands/GetOutputsCommand.java @@ -10,10 +10,9 @@ import static com.rusefi.binaryprotocol.IoHelper.putShort; import static com.rusefi.binaryprotocol.IoHelper.swap16; public class GetOutputsCommand { - public static int OUTPUT_SIZE = Fields.TS_TOTAL_OUTPUT_SIZE; public static byte[] createRequest() { - return createRequest(0, GetOutputsCommand.OUTPUT_SIZE); + return createRequest(0, Fields.TS_TOTAL_OUTPUT_SIZE); } public static byte[] createRequest(int offset, int size) { @@ -24,7 +23,7 @@ public class GetOutputsCommand { } public static void sendOutput(IoStream stream) throws IOException { - byte[] response = new byte[1 + GetOutputsCommand.OUTPUT_SIZE]; + byte[] response = new byte[1 + Fields.TS_TOTAL_OUTPUT_SIZE]; response[0] = (byte) BinaryProtocolServer.TS_OK.charAt(0); stream.sendPacket(response); } diff --git a/java_console/io/src/test/java/com/rusefi/TestHelper.java b/java_console/io/src/test/java/com/rusefi/TestHelper.java index 0699727f5f..4cdbd5c773 100644 --- a/java_console/io/src/test/java/com/rusefi/TestHelper.java +++ b/java_console/io/src/test/java/com/rusefi/TestHelper.java @@ -2,7 +2,6 @@ package com.rusefi; import com.devexperts.logging.Logging; import com.opensr5.ConfigurationImage; -import com.opensr5.Logger; import com.opensr5.ini.field.ScalarIniField; import com.rusefi.binaryprotocol.BinaryProtocolState; import com.rusefi.config.Field; @@ -10,9 +9,7 @@ import com.rusefi.config.generated.Fields; import com.rusefi.io.IoStream; import com.rusefi.io.LinkConnector; import com.rusefi.io.LinkManager; -import com.rusefi.io.commands.GetOutputsCommand; import com.rusefi.io.tcp.BinaryProtocolServer; -import com.rusefi.io.tcp.TcpConnector; import com.rusefi.io.tcp.TcpIoStream; import com.rusefi.proxy.NetworkConnector; import com.rusefi.server.ControllerInfo; @@ -60,7 +57,7 @@ public class TestHelper { public static BinaryProtocolServer createVirtualController(ConfigurationImage ci, int port, Listener serverSocketCreationCallback, BinaryProtocolServer.Context context) throws IOException { BinaryProtocolState state = new BinaryProtocolState(); state.setController(ci); - state.setCurrentOutputs(new byte[1 + GetOutputsCommand.OUTPUT_SIZE]); + state.setCurrentOutputs(new byte[1 + Fields.TS_TOTAL_OUTPUT_SIZE]); LinkManager linkManager = new LinkManager(); linkManager.setConnector(LinkConnector.getDetachedConnector(state)); diff --git a/java_console/ui/src/test/java/com/rusefi/io/BinaryProtocolServerSandbox.java b/java_console/ui/src/test/java/com/rusefi/io/BinaryProtocolServerSandbox.java index 79f71fa6ee..cbc0e836a4 100644 --- a/java_console/ui/src/test/java/com/rusefi/io/BinaryProtocolServerSandbox.java +++ b/java_console/ui/src/test/java/com/rusefi/io/BinaryProtocolServerSandbox.java @@ -5,7 +5,6 @@ import com.opensr5.ini.field.ScalarIniField; import com.rusefi.TestHelper; import com.rusefi.binaryprotocol.BinaryProtocolState; import com.rusefi.config.generated.Fields; -import com.rusefi.io.commands.GetOutputsCommand; import com.rusefi.io.tcp.BinaryProtocolServer; import com.rusefi.tune.xml.Constant; @@ -26,7 +25,7 @@ class BinaryProtocolServerSandbox { ScalarIniField iniField = TestHelper.createIniField(Fields.TWOSTROKE); iniField.setValue(controller, new Constant(iniField.getName(), "", "1", iniField.getDigits())); state.setController(controller); - state.setCurrentOutputs(new byte[1 + GetOutputsCommand.OUTPUT_SIZE]); + state.setCurrentOutputs(new byte[1 + Fields.TS_TOTAL_OUTPUT_SIZE]); LinkManager linkManager = new LinkManager(); linkManager.setConnector(LinkConnector.getDetachedConnector(state)); diff --git a/java_console/ui/src/test/java/com/rusefi/proxy/client/LocalApplicationProxyTest.java b/java_console/ui/src/test/java/com/rusefi/proxy/client/LocalApplicationProxyTest.java index 3f07f5a5fc..2aa1fd019d 100644 --- a/java_console/ui/src/test/java/com/rusefi/proxy/client/LocalApplicationProxyTest.java +++ b/java_console/ui/src/test/java/com/rusefi/proxy/client/LocalApplicationProxyTest.java @@ -98,7 +98,7 @@ public class LocalApplicationProxyTest { applicationConnection.sendPacket(commandPacket); BinaryProtocolServer.Packet response = applicationConnection.readPacket(); - assertEquals(GetOutputsCommand.OUTPUT_SIZE + 1, response.getPacket().length); + assertEquals(Fields.TS_TOTAL_OUTPUT_SIZE + 1, response.getPacket().length); } } } diff --git a/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java b/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java index d373117425..69af0cc36a 100644 --- a/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java +++ b/java_tools/proxy_server/src/main/java/com/rusefi/server/ControllerConnectionState.java @@ -140,7 +140,7 @@ public class ControllerConnectionState { outputRoundAroundDuration = (int) (System.currentTimeMillis() - start); if (packet == null) throw new IOException("getOutputs: No response"); - if (packet.length != 1 + GetOutputsCommand.OUTPUT_SIZE) + if (packet.length != 1 + Fields.TS_TOTAL_OUTPUT_SIZE) throw new IOException("getOutputs: unexpected package length " + packet.length); sensorsHolder.grabSensorValues(packet); }