diff --git a/java_console/ui/resources/c_sources/ac_control.cpp b/java_console/ui/resources/c_sources/ac_control.cpp index cd0855e28d..ece4b79512 100644 --- a/java_console/ui/resources/c_sources/ac_control.cpp +++ b/java_console/ui/resources/c_sources/ac_control.cpp @@ -26,6 +26,10 @@ bool AcController::getAcState() { return false; } + if (engineTooFast) { + invokeMethodRed(); + return false; + } auto clt = Sensor::get(SensorType::Clt); diff --git a/java_console/ui/src/main/java/com/rusefi/CodeWalkthrough.java b/java_console/ui/src/main/java/com/rusefi/CodeWalkthrough.java index edac0ccb49..ff33ff65f7 100644 --- a/java_console/ui/src/main/java/com/rusefi/CodeWalkthrough.java +++ b/java_console/ui/src/main/java/com/rusefi/CodeWalkthrough.java @@ -17,14 +17,11 @@ import org.jetbrains.annotations.NotNull; import java.awt.*; import java.util.ArrayList; import java.util.Stack; -import java.util.concurrent.atomic.AtomicReference; import static com.devexperts.logging.Logging.getLogging; public class CodeWalkthrough { private static final Logging log = getLogging(CodeWalkthrough.class); - // inactive statements within inactive branch of code - light red - public static final Color INACTIVE_BRANCH = new Color(255, 102, 102); // active statements - light green public static final Color ACTIVE_STATEMENT = new Color(102, 255, 102); // cost past active return statement @@ -98,18 +95,22 @@ public class CodeWalkthrough { if (log.debugEnabled()) log.debug("CONDITIONAL: REQUESTING VALUE " + conditionVariable); - Boolean state = (Boolean) valueSource.getValue(conditionVariable); - BranchingState branchingState = BranchingState.valueOf(state); - if (log.debugEnabled()) - log.debug("CURRENT STATE ADD " + state); - currentState.add(branchingState); - if (branchingState == BranchingState.BROKEN) { - brokenConditions.add(conditionVariable); - painter.paintBackground(BROKEN_CODE, new Range(ctx)); - } else if (branchingState == BranchingState.TRUE) { - painter.paintBackground(TRUE_CONDITION, new Range(ctx)); + if (currentState.isEmpty()) { + painter.paintBackground(PASSIVE_CODE, new Range(ctx)); } else { - painter.paintBackground(FALSE_CONDITION, new Range(ctx)); + Boolean state = (Boolean) valueSource.getValue(conditionVariable); + BranchingState branchingState = BranchingState.valueOf(state); + if (log.debugEnabled()) + log.debug("CURRENT STATE ADD " + state); + currentState.add(branchingState); + if (branchingState == BranchingState.BROKEN) { + brokenConditions.add(conditionVariable); + painter.paintBackground(BROKEN_CODE, new Range(ctx)); + } else if (branchingState == BranchingState.TRUE) { + painter.paintBackground(TRUE_CONDITION, new Range(ctx)); + } else { + painter.paintBackground(FALSE_CONDITION, new Range(ctx)); + } } } @@ -135,7 +136,7 @@ public class CodeWalkthrough { if (isAlive == BranchingState.BROKEN) { color = BROKEN_CODE; } else { - color = isAlive == BranchingState.TRUE ? ACTIVE_STATEMENT : INACTIVE_BRANCH; + color = isAlive == BranchingState.TRUE ? ACTIVE_STATEMENT : PASSIVE_CODE; } } Range range = new Range(ctx); diff --git a/java_console/ui/src/main/java/com/rusefi/livedata/LiveDataParserPanel.java b/java_console/ui/src/main/java/com/rusefi/livedata/LiveDataParserPanel.java index dc7db0785a..a1457863ce 100644 --- a/java_console/ui/src/main/java/com/rusefi/livedata/LiveDataParserPanel.java +++ b/java_console/ui/src/main/java/com/rusefi/livedata/LiveDataParserPanel.java @@ -34,7 +34,7 @@ import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; /** * this panel shows a live view of rusEFI firmware C/C++ code - * @see LiveDataParserPanelSandbox + * @see LiveDataParserSandbox */ public class LiveDataParserPanel { private static final Logging log = getLogging(LiveDataParserPanel.class); diff --git a/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java b/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java index 588af8c70a..bb472b6da4 100644 --- a/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java +++ b/java_console/ui/src/main/java/com/rusefi/ui/LiveDataPane.java @@ -17,6 +17,7 @@ import java.awt.event.ActionListener; /** * Andrey Belomutskiy, (c) 2013-2020 + * @see LiveDataParserPanel */ public class LiveDataPane { /** @@ -90,7 +91,7 @@ public class LiveDataPane { legend.add(new JLabel("Legend:")); legend.add(createLabel(CodeWalkthrough.TRUE_CONDITION, "'true' condition")); legend.add(createLabel(CodeWalkthrough.FALSE_CONDITION, "'false' condition")); - legend.add(createLabel(CodeWalkthrough.INACTIVE_BRANCH, "inactive branch")); + legend.add(createLabel(CodeWalkthrough.PASSIVE_CODE, "inactive code")); legend.add(createLabel(CodeWalkthrough.ACTIVE_STATEMENT, "active branch")); legend.add(createLabel(CodeWalkthrough.BROKEN_CODE, "No live data")); diff --git a/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java b/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java index c74d9a31bd..8c7fc4d5b0 100644 --- a/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java +++ b/java_console/ui/src/test/java/com/rusefi/ui/livedata/LiveDataParserTest.java @@ -74,9 +74,7 @@ public class LiveDataParserTest { verify(painter).paintBackground(eq(Color.green), any()); verify(painter, times(4)).paintBackground(eq(CodeWalkthrough.ACTIVE_STATEMENT), any()); - verify(painter, times(1)).paintBackground(eq(CodeWalkthrough.INACTIVE_BRANCH), any()); - - verify(painter, times(3)).paintBackground(eq(CodeWalkthrough.PASSIVE_CODE), any()); + verify(painter, times(4)).paintBackground(eq(CodeWalkthrough.PASSIVE_CODE), any()); } private SourceCodePainter run(VariableValueSource valueSource, String sourceCode) {