From 2f3f98b5d273e4517eaaab73796de954bbcdc38a Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sun, 30 Aug 2015 18:01:44 -0400 Subject: [PATCH] auto-sync --- firmware/console/status_loop.cpp | 7 ++++++- .../rusefi/binaryprotocol/BinaryProtocol.java | 18 ++++++++---------- java_console/ui/src/com/rusefi/Launcher.java | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index bafda9437c..7bcd0e73bd 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -32,6 +32,9 @@ #include "wave_analyzer.h" #endif +// see RUS_EFI_VERSION_TAG in console source code +#define RUS_EFI_VERSION_TAG "rusEfiVersion" + #include "trigger_central.h" #include "engine_state.h" #include "io_pins.h" @@ -302,8 +305,10 @@ static void printInfo(systime_t nowSeconds) { return; } timeOfPreviousPrintVersion = nowSeconds; - appendPrintf(&logger, "rusEfiVersion%s%d@%s %s%s", DELIMETER, getRusEfiVersion(), VCS_VERSION, + appendPrintf(&logger, "%s%s%d@%s %s %d%s", RUS_EFI_VERSION_TAG, DELIMETER, + getRusEfiVersion(), VCS_VERSION, getConfigurationName(engineConfiguration->engineType), + getTimeNowSeconds(), DELIMETER); #if EFI_PROD_CODE || defined(__DOXYGEN__) printOutPin(CRANK1, boardConfiguration->triggerInputPins[0]); diff --git a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java index 97267cd048..0ef74c3f44 100644 --- a/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -54,7 +54,8 @@ public class BinaryProtocol { private final IncomingDataBuffer incomingData; private boolean isBurnPending; - private final Object lock = new Object(); + private final Object ioLock = new Object(); + private final Object imageLock = new Object(); private ConfigurationImage controller; // todo: fix this, this is HORRIBLE! @@ -185,7 +186,7 @@ public class BinaryProtocol { dropPending(); stream.write((SWITCH_TO_BINARY_COMMAND + "\n").getBytes()); - synchronized (lock) { + synchronized (ioLock) { boolean isTimeout = incomingData.waitForBytes(2, start, "switch to binary"); if (isTimeout) { close(); @@ -211,7 +212,7 @@ public class BinaryProtocol { } private void dropPending() throws IOException { - synchronized (lock) { + synchronized (ioLock) { if (isClosed) return; incomingData.dropPending(); @@ -246,7 +247,7 @@ public class BinaryProtocol { private byte[] receivePacket(String msg, boolean allowLongResponse) throws InterruptedException, EOFException { long start = System.currentTimeMillis(); - synchronized (lock) { + synchronized (ioLock) { boolean isTimeout = incomingData.waitForBytes(2, start, msg + " header"); if (isTimeout) return null; @@ -263,11 +264,8 @@ public class BinaryProtocol { return null; byte[] packet = new byte[packetSize]; - int packetCrc; - synchronized (lock) { incomingData.getData(packet); - packetCrc = swap32(incomingData.getInt()); - } + int packetCrc = swap32(incomingData.getInt()); int actualCrc = crc32(packet); boolean isCrcOk = actualCrc == packetCrc; @@ -393,13 +391,13 @@ public class BinaryProtocol { } public void setController(ConfigurationImage controller) { - synchronized (lock) { + synchronized (imageLock) { this.controller = controller.clone(); } } public ConfigurationImage getController() { - synchronized (lock) { + synchronized (imageLock) { if (controller == null) return null; return controller.clone(); diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index f2108a3bef..7b68431c24 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see com.rusefi.StartupFrame */ public class Launcher { - public static final int CONSOLE_VERSION = 20150823; + public static final int CONSOLE_VERSION = 20150830; public static final boolean SHOW_STIMULATOR = false; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port";