restoring ldmp
This commit is contained in:
parent
83f37cbccb
commit
127dd67838
|
@ -388,6 +388,7 @@ void EtbController::update(efitick_t) {
|
|||
ClosedLoopController::update();
|
||||
|
||||
DISPLAY_STATE(Engine)
|
||||
DISPLAY(DISPLAY_IF(1))
|
||||
DISPLAY_TEXT(Electronic_Throttle);
|
||||
DISPLAY_SENSOR(TPS)
|
||||
DISPLAY_TEXT(eol);
|
||||
|
|
|
@ -3,9 +3,8 @@ package com.rusefi.ldmp.generated;
|
|||
import com.rusefi.ldmp.*;
|
||||
|
||||
public class ElectronicThrottleMeta {
|
||||
/* todo: restore this functionality
|
||||
public static final Request[] CONTENT = new Request[]{
|
||||
new IfRequest("Engine", "hasEtbPedalPositionSensor",
|
||||
new IfRequest("Engine", "1",
|
||||
new Request[]{
|
||||
new TextRequest("Electronic_Throttle"),
|
||||
new SensorRequest("TPS"),
|
||||
|
@ -42,5 +41,4 @@ public class ElectronicThrottleMeta {
|
|||
new TextRequest("No_Pedal_Sensor"),
|
||||
}),
|
||||
};
|
||||
*/
|
||||
}
|
Binary file not shown.
|
@ -2,6 +2,7 @@
|
|||
|
||||
<property name="javac.source" value="1.8"/>
|
||||
<property name="javac.target" value="1.8"/>
|
||||
<property name="console_path" value="../../java_console"/>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="build"/>
|
||||
|
@ -16,7 +17,10 @@
|
|||
destdir="build/classes"
|
||||
classpath="lib/junit.jar:../../java_console/lib/annotations.jar:lib/snakeyaml.jar">
|
||||
<src path="src"/>
|
||||
<src path="../../java_console/logging/src"/>
|
||||
<src path="${console_path}/autoupdate/src"/>
|
||||
<src path="${console_path}/inifile/src"/>
|
||||
<src path="${console_path}/logging/src"/>
|
||||
<src path="${console_path}/models/src"/>
|
||||
<src path="../enum_to_string/src"/>
|
||||
</javac>
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ public class LiveDocsMetaParser {
|
|||
private static final String DISPLAY_ELSE = "DISPLAY_ELSE";
|
||||
private static final String DISPLAY_ENDIF = "DISPLAY_ENDIF";
|
||||
private static final char QUOTE_SYMBOL = '"';
|
||||
public static final String TODO_MAKE_THIS_DESTINATION_PARAMETER = "/ui/src/main/java/com/rusefi/ldmp/generated/";
|
||||
private static StringBuilder prefix = new StringBuilder();
|
||||
|
||||
private static String readLineByLine(String filePath) throws IOException {
|
||||
|
@ -48,7 +49,9 @@ public class LiveDocsMetaParser {
|
|||
|
||||
String className = getClassName(inputFileName);
|
||||
String javaCode = generateJavaCode(metaInfo, className);
|
||||
FileWriter fw = new FileWriter(destinationPath + "/ui/src/com/rusefi/ldmp/generated/" + className + ".java");
|
||||
String fullDestination = destinationPath + TODO_MAKE_THIS_DESTINATION_PARAMETER;
|
||||
new File(fullDestination).mkdirs();
|
||||
FileWriter fw = new FileWriter(fullDestination + className + ".java");
|
||||
fw.write(javaCode);
|
||||
fw.close();
|
||||
SystemOut.close();
|
||||
|
@ -59,10 +62,10 @@ public class LiveDocsMetaParser {
|
|||
if (!new File(fileName).exists())
|
||||
throw new IllegalStateException("Not found " + fileName);
|
||||
String content = readLineByLine(fileName);
|
||||
return parse(content);
|
||||
return parse(content, fileName);
|
||||
}
|
||||
|
||||
public static MetaInfo parse(String string) {
|
||||
public static MetaInfo parse(String string, String context) {
|
||||
Stack<List<Request>> stack = new Stack<>();
|
||||
|
||||
|
||||
|
@ -131,7 +134,7 @@ public class LiveDocsMetaParser {
|
|||
}
|
||||
} else if (DISPLAY_ELSE.equalsIgnoreCase(token)) {
|
||||
if (stack.isEmpty())
|
||||
throw new IllegalStateException("No IF statement on stack");
|
||||
throw new IllegalStateException("No IF statement on stack while we have DISPLAY_ELSE while " + context);
|
||||
List<Request> onStack = stack.peek();
|
||||
if (onStack.isEmpty())
|
||||
throw new IllegalStateException("Empty on stack");
|
||||
|
|
|
@ -8,6 +8,10 @@ import java.util.List;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class LiveDocsMetaParserTest {
|
||||
public static MetaInfo parse(String s) {
|
||||
return LiveDocsMetaParser.parse(s, "unit_test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getClassName() {
|
||||
assertEquals("TpsMeta", LiveDocsMetaParser.getClassName("controllers/sensors/tps.cpp"));
|
||||
|
@ -16,7 +20,7 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void parseConfigElements() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse("\t\t// TCHARGE_MODE_RPM_TPS\n" +
|
||||
MetaInfo r = parse("\t\t// TCHARGE_MODE_RPM_TPS\n" +
|
||||
"\t\tfloat minRpmKcurrentTPS = interpolateMsg(\"minRpm\", tpMin, DISPLAY_CONFIG(tChargeMinRpmMinTps), tpMax,\n" +
|
||||
"\t\t\t\t/***display*/CONFIG(tChargeMinRpmMaxTps), tps);\n" +
|
||||
"\t\tfloat maxRpmKcurrentTPS = interpolateMsg(\"maxRpm\", tpMin, DISPLAY_CONFIG(tChargeMaxRpmMinTps), tpMax,\n" +
|
||||
|
@ -29,7 +33,7 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void parseField() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse(
|
||||
MetaInfo r = parse(
|
||||
"DISPLAY_STATE(tps)\n" +
|
||||
"\tDISPLAY_TEXT(Analog_MCU_reads);\n" +
|
||||
"\tengine->engineState.DISPLAY_FIELD(currentTpsAdc) = adc;\n" +
|
||||
|
@ -40,7 +44,7 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void parseTextWithSpecialCharacters() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse(
|
||||
MetaInfo r = parse(
|
||||
"DISPLAY_TEXT(\"Analog: !MCU_reads\");"
|
||||
);
|
||||
assertEquals(1, r.first().size());
|
||||
|
@ -50,7 +54,7 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void parseTextWithSpecialCharactersAndSpaces() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse(
|
||||
MetaInfo r = parse(
|
||||
"DISPLAY_TEXT(\"Analog: !MCU_reads\");"
|
||||
);
|
||||
assertEquals(1, r.first().size());
|
||||
|
@ -60,7 +64,7 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void parseDisplayConfig() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse("\t\t// DISPLAY_TEXT(interpolate(\")\n" +
|
||||
MetaInfo r = parse("\t\t// DISPLAY_TEXT(interpolate(\")\n" +
|
||||
"+\t\tDISPLAY_SENSOR(RPM) DISPLAY_TEXT(TCHARGE_MODE_RPM_TPS)\n" +
|
||||
"\t\tfloat minRpmKcurrentTPS = interpolateMsg(\"minRpm\", tpMin, DISPLAY_CONFIG(tChargeMinRpmMinTps), tpMax,\n");
|
||||
assertEquals(4, r.first().size());
|
||||
|
@ -86,7 +90,7 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void testField() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse(
|
||||
MetaInfo r = parse(
|
||||
"DISPLAY_STATE(tps)\n" +
|
||||
"tm->DISPLAY_FIELD(voltageMCU) = getVoltage(\"term\", config->adcChannel);\n" +
|
||||
|
||||
|
@ -99,7 +103,7 @@ public class LiveDocsMetaParserTest {
|
|||
|
||||
@Test
|
||||
public void parseIf() {
|
||||
MetaInfo r = LiveDocsMetaParser.parse("\tDisPLAY_IF(cond)\t// DISPLAY_TEXT(\"interpolate(\")\n" +
|
||||
MetaInfo r = parse("\tDisPLAY_IF(cond)\t// DISPLAY_TEXT(\"interpolate(\")\n" +
|
||||
"+\t\tDISPLAY_SENSOR(RPM)" +
|
||||
"/* DISPLAY_ElsE */ DISPLAY_TEXT(\"TCHARGE_MODE_RPM_TPS\")\n" +
|
||||
"\t\tfloat minRpmKcurrentTPS = interpolateMsg(\"minRpm\", tpMin, DISPLAY_CONFIG(tChargeMinRpmMinTps), tpMax,\n" +
|
||||
|
|
Loading…
Reference in New Issue