no graphs for indicators, also limiting number of lines per graph
This commit is contained in:
parent
5a73ef1ae6
commit
403a534ae8
|
@ -10,11 +10,14 @@ import static com.rusefi.output.JavaSensorsConsumer.quote;
|
|||
|
||||
public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||
private final StringBuilder graphLines = new StringBuilder();
|
||||
private final StringBuilder graphList = new StringBuilder();
|
||||
|
||||
private final StringBuilder indicatorPanel = new StringBuilder();
|
||||
private final String fragmentName;
|
||||
private boolean hasIndicators;
|
||||
private int graphLinesCounter;
|
||||
private int linesInCurrentGraph;
|
||||
private int currentGraphIndex;
|
||||
|
||||
public FragmentDialogConsumer(String fragmentName) {
|
||||
this.fragmentName = fragmentName;
|
||||
|
@ -45,11 +48,22 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
|||
indicatorPanel.append("indicatorPanel = " + getPanelName() + ", 2\n");
|
||||
}
|
||||
indicatorPanel.append("\tindicator = {" + configField.getName() + "}, \"No\", \"Yes\"\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (graphLinesCounter == 0)
|
||||
startNewGraph();
|
||||
graphLinesCounter++;
|
||||
|
||||
if (linesInCurrentGraph == 4) {
|
||||
linesInCurrentGraph = 0;
|
||||
currentGraphIndex++;
|
||||
startNewGraph();
|
||||
}
|
||||
|
||||
|
||||
graphLines.append("\tgraphLine = " + configField.getName() + "\n");
|
||||
linesInCurrentGraph++;
|
||||
|
||||
|
||||
return 0;
|
||||
|
@ -59,6 +73,15 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
|||
|
||||
}
|
||||
|
||||
private void startNewGraph() {
|
||||
currentGraphIndex++;
|
||||
graphLines.append("liveGraph = " + getGraphControlName() +
|
||||
", " + quote("Graph") + ", South\n");
|
||||
|
||||
graphList.append("\tpanel = " + getGraphControlName() + "\n");
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getPanelName() {
|
||||
return fragmentName + "IndicatorPanel";
|
||||
|
@ -76,20 +99,17 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
|||
return "";
|
||||
}
|
||||
|
||||
String dialogDeclaration = "dialog = " + getDialogName() +", " + quote(fragmentName) + "\n";
|
||||
String dialogDeclaration = "dialog = " + getDialogName() + ", " + quote(fragmentName) + "\n";
|
||||
|
||||
String indicatorPanelUsageLine = (indicatorPanel.length() > 0) ? "\tpanel = " + getPanelName() + "\n" : "";
|
||||
|
||||
|
||||
String liveGraphControlDeclaration = "liveGraph = " + getGraphControlName() +
|
||||
", " + quote("Graph") + ", South\n";
|
||||
|
||||
return indicatorPanel + "\n" +
|
||||
liveGraphControlDeclaration +
|
||||
graphLines + "\n" +
|
||||
dialogDeclaration +
|
||||
indicatorPanelUsageLine +
|
||||
"\tpanel = " + getGraphControlName() + "\n\n"
|
||||
graphList +
|
||||
"\n"
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -100,6 +120,6 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
|||
|
||||
@NotNull
|
||||
private String getGraphControlName() {
|
||||
return fragmentName + "Graph";
|
||||
return fragmentName + "_" + currentGraphIndex + "_Graph";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,14 +36,12 @@ public class FragmentDialogConsumerTest {
|
|||
"\tindicator = {sd_present2}, \"No\", \"Yes\"\n" +
|
||||
"\tindicator = {sd_present3}, \"No\", \"Yes\"\n" +
|
||||
"\n" +
|
||||
"liveGraph = ac_stateGraph, \"Graph\", South\n" +
|
||||
"\tgraphLine = sd_present\n" +
|
||||
"\tgraphLine = sd_present2\n" +
|
||||
"\tgraphLine = sd_present3\n" +
|
||||
"liveGraph = ac_state_1_Graph, \"Graph\", South\n" +
|
||||
"\tgraphLine = RPMValue\n" +
|
||||
"\tgraphLine = rpmAcceleration\n" +
|
||||
"\tgraphLine = speedToRpmRatio\n" +
|
||||
"\tgraphLine = alignmentFill_at_10\n" +
|
||||
"liveGraph = ac_state_3_Graph, \"Graph\", South\n" +
|
||||
"\tgraphLine = luaTimingMult\n" +
|
||||
"\tgraphLine = vehicleSpeedKph\n" +
|
||||
"\tgraphLine = internalMcuTemperature\n" +
|
||||
|
@ -51,8 +49,9 @@ public class FragmentDialogConsumerTest {
|
|||
"\n" +
|
||||
"dialog = ac_stateDialog, \"ac_state\"\n" +
|
||||
"\tpanel = ac_stateIndicatorPanel\n" +
|
||||
"\tpanel = ac_stateGraph\n" +
|
||||
"\n",
|
||||
"\tpanel = ac_state_1_Graph\n" +
|
||||
"\tpanel = ac_state_3_Graph\n" +
|
||||
"\n",
|
||||
fragmentDialogConsumer.getContent());
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue