diff --git a/firmware/controllers/idle_thread.cpp b/firmware/controllers/idle_thread.cpp index 14c3a96cd8..c5551390eb 100644 --- a/firmware/controllers/idle_thread.cpp +++ b/firmware/controllers/idle_thread.cpp @@ -118,6 +118,28 @@ static void setIdleValvePosition(int positionPercent) { doSetIdleValvePosition(positionPercent); } +static int idlePositionBeforeBlip; +static efitimeus_t timeToStopBlip = 0; + +/** + * I use this questionable feature to tune acceleration enrichment + */ +static void blipIdle(int idlePosition, int durationMs) { + if (timeToStopBlip != 0) { + return; // already in idle blip + } + idlePositionBeforeBlip = boardConfiguration->idlePosition; + setIdleValvePosition(idlePosition); + timeToStopBlip = getTimeNowUs() + 1000 * durationMs; +} + +static void undoIdleBlipIfNeeded() { + if (timeToStopBlip != 0 && getTimeNowUs() > timeToStopBlip) { + timeToStopBlip = 0; + setIdleValvePosition(idlePositionBeforeBlip); + } +} + static msg_t ivThread(int param) { (void) param; chRegSetThreadName("IdleValve"); @@ -136,6 +158,8 @@ static msg_t ivThread(int param) { getHwPin(boardConfiguration->clutchUpPin)); } + undoIdleBlipIfNeeded(); + if (engineConfiguration->idleMode != IM_AUTO) { // let's re-apply CLT correction doSetIdleValvePosition(boardConfiguration->idlePosition); @@ -208,6 +232,8 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) { addConsoleActionI("set_idle_position", setIdleValvePosition); addConsoleActionI("set_idle_enabled", (VoidInt) setIdleControlEnabled); + + addConsoleActionII("blipidle", blipIdle); } #endif diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index fb2c43d3d1..52d5c8c0d5 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -291,5 +291,5 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array - return 20150830; + return 20150901; } diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index 9478d009d1..c8f3455a90 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 = 20150831; + public static final int CONSOLE_VERSION = 20150901; public static final boolean SHOW_STIMULATOR = false; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port"; @@ -40,8 +40,6 @@ public class Launcher { private final JTabbedPane tabbedPane = new JTabbedPane(); private static AtomicReference firmwareVersion = new AtomicReference<>("N/A"); - public static int defaultFontSize; - private static Frame staticFrame; private final TableEditorPane tableEditor = new TableEditorPane(); private final SettingsTab settingsTab = new SettingsTab(); diff --git a/java_console/ui/src/com/rusefi/ui/SensorLiveGraph.java b/java_console/ui/src/com/rusefi/ui/SensorLiveGraph.java index ce71eddf89..a5ea81d36b 100644 --- a/java_console/ui/src/com/rusefi/ui/SensorLiveGraph.java +++ b/java_console/ui/src/com/rusefi/ui/SensorLiveGraph.java @@ -48,7 +48,7 @@ public class SensorLiveGraph extends JPanel { public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { showPopupMenu(e); - } else if (e.getClickCount() == 2) { +// } else if (e.getClickCount() == 2) { // handleDoubleClick(e, gauge, sensor); } } @@ -192,25 +192,16 @@ public class SensorLiveGraph extends JPanel { return; // it's hopeless g.setColor(Color.black); - double minValue; - double maxValue; - if (autoScale) { - VisibleRange getVisibleRange = new VisibleRange().invoke(); - minValue = getVisibleRange.getMinValue(); - maxValue = getVisibleRange.getMaxValue(); - } else { - minValue = sensor.getMinValue(); - maxValue = sensor.getMaxValue(); - } + VisibleRange range = getRange(); - paintGraph(g, d, minValue, maxValue); + paintGraph(g, d, range.minValue, range.maxValue); g.setColor(Color.red); int minY = d.height; int maxY = g.getFont().getSize(); - g.drawString(String.format("%.2f", minValue), 5, minY); - g.drawString(String.format("%.2f", (minValue + maxValue) / 2), 5, (minY + maxY) / 2); - g.drawString(String.format("%.2f", maxValue), 5, maxY); + g.drawString(String.format("%.2f", range.minValue), 5, minY); + g.drawString(String.format("%.2f", (range.minValue + range.maxValue) / 2), 5, (minY + maxY) / 2); + g.drawString(String.format("%.2f", range.maxValue), 5, maxY); g.setColor(Color.blue); String sensorName = sensor.getName() + " "; @@ -224,6 +215,16 @@ public class SensorLiveGraph extends JPanel { paintLastValue(g, d); } + private VisibleRange getRange() { + VisibleRange range; + if (autoScale) { + range = VisibleRange.findRange(values); + } else { + range = new VisibleRange(sensor.getMinValue(), sensor.getMaxValue()); + } + return range; + } + private void paintLastValue(Graphics g, Dimension d) { Double last = values.getLast(); if (!Double.isNaN(last)) { @@ -253,21 +254,18 @@ public class SensorLiveGraph extends JPanel { } } - private class VisibleRange { - private double minValue; - private double maxValue; + private static class VisibleRange { + private final double minValue; + private final double maxValue; - public double getMinValue() { - return minValue; + public VisibleRange(double minValue, double maxValue) { + this.minValue = minValue; + this.maxValue = maxValue; } - public double getMaxValue() { - return maxValue; - } - - public VisibleRange invoke() { - minValue = Double.MAX_VALUE; - maxValue = -Double.MAX_VALUE; + public static VisibleRange findRange(LinkedList values) { + double minValue = Double.MAX_VALUE; + double maxValue = -Double.MAX_VALUE; for (double value : values) { minValue = Math.min(minValue, value); maxValue = Math.max(maxValue, value); @@ -282,7 +280,7 @@ public class SensorLiveGraph extends JPanel { minValue -= 0.05 * diff; maxValue += 0.05 * diff; } - return this; + return new VisibleRange(minValue, maxValue); } } } diff --git a/java_console/ui/src/com/rusefi/ui/storage/Node.java b/java_console/ui/src/com/rusefi/ui/storage/Node.java index 4b2475e35d..b1c59054ef 100644 --- a/java_console/ui/src/com/rusefi/ui/storage/Node.java +++ b/java_console/ui/src/com/rusefi/ui/storage/Node.java @@ -98,4 +98,8 @@ public class Node { "prefix='" + prefix + '\'' + '}'; } + + public void setProperty(String key, double value) { + setProperty(key, Double.toString(value)); + } } \ No newline at end of file