From 201dbbbe586e627c37f48f73c3b13a103a9b0edd Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sun, 25 Dec 2016 21:02:31 -0500 Subject: [PATCH] auto-sync --- firmware/controllers/algo/obd_error_codes.h | 6 +++--- .../controllers/trigger/trigger_decoder.cpp | 2 +- firmware/hw_layer/can_hw.cpp | 2 +- .../logging/src/com/rusefi/FileLog.java | 3 +++ .../ui/src/com/rusefi/BenchTestPane.java | 17 ++++++++--------- java_console/ui/src/com/rusefi/Launcher.java | 3 ++- .../ui/src/com/rusefi/ui/GaugesPanel.java | 16 +++++++++++++++- 7 files changed, 33 insertions(+), 16 deletions(-) diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index feb38d3425..b485dd2fbd 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -1702,13 +1702,13 @@ typedef enum { CUSTOM_OBD_32 = 6032, CUSTOM_OBD_33 = 6033, CUSTOM_OBD_34 = 6034, - CUSTOM_OBD_35 = 6035, + CUSTOM_OBD_TRG_DECODING = 6035, CUSTOM_SYNC_ERROR = 6036, CUSTOM_SYNC_ERROR_2 = 6037, CUSTOM_OBD_38 = 6038, CUSTOM_OBD_39 = 6039, - CUSTOM_OBD_40 = 6040, + CUSTOM_OBD_LOW_CAN_PERIOD = 6040, CUSTOM_OBD_41 = 6041, CUSTOM_OBD_42 = 6042, CUSTOM_OBD_MMC_ERROR = 6043, @@ -1720,7 +1720,7 @@ typedef enum { CUSTOM_OBD_49 = 6049, CUSTOM_TOO_LONG_FUEL_INJECTION = 6050, - CUSTOM_OBD_51 = 6051, + CUSTOM_OBD_ZERO_CYLINDER_COUNT = 6051, CUSTOM_OBD_52 = 6052, CUSTOM_OBD_53 = 6053, CUSTOM_OBD_54 = 6054, diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 23bb1b561c..b96a176bba 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -283,7 +283,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no errorDetection.add(isDecodingError); if (isTriggerDecoderError()) { - warning(CUSTOM_OBD_35, "trigger decoding issue. expected %d/%d/%d got %d/%d/%d", + warning(CUSTOM_OBD_TRG_DECODING, "trigger decoding issue. expected %d/%d/%d got %d/%d/%d", TRIGGER_SHAPE(expectedEventCount[0]), TRIGGER_SHAPE(expectedEventCount[1]), TRIGGER_SHAPE(expectedEventCount[2]), currentCycle.eventCount[0], currentCycle.eventCount[1], currentCycle.eventCount[2]); diff --git a/firmware/hw_layer/can_hw.cpp b/firmware/hw_layer/can_hw.cpp index 05751e3706..d24ccf59e4 100644 --- a/firmware/hw_layer/can_hw.cpp +++ b/firmware/hw_layer/can_hw.cpp @@ -231,7 +231,7 @@ static msg_t canThread(void *arg) { canRead(); // todo: since this is a blocking operation, do we need a separate thread for 'write'? if (engineConfiguration->canSleepPeriod < 10) { - warning(CUSTOM_OBD_40, "%d too low CAN", engineConfiguration->canSleepPeriod); + warning(CUSTOM_OBD_LOW_CAN_PERIOD, "%d too low CAN", engineConfiguration->canSleepPeriod); engineConfiguration->canSleepPeriod = 50; } diff --git a/java_console/logging/src/com/rusefi/FileLog.java b/java_console/logging/src/com/rusefi/FileLog.java index 3a0f35e159..91bb1f0be1 100644 --- a/java_console/logging/src/com/rusefi/FileLog.java +++ b/java_console/logging/src/com/rusefi/FileLog.java @@ -35,6 +35,7 @@ public enum FileLog { @Nullable private OutputStream fileLog; // null if not opened yet or already closed + public static boolean suspendLogging; FileLog() { } @@ -73,6 +74,8 @@ public enum FileLog { public synchronized void logLine(String fullLine) { System.out.println(fullLine); + if (suspendLogging) + return; if (fileLog == null) return; try { diff --git a/java_console/ui/src/com/rusefi/BenchTestPane.java b/java_console/ui/src/com/rusefi/BenchTestPane.java index 492a3a30c8..39eb76c700 100644 --- a/java_console/ui/src/com/rusefi/BenchTestPane.java +++ b/java_console/ui/src/com/rusefi/BenchTestPane.java @@ -27,7 +27,7 @@ public class BenchTestPane { } private Component createMILTest() { - BenchTestPanel panel = new BenchTestPanel("MIL", UiUtils.loadIcon("check_engine.jpg")) { + BenchTestPanel panel = new BenchTestPanel("MIL", "check_engine.jpg") { @NotNull protected String getCommand() { return "milbench"; @@ -37,7 +37,7 @@ public class BenchTestPane { } private Component createIdleTest() { - BenchTestPanel panel = new BenchTestPanel("Idle Valve", UiUtils.loadIcon("idle_valve.png")) { + BenchTestPanel panel = new BenchTestPanel("Idle Valve", ("idle_valve.png")) { @NotNull protected String getCommand() { return "idlebench"; @@ -47,7 +47,7 @@ public class BenchTestPane { } private Component createFanTest() { - BenchTestPanel panel = new BenchTestPanel("Radiator Fan", UiUtils.loadIcon("radiator_fan.jpg")) { + BenchTestPanel panel = new BenchTestPanel("Radiator Fan", "radiator_fan.jpg") { @NotNull protected String getCommand() { return "fanbench"; @@ -57,7 +57,7 @@ public class BenchTestPane { } private Component createFuelPumpTest() { - BenchTestPanel panel = new BenchTestPanel("Fuel Pump", UiUtils.loadIcon("fuel_pump.jpg")) { + BenchTestPanel panel = new BenchTestPanel("Fuel Pump", "fuel_pump.jpg") { @NotNull protected String getCommand() { return "fuelpumpbench"; @@ -68,8 +68,7 @@ public class BenchTestPane { private Component createSparkTest() { final JComboBox indexes = createIndexCombo(); - ImageIcon icon = UiUtils.loadIcon("spark.jpg"); - BenchTestPanel panel = new BenchTestPanel("Spark #", icon, indexes) { + BenchTestPanel panel = new BenchTestPanel("Spark #", "spark.jpg", indexes) { @Override protected String getCommand() { return "sparkbench2 1000 " + indexes.getSelectedItem() + " 5 333 3"; @@ -80,8 +79,7 @@ public class BenchTestPane { private Component createInjectorTest() { final JComboBox indexes = createIndexCombo(); - ImageIcon icon = UiUtils.loadIcon("injector.png"); - BenchTestPanel panel = new BenchTestPanel("Injector #", icon, indexes) { + BenchTestPanel panel = new BenchTestPanel("Injector #", "injector.png", indexes) { @Override protected String getCommand() { return "fuelbench2 1000 " + indexes.getSelectedItem() + " 5 333 3"; @@ -107,7 +105,8 @@ public class BenchTestPane { final JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0)); final JButton test = new JButton("Test"); - public BenchTestPanel(String text, ImageIcon icon, JComponent... components) { + public BenchTestPanel(String text, String iconFileName, JComponent... components) { + ImageIcon icon = UiUtils.loadIcon(iconFileName); JPanel rightVerticalPanel = new JPanel(new VerticalFlowLayout()); rightVerticalPanel.add(new JLabel(text)); for (JComponent component : components) diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index f4f8bac393..a51b7c58d6 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -38,7 +38,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see EngineSnifferPanel */ public class Launcher { - public static final int CONSOLE_VERSION = 20161220; + public static final int CONSOLE_VERSION = 20161225; public static final boolean SHOW_STIMULATOR = false; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port"; @@ -254,6 +254,7 @@ public class Launcher { public static void main(final String[] args) throws Exception { FileLog.MAIN.start(); getConfig().load(); + FileLog.suspendLogging = getConfig().getRoot().getBoolProperty(GaugesPanel.DISABLE_LOGS); Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler()); VersionChecker.start(); SwingUtilities.invokeAndWait(new Runnable() { diff --git a/java_console/ui/src/com/rusefi/ui/GaugesPanel.java b/java_console/ui/src/com/rusefi/ui/GaugesPanel.java index 82c4a112a8..01f47e43c9 100644 --- a/java_console/ui/src/com/rusefi/ui/GaugesPanel.java +++ b/java_console/ui/src/com/rusefi/ui/GaugesPanel.java @@ -18,6 +18,8 @@ import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.List; +import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; + /** * Date: 2/5/13 * (c) Andrey Belomutskiy @@ -54,6 +56,7 @@ public class GaugesPanel { private static final String SHOW_MESSAGES = "show_messages"; private static final String SHOW_RPM = "show_rpm"; private static final String SPLIT_LOCATION = "SPLIT_LOCATION"; + public static final String DISABLE_LOGS = "DISABLE_LOGS"; public static boolean IS_PAUSED; // dirty but works for not static { @@ -159,6 +162,16 @@ public class GaugesPanel { @NotNull private JPopupMenu createMenu(final Node config) { JPopupMenu menu = new JPopupMenu(); + final JCheckBoxMenuItem saveDetailedLogs = new JCheckBoxMenuItem("Save detailed logs"); + saveDetailedLogs.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FileLog.suspendLogging = !saveDetailedLogs.isSelected(); + getConfig().getRoot().setBoolProperty(DISABLE_LOGS, FileLog.suspendLogging); + } + }); + saveDetailedLogs.setSelected(!FileLog.suspendLogging); + final JCheckBoxMenuItem showRpmItem = new JCheckBoxMenuItem("Show RPM"); final JCheckBoxMenuItem showCommandsItem = new JCheckBoxMenuItem("Show Commands"); showRpmItem.setSelected(showRpmPanel); @@ -181,7 +194,8 @@ public class GaugesPanel { showCommandsItem.setSelected(showMessagesPanel); menu.add(showCommandsItem); menu.add(new JPopupMenu.Separator()); - menu.add(new JPopupMenu("Reset Config")); + menu.add(saveDetailedLogs); + menu.add(new JPopupMenu("Reset Config")); // todo looks like not working return menu; }