mirror of https://github.com/rusefi/rusefi-1.git
parent
b8ad330a37
commit
3899d6a36e
|
@ -26,6 +26,10 @@ bool AcController::getAcState() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (engineTooFast) {
|
||||
invokeMethodRed();
|
||||
return false;
|
||||
}
|
||||
|
||||
auto clt = Sensor::get(SensorType::Clt);
|
||||
|
||||
|
|
|
@ -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,6 +95,9 @@ public class CodeWalkthrough {
|
|||
if (log.debugEnabled())
|
||||
log.debug("CONDITIONAL: REQUESTING VALUE " + conditionVariable);
|
||||
|
||||
if (currentState.isEmpty()) {
|
||||
painter.paintBackground(PASSIVE_CODE, new Range(ctx));
|
||||
} else {
|
||||
Boolean state = (Boolean) valueSource.getValue(conditionVariable);
|
||||
BranchingState branchingState = BranchingState.valueOf(state);
|
||||
if (log.debugEnabled())
|
||||
|
@ -112,6 +112,7 @@ public class CodeWalkthrough {
|
|||
painter.paintBackground(FALSE_CONDITION, new Range(ctx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitSelectionStatement(CPP14Parser.SelectionStatementContext 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"));
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue