From 55519eb0f87019ac80075f25dd8738245d6fb43a Mon Sep 17 00:00:00 2001 From: rusEfi Date: Tue, 7 Apr 2015 10:05:59 -0500 Subject: [PATCH] auto-sync --- firmware/integration/rusefi.xml | 10 ++++++++++ java_console/io/src/com/rusefi/FileLog.java | 4 +++- java_console/rusefi.xml | 10 ++++++++++ .../src/com/rusefi/ui/logview/LogViewer.java | 18 ++++++++++++++++-- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/firmware/integration/rusefi.xml b/firmware/integration/rusefi.xml index 94af567331..403d8312cf 100644 --- a/firmware/integration/rusefi.xml +++ b/firmware/integration/rusefi.xml @@ -26,6 +26,16 @@ + + +
+ +
+ + +
+ +
diff --git a/java_console/io/src/com/rusefi/FileLog.java b/java_console/io/src/com/rusefi/FileLog.java index 9e9014278b..c4d3387297 100644 --- a/java_console/io/src/com/rusefi/FileLog.java +++ b/java_console/io/src/com/rusefi/FileLog.java @@ -16,6 +16,7 @@ public enum FileLog { SIMULATOR_CONSOLE; private static final String DIR = "out/"; + public static String currentLogName; public static final String END_OF_TIMESTAND_TAG = ": "; public static final Logger LOGGER = new Logger() { @Override @@ -52,7 +53,8 @@ public enum FileLog { return null; String date = getDate(); createFolderIfNeeded(); - String fileName = DIR + name() + "_rfi_report_" + date + ".csv"; + currentLogName = name() + "_rfi_report_" + date + ".csv"; + String fileName = DIR + currentLogName; rlog("Writing to " + fileName); return new FileOutputStream(fileName, true); } diff --git a/java_console/rusefi.xml b/java_console/rusefi.xml index e8f20a2274..e786e95f6f 100644 --- a/java_console/rusefi.xml +++ b/java_console/rusefi.xml @@ -26,6 +26,16 @@
+ + +
+ +
+ + +
+ +
diff --git a/java_console/ui/src/com/rusefi/ui/logview/LogViewer.java b/java_console/ui/src/com/rusefi/ui/logview/LogViewer.java index eab487e2db..2d7d16fc8b 100644 --- a/java_console/ui/src/com/rusefi/ui/logview/LogViewer.java +++ b/java_console/ui/src/com/rusefi/ui/logview/LogViewer.java @@ -17,6 +17,7 @@ import java.awt.event.MouseEvent; import java.io.File; import java.io.FileFilter; import java.util.Arrays; +import java.util.TreeMap; /** * This tab is the entry point of rusEfi own log browser @@ -120,8 +121,21 @@ public class LogViewer extends JPanel { for (File file : files) fileListModel.addElement(getFileDesc(file)); - if (files.length > 0 && LinkManager.isLogViewer()) - openFile(files[0]); + int index = 0; + + while (files.length > index && LinkManager.isLogViewer()) { + File file = files[index]; + if (file.getName().endsWith(FileLog.currentLogName)) { + /** + * we do not want to view the log file we've just started to produce. + * We are here if the logs are newer then our current time - remember about fime zone differences + */ + index++; + continue; + } + openFile(file); + break; + } } private FileItem getFileDesc(File file) {