generate SD log category correctly (#5023)
This commit is contained in:
parent
2474b04c85
commit
f2441a6688
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.core.SensorCategory;
|
||||||
|
|
||||||
import com.rusefi.ConfigField;
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
|
|
||||||
|
@ -39,6 +41,14 @@ public class SdCardFieldsContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLine(ConfigField configField, String prefix, String name) {
|
private String getLine(ConfigField configField, String prefix, String name) {
|
||||||
|
String categoryStr = configField.getCategory();
|
||||||
|
|
||||||
|
if(categoryStr == null) {
|
||||||
|
categoryStr = "";
|
||||||
|
} else {
|
||||||
|
categoryStr = ", " + categoryStr;
|
||||||
|
}
|
||||||
|
|
||||||
return "\t{" + home + "." + name +
|
return "\t{" + home + "." + name +
|
||||||
", "
|
", "
|
||||||
+ DataLogConsumer.getHumanGaugeName(prefix, configField) +
|
+ DataLogConsumer.getHumanGaugeName(prefix, configField) +
|
||||||
|
@ -46,9 +56,7 @@ public class SdCardFieldsContent {
|
||||||
quote(configField.getUnits()) +
|
quote(configField.getUnits()) +
|
||||||
", " +
|
", " +
|
||||||
configField.getDigits() +
|
configField.getDigits() +
|
||||||
", " +
|
categoryStr +
|
||||||
configField.getCategory() +
|
|
||||||
|
|
||||||
"},\n";
|
"},\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,17 @@ public class SdCardFieldsGeneratorTest {
|
||||||
|
|
||||||
String test = "struct_no_prefix output_channels_s\n" +
|
String test = "struct_no_prefix output_channels_s\n" +
|
||||||
"\tfloat autoscale internalMcuTemperature\n" +
|
"\tfloat autoscale internalMcuTemperature\n" +
|
||||||
"uint16_t autoscale RPMValue;@@GAUGE_NAME_RPM@@;\"RPM\",1, 0, 0, 8000, 2\n" +
|
"uint16_t autoscale RPMValue;@@GAUGE_NAME_RPM@@;\"RPM\",1, 0, 0, 8000, 2, \"myCategory\"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"uint16_t rpmAcceleration;dRPM;\"RPM/s\",1, 0, 0, 5, 2\n" +
|
"uint16_t rpmAcceleration;dRPM;\"RPM/s\",1, 0, 0, 5, 2\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\tuint16_t autoscale speedToRpmRatio;@@GAUGE_NAME_GEAR_RATIO@@;\"value\",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0\n" +
|
"\tuint16_t autoscale speedToRpmRatio;@@GAUGE_NAME_GEAR_RATIO@@;\"value\",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0\n" +
|
||||||
"end_struct";
|
"end_struct";
|
||||||
|
|
||||||
processAndAssert(test, "\t{engine->outputChannels.internalMcuTemperature, \"internalMcuTemperature\", \"\", 0, null},\n" +
|
processAndAssert(test, "\t{engine->outputChannels.internalMcuTemperature, \"internalMcuTemperature\", \"\", 0},\n" +
|
||||||
"\t{engine->outputChannels.RPMValue, \"hello\", \"RPM\", 2, null},\n" +
|
"\t{engine->outputChannels.RPMValue, \"hello\", \"RPM\", 2, \"myCategory\"},\n" +
|
||||||
"\t{engine->outputChannels.rpmAcceleration, \"dRPM\", \"RPM/s\", 2, null},\n" +
|
"\t{engine->outputChannels.rpmAcceleration, \"dRPM\", \"RPM/s\", 2},\n" +
|
||||||
"\t{engine->outputChannels.speedToRpmRatio, \"ra\", \"value\", 0, null},\n" +
|
"\t{engine->outputChannels.speedToRpmRatio, \"ra\", \"value\", 0},\n" +
|
||||||
"", actor);
|
"", actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class SdCardFieldsGeneratorTest {
|
||||||
processAndAssert("struct_no_prefix output_channels_s\n" +
|
processAndAssert("struct_no_prefix output_channels_s\n" +
|
||||||
"uint16_t autoscale RPMValue;feee;\"RPM\",1, 0, 0, 8000, 2\n" +
|
"uint16_t autoscale RPMValue;feee;\"RPM\",1, 0, 0, 8000, 2\n" +
|
||||||
"bit sd_logging_internal\n" +
|
"bit sd_logging_internal\n" +
|
||||||
"end_struct", "\t{engine->outputChannels.RPMValue, \"feee\", \"RPM\", 2, null},\n", readerState -> {
|
"end_struct", "\t{engine->outputChannels.RPMValue, \"feee\", \"RPM\", 2},\n", readerState -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,10 @@ public class SdCardFieldsGeneratorTest {
|
||||||
public void array() {
|
public void array() {
|
||||||
processAndAssert("struct_no_prefix output_channels_s\n" +
|
processAndAssert("struct_no_prefix output_channels_s\n" +
|
||||||
"uint16_t[4 iterate] recentErrorCode;;\"error\", 1, 0, 0, 0, 0\n" +
|
"uint16_t[4 iterate] recentErrorCode;;\"error\", 1, 0, 0, 0, 0\n" +
|
||||||
"end_struct", "\t{engine->outputChannels.recentErrorCode[0], \"recentErrorCode 1\", \"error\", 0, null},\n" +
|
"end_struct", "\t{engine->outputChannels.recentErrorCode[0], \"recentErrorCode 1\", \"error\", 0},\n" +
|
||||||
"\t{engine->outputChannels.recentErrorCode[1], \"recentErrorCode 2\", \"error\", 0, null},\n" +
|
"\t{engine->outputChannels.recentErrorCode[1], \"recentErrorCode 2\", \"error\", 0},\n" +
|
||||||
"\t{engine->outputChannels.recentErrorCode[2], \"recentErrorCode 3\", \"error\", 0, null},\n" +
|
"\t{engine->outputChannels.recentErrorCode[2], \"recentErrorCode 3\", \"error\", 0},\n" +
|
||||||
"\t{engine->outputChannels.recentErrorCode[3], \"recentErrorCode 4\", \"error\", 0, null},\n", readerState -> {
|
"\t{engine->outputChannels.recentErrorCode[3], \"recentErrorCode 4\", \"error\", 0},\n", readerState -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class SdCardFieldsGeneratorTest {
|
||||||
" end_struct\n" +
|
" end_struct\n" +
|
||||||
"\tpid_status_s alternatorStatus\n" +
|
"\tpid_status_s alternatorStatus\n" +
|
||||||
"end_struct",
|
"end_struct",
|
||||||
"\t{engine->outputChannels.alternatorStatus.pTerm, \"alternatorStatus.pTerm\", \"\", 2, null},\n",
|
"\t{engine->outputChannels.alternatorStatus.pTerm, \"alternatorStatus.pTerm\", \"\", 2},\n",
|
||||||
readerState -> {
|
readerState -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -86,4 +86,4 @@ public class SdCardFieldsGeneratorTest {
|
||||||
state.readBufferedReader(input, consumer);
|
state.readBufferedReader(input, consumer);
|
||||||
assertEquals(expectedOutput, consumer.getBody());
|
assertEquals(expectedOutput, consumer.getBody());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue