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 {
|
public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
private final StringBuilder graphLines = new StringBuilder();
|
private final StringBuilder graphLines = new StringBuilder();
|
||||||
|
private final StringBuilder graphList = new StringBuilder();
|
||||||
|
|
||||||
private final StringBuilder indicatorPanel = new StringBuilder();
|
private final StringBuilder indicatorPanel = new StringBuilder();
|
||||||
private final String fragmentName;
|
private final String fragmentName;
|
||||||
private boolean hasIndicators;
|
private boolean hasIndicators;
|
||||||
private int graphLinesCounter;
|
private int graphLinesCounter;
|
||||||
|
private int linesInCurrentGraph;
|
||||||
|
private int currentGraphIndex;
|
||||||
|
|
||||||
public FragmentDialogConsumer(String fragmentName) {
|
public FragmentDialogConsumer(String fragmentName) {
|
||||||
this.fragmentName = fragmentName;
|
this.fragmentName = fragmentName;
|
||||||
|
@ -45,11 +48,22 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
indicatorPanel.append("indicatorPanel = " + getPanelName() + ", 2\n");
|
indicatorPanel.append("indicatorPanel = " + getPanelName() + ", 2\n");
|
||||||
}
|
}
|
||||||
indicatorPanel.append("\tindicator = {" + configField.getName() + "}, \"No\", \"Yes\"\n");
|
indicatorPanel.append("\tindicator = {" + configField.getName() + "}, \"No\", \"Yes\"\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (graphLinesCounter == 0)
|
||||||
|
startNewGraph();
|
||||||
graphLinesCounter++;
|
graphLinesCounter++;
|
||||||
|
|
||||||
|
if (linesInCurrentGraph == 4) {
|
||||||
|
linesInCurrentGraph = 0;
|
||||||
|
currentGraphIndex++;
|
||||||
|
startNewGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
graphLines.append("\tgraphLine = " + configField.getName() + "\n");
|
graphLines.append("\tgraphLine = " + configField.getName() + "\n");
|
||||||
|
linesInCurrentGraph++;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
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
|
@NotNull
|
||||||
private String getPanelName() {
|
private String getPanelName() {
|
||||||
return fragmentName + "IndicatorPanel";
|
return fragmentName + "IndicatorPanel";
|
||||||
|
@ -81,15 +104,12 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
String indicatorPanelUsageLine = (indicatorPanel.length() > 0) ? "\tpanel = " + getPanelName() + "\n" : "";
|
String indicatorPanelUsageLine = (indicatorPanel.length() > 0) ? "\tpanel = " + getPanelName() + "\n" : "";
|
||||||
|
|
||||||
|
|
||||||
String liveGraphControlDeclaration = "liveGraph = " + getGraphControlName() +
|
|
||||||
", " + quote("Graph") + ", South\n";
|
|
||||||
|
|
||||||
return indicatorPanel + "\n" +
|
return indicatorPanel + "\n" +
|
||||||
liveGraphControlDeclaration +
|
|
||||||
graphLines + "\n" +
|
graphLines + "\n" +
|
||||||
dialogDeclaration +
|
dialogDeclaration +
|
||||||
indicatorPanelUsageLine +
|
indicatorPanelUsageLine +
|
||||||
"\tpanel = " + getGraphControlName() + "\n\n"
|
graphList +
|
||||||
|
"\n"
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +120,6 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private String getGraphControlName() {
|
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_present2}, \"No\", \"Yes\"\n" +
|
||||||
"\tindicator = {sd_present3}, \"No\", \"Yes\"\n" +
|
"\tindicator = {sd_present3}, \"No\", \"Yes\"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"liveGraph = ac_stateGraph, \"Graph\", South\n" +
|
"liveGraph = ac_state_1_Graph, \"Graph\", South\n" +
|
||||||
"\tgraphLine = sd_present\n" +
|
|
||||||
"\tgraphLine = sd_present2\n" +
|
|
||||||
"\tgraphLine = sd_present3\n" +
|
|
||||||
"\tgraphLine = RPMValue\n" +
|
"\tgraphLine = RPMValue\n" +
|
||||||
"\tgraphLine = rpmAcceleration\n" +
|
"\tgraphLine = rpmAcceleration\n" +
|
||||||
"\tgraphLine = speedToRpmRatio\n" +
|
"\tgraphLine = speedToRpmRatio\n" +
|
||||||
"\tgraphLine = alignmentFill_at_10\n" +
|
"\tgraphLine = alignmentFill_at_10\n" +
|
||||||
|
"liveGraph = ac_state_3_Graph, \"Graph\", South\n" +
|
||||||
"\tgraphLine = luaTimingMult\n" +
|
"\tgraphLine = luaTimingMult\n" +
|
||||||
"\tgraphLine = vehicleSpeedKph\n" +
|
"\tgraphLine = vehicleSpeedKph\n" +
|
||||||
"\tgraphLine = internalMcuTemperature\n" +
|
"\tgraphLine = internalMcuTemperature\n" +
|
||||||
|
@ -51,7 +49,8 @@ public class FragmentDialogConsumerTest {
|
||||||
"\n" +
|
"\n" +
|
||||||
"dialog = ac_stateDialog, \"ac_state\"\n" +
|
"dialog = ac_stateDialog, \"ac_state\"\n" +
|
||||||
"\tpanel = ac_stateIndicatorPanel\n" +
|
"\tpanel = ac_stateIndicatorPanel\n" +
|
||||||
"\tpanel = ac_stateGraph\n" +
|
"\tpanel = ac_state_1_Graph\n" +
|
||||||
|
"\tpanel = ac_state_3_Graph\n" +
|
||||||
"\n",
|
"\n",
|
||||||
fragmentDialogConsumer.getContent());
|
fragmentDialogConsumer.getContent());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue