diff --git a/java_console/models/src/com/rusefi/config/Field.java b/java_console/models/src/com/rusefi/config/Field.java index ec33eadd38..6fa1c0a5d9 100644 --- a/java_console/models/src/com/rusefi/config/Field.java +++ b/java_console/models/src/com/rusefi/config/Field.java @@ -2,8 +2,6 @@ package com.rusefi.config; import com.rusefi.core.Pair; -import java.util.Objects; - /** * @see com.rusefi.config.Fields */ @@ -14,10 +12,28 @@ public class Field { private final int offset; private final FieldType type; + private final int bitOffset; public Field(int offset, FieldType type) { + this(offset, type, -1); + } + + public Field(int offset, FieldType type, int bitOffset) { this.offset = offset; this.type = type; + this.bitOffset = bitOffset; + } + + public String setCommand() { + if (type == FieldType.BIT) + return "set_bit " + getOffset() + " " + bitOffset; + return getType().getStoreCommand() + " " + getOffset(); + } + + public String getCommand() { + if (type == FieldType.BIT) + return "get_bit " + getOffset() + " " + bitOffset; + return type.getLoadCommand() + " " + getOffset(); } public int getOffset() { diff --git a/java_console/models/src/com/rusefi/config/FieldType.java b/java_console/models/src/com/rusefi/config/FieldType.java index 96a43cde5d..5b419c833a 100644 --- a/java_console/models/src/com/rusefi/config/FieldType.java +++ b/java_console/models/src/com/rusefi/config/FieldType.java @@ -1,7 +1,10 @@ package com.rusefi.config; public enum FieldType { - INT, FLOAT, ANALOG_CHART_E; + INT, + BIT, + FLOAT, + ANALOG_CHART_E; private String getTypeForCommand() { diff --git a/java_console/models/src/com/rusefi/config/Fields.java b/java_console/models/src/com/rusefi/config/Fields.java index 6e4e6cd7b9..23cf63b936 100644 --- a/java_console/models/src/com/rusefi/config/Fields.java +++ b/java_console/models/src/com/rusefi/config/Fields.java @@ -9,4 +9,5 @@ public class Fields { public static final Field SENSOR_SNIFFER_MODE = new Field(1400, FieldType.ANALOG_CHART_E); public static final Field GLOBAL_FUEL_CORRECTION = new Field(552, FieldType.FLOAT); public static final Field ENGINE_SNIFFER_SIZE = new Field(1504, FieldType.INT); + public static final Field isDigitalChartEnabled = new Field(1488, FieldType.BIT, 5); } diff --git a/java_console/ui/src/com/rusefi/AnalogChartPanel.java b/java_console/ui/src/com/rusefi/AnalogChartPanel.java index 3b8c6c3511..263583be0b 100644 --- a/java_console/ui/src/com/rusefi/AnalogChartPanel.java +++ b/java_console/ui/src/com/rusefi/AnalogChartPanel.java @@ -109,7 +109,6 @@ public class AnalogChartPanel { lowerPanel.add(new ConfigField(Fields.SENSOR_SNIFFER_MODE, "Sensor chart mode").getContent()); lowerPanel.add(new ConfigField(Fields.SENSOR_SNIFFER_FREQUENCY, "Every XXX engine cycles").getContent()); lowerPanel.add(new ConfigField(Fields.GLOBAL_FUEL_CORRECTION, "Global Fuel Correction").getContent()); - lowerPanel.add(new ConfigField(Fields.ENGINE_SNIFFER_SIZE, "Engine Sniffer size").getContent()); } private void clear() { diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index 0778995a62..c291d8d1d6 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 = 20150419; + public static final int CONSOLE_VERSION = 20150421; public static final boolean SHOW_STIMULATOR = false; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port"; diff --git a/java_console/ui/src/com/rusefi/ui/config/ConfigField.java b/java_console/ui/src/com/rusefi/ui/config/ConfigField.java index f8ef960315..dc43be2a0a 100644 --- a/java_console/ui/src/com/rusefi/ui/config/ConfigField.java +++ b/java_console/ui/src/com/rusefi/ui/config/ConfigField.java @@ -30,7 +30,7 @@ public class ConfigField { ConnectionStatus.INSTANCE.addListener(new ConnectionStatus.Listener() { @Override public void onConnectionStatus(boolean isConnected) { - CommandQueue.getInstance().write(field.getType().getLoadCommand() + " " + field.getOffset(), + CommandQueue.getInstance().write(field.getCommand(), CommandQueue.DEFAULT_TIMEOUT, InvocationConfirmationListener.VOID, false); @@ -70,7 +70,7 @@ public class ConfigField { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { - String msg = field.getType().getStoreCommand() + " " + field.getOffset() + " " + view.getText(); + String msg = field.setCommand() + " " + view.getText(); FileLog.MAIN.logLine("Sending " + msg); CommandQueue.getInstance().write(msg); status.setText("S"); diff --git a/java_console/ui/src/com/rusefi/ui/engine/EngineSnifferPanel.java b/java_console/ui/src/com/rusefi/ui/engine/EngineSnifferPanel.java index de473a8197..14a7a3064d 100644 --- a/java_console/ui/src/com/rusefi/ui/engine/EngineSnifferPanel.java +++ b/java_console/ui/src/com/rusefi/ui/engine/EngineSnifferPanel.java @@ -1,11 +1,13 @@ package com.rusefi.ui.engine; import com.rusefi.FileLog; +import com.rusefi.config.Fields; import com.rusefi.core.EngineState; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; import com.rusefi.io.LinkManager; import com.rusefi.ui.*; +import com.rusefi.ui.config.ConfigField; import com.rusefi.ui.storage.Node; import com.rusefi.ui.util.UiUtils; import com.rusefi.ui.widgets.AnyCommand; @@ -117,16 +119,16 @@ public class EngineSnifferPanel { } }); - JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); - buttonPanel.add(clearButton); - buttonPanel.add(saveImageButton); - buttonPanel.add(pauseButton); - buttonPanel.add(new RpmLabel().setSize(2).getContent()); + JPanel topButtons = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); + topButtons.add(clearButton); + topButtons.add(saveImageButton); + topButtons.add(pauseButton); + topButtons.add(new RpmLabel().setSize(2).getContent()); JComponent command = new AnyCommand(config, "chartsize " + EFI_DEFAULT_CHART_SIZE, true).getContent(); - buttonPanel.add(command); + topButtons.add(command); - buttonPanel.add(zoomControl); + topButtons.add(zoomControl); scrollControl = ChartRepository.getInstance().createControls(new ChartRepository.ChartRepositoryListener() { @Override @@ -134,13 +136,20 @@ public class EngineSnifferPanel { displayChart(chart); } }); - buttonPanel.add(scrollControl.getContent()); + topButtons.add(scrollControl.getContent()); - buttonPanel.add(new URLLabel(HELP_TEXT, HELP_URL)); + topButtons.add(new URLLabel(HELP_TEXT, HELP_URL)); - chartPanel.add(buttonPanel, BorderLayout.NORTH); + JPanel lowerButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0)); + lowerButtons.add(new ConfigField(Fields.ENGINE_SNIFFER_SIZE, "Engine Sniffer size").getContent()); + + JPanel bottomPanel = new JPanel(new BorderLayout()); + bottomPanel.add(lowerButtons, BorderLayout.NORTH); + bottomPanel.add(statusPanel.infoPanel, BorderLayout.SOUTH); + + chartPanel.add(topButtons, BorderLayout.NORTH); chartPanel.add(pane, BorderLayout.CENTER); - chartPanel.add(statusPanel.infoPanel, BorderLayout.SOUTH); + chartPanel.add(bottomPanel, BorderLayout.SOUTH); zoomControl.listener = new ZoomControl.ZoomControlListener() { @Override