From 26e60d39b0081c2596eb7773160eb59e9ae3af64 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 22 May 2017 19:59:22 +0300 Subject: [PATCH] fix ConnectionWatchdog 20 secs timeout on no text msgs --- .../src/com/rusefi/binaryprotocol/BinaryProtocol.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java index c4ca42b6a6..97b2c287f8 100644 --- a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -170,7 +170,8 @@ public class BinaryProtocol { LinkManager.COMMUNICATION_EXECUTOR.submit(new Runnable() { @Override public void run() { - requestOutputChannels(); + if (requestOutputChannels()) + ConnectionWatchdog.onDataArrived(); String text = requestPendingMessages(); if (text != null) listener.onDataArrived((text + "\r\n").getBytes()); @@ -494,12 +495,12 @@ public class BinaryProtocol { } } - public void requestOutputChannels() { + public boolean requestOutputChannels() { if (isClosed) - return; + return false; byte[] response = executeCommand(new byte[]{COMMAND_OUTPUTS}, "output channels", false); if (response == null || response.length != (Fields.TS_OUTPUT_SIZE + 1) || response[0] != RESPONSE_OK) - return; + return false; currentOutputs = response; @@ -515,5 +516,6 @@ public class BinaryProtocol { SensorCentral.getInstance().setValue(value, sensor); } } + return true; } }