parent
f584c6dc84
commit
d79743de90
Binary file not shown.
|
@ -29,7 +29,9 @@ import static com.rusefi.output.GetOutputValueConsumer.wrapSwitchStatement;
|
||||||
public class GetConfigValueConsumer implements ConfigurationConsumer {
|
public class GetConfigValueConsumer implements ConfigurationConsumer {
|
||||||
private static final String CONFIG_ENGINE_CONFIGURATION = "config->engineConfiguration.";
|
private static final String CONFIG_ENGINE_CONFIGURATION = "config->engineConfiguration.";
|
||||||
private static final String ENGINE_CONFIGURATION = "engineConfiguration.";
|
private static final String ENGINE_CONFIGURATION = "engineConfiguration.";
|
||||||
static final String FILE_HEADER = "#include \"pch.h\"\n" +
|
static final String FILE_HEADER =
|
||||||
|
"// generated by " + GetConfigValueConsumer.class.getSimpleName() + ".java\n" +
|
||||||
|
"#include \"pch.h\"\n" +
|
||||||
"#include \"value_lookup.h\"\n";
|
"#include \"value_lookup.h\"\n";
|
||||||
|
|
||||||
private static final String GET_METHOD_HEADER =
|
private static final String GET_METHOD_HEADER =
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
|
||||||
|
|
||||||
int hash = HashUtil.hash(pair.getUserName());
|
int hash = HashUtil.hash(pair.getUserName());
|
||||||
if (hashConflicts.get(hash).get() == 1) {
|
if (hashConflicts.get(hash).get() == 1) {
|
||||||
|
switchBody.append("// " + pair.getUserName() + "\n");
|
||||||
switchBody.append(before);
|
switchBody.append(before);
|
||||||
switchBody.append("\t\tcase " + hash + ":\n");
|
switchBody.append("\t\tcase " + hash + ":\n");
|
||||||
switchBody.append("\t" + returnLine);
|
switchBody.append("\t" + returnLine);
|
||||||
|
|
|
@ -59,13 +59,16 @@ public class GetConfigValueConsumerTest {
|
||||||
"\t}\n" +
|
"\t}\n" +
|
||||||
"\t}\n", getConfigValueConsumer.getSetterBody());
|
"\t}\n", getConfigValueConsumer.getSetterBody());
|
||||||
|
|
||||||
assertEquals("#include \"pch.h\"\n" +
|
assertEquals("// generated by GetConfigValueConsumer.java\n" +
|
||||||
|
"#include \"pch.h\"\n" +
|
||||||
"#include \"value_lookup.h\"\n" +
|
"#include \"value_lookup.h\"\n" +
|
||||||
"float getConfigValueByName(const char *name) {\n" +
|
"float getConfigValueByName(const char *name) {\n" +
|
||||||
"\tint hash = djb2lowerCase(name);\n" +
|
"\tint hash = djb2lowerCase(name);\n" +
|
||||||
"\tswitch(hash) {\n" +
|
"\tswitch(hash) {\n" +
|
||||||
|
"// iat.config.tempC_1\n" +
|
||||||
"\t\tcase -672272162:\n" +
|
"\t\tcase -672272162:\n" +
|
||||||
"\t\t\treturn config->iat.config.tempC_1;\n" +
|
"\t\t\treturn config->iat.config.tempC_1;\n" +
|
||||||
|
"// iat.adcChannel\n" +
|
||||||
"\t\tcase -1237776078:\n" +
|
"\t\tcase -1237776078:\n" +
|
||||||
"\t\t\treturn config->iat.adcChannel;\n" +
|
"\t\t\treturn config->iat.adcChannel;\n" +
|
||||||
"\t}\n" +
|
"\t}\n" +
|
||||||
|
@ -91,8 +94,10 @@ public class GetConfigValueConsumerTest {
|
||||||
assertEquals("float getConfigValueByName(const char *name) {\n" +
|
assertEquals("float getConfigValueByName(const char *name) {\n" +
|
||||||
"\tint hash = djb2lowerCase(name);\n" +
|
"\tint hash = djb2lowerCase(name);\n" +
|
||||||
"\tswitch(hash) {\n" +
|
"\tswitch(hash) {\n" +
|
||||||
|
"// iat.config.tempC_1\n" +
|
||||||
"\t\tcase -672272162:\n" +
|
"\t\tcase -672272162:\n" +
|
||||||
"\t\t\treturn config->iat.config.tempC_1;\n" +
|
"\t\t\treturn config->iat.config.tempC_1;\n" +
|
||||||
|
"// iat.adcChannel\n" +
|
||||||
"\t\tcase -1237776078:\n" +
|
"\t\tcase -1237776078:\n" +
|
||||||
"\t\t\treturn config->iat.adcChannel;\n" +
|
"\t\t\treturn config->iat.adcChannel;\n" +
|
||||||
"\t}\n" +
|
"\t}\n" +
|
||||||
|
@ -155,37 +160,52 @@ public class GetConfigValueConsumerTest {
|
||||||
GetConfigValueConsumer getConfigValueConsumer = new GetConfigValueConsumer();
|
GetConfigValueConsumer getConfigValueConsumer = new GetConfigValueConsumer();
|
||||||
state.readBufferedReader(test, getConfigValueConsumer);
|
state.readBufferedReader(test, getConfigValueConsumer);
|
||||||
|
|
||||||
assertEquals("#include \"pch.h\"\n" +
|
assertEquals("// generated by GetConfigValueConsumer.java\n" +
|
||||||
|
"#include \"pch.h\"\n" +
|
||||||
"#include \"value_lookup.h\"\n" +
|
"#include \"value_lookup.h\"\n" +
|
||||||
"float getConfigValueByName(const char *name) {\n" +
|
"float getConfigValueByName(const char *name) {\n" +
|
||||||
"\tint hash = djb2lowerCase(name);\n" +
|
"\tint hash = djb2lowerCase(name);\n" +
|
||||||
"\tswitch(hash) {\n" +
|
"\tswitch(hash) {\n" +
|
||||||
|
"// clt.config.tempC_1\n" +
|
||||||
"\t\tcase -1832527325:\n" +
|
"\t\tcase -1832527325:\n" +
|
||||||
"\t\t\treturn config->clt.config.tempC_1;\n" +
|
"\t\t\treturn config->clt.config.tempC_1;\n" +
|
||||||
|
"// clt.config.map.sensor.highValue\n" +
|
||||||
"\t\tcase 1819278123:\n" +
|
"\t\tcase 1819278123:\n" +
|
||||||
"\t\t\treturn config->clt.config.map.sensor.highValue;\n" +
|
"\t\t\treturn config->clt.config.map.sensor.highValue;\n" +
|
||||||
|
"// clt.config.map.sensor.hwChannel\n" +
|
||||||
"\t\tcase 581685574:\n" +
|
"\t\tcase 581685574:\n" +
|
||||||
"\t\t\treturn config->clt.config.map.sensor.hwChannel;\n" +
|
"\t\t\treturn config->clt.config.map.sensor.hwChannel;\n" +
|
||||||
|
"// clt.config.injector.flow\n" +
|
||||||
"\t\tcase 382574846:\n" +
|
"\t\tcase 382574846:\n" +
|
||||||
"\t\t\treturn config->clt.config.injector.flow;\n" +
|
"\t\t\treturn config->clt.config.injector.flow;\n" +
|
||||||
|
"// clt.config.bias_resistor\n" +
|
||||||
"\t\tcase -653172717:\n" +
|
"\t\tcase -653172717:\n" +
|
||||||
"\t\t\treturn config->clt.config.bias_resistor;\n" +
|
"\t\t\treturn config->clt.config.bias_resistor;\n" +
|
||||||
|
"// clt.adcChannel\n" +
|
||||||
"\t\tcase -1144186889:\n" +
|
"\t\tcase -1144186889:\n" +
|
||||||
"\t\t\treturn config->clt.adcChannel;\n" +
|
"\t\t\treturn config->clt.adcChannel;\n" +
|
||||||
|
"// issue_294_31\n" +
|
||||||
"\t\tcase -1571463185:\n" +
|
"\t\tcase -1571463185:\n" +
|
||||||
"\t\t\treturn config->issue_294_31;\n" +
|
"\t\t\treturn config->issue_294_31;\n" +
|
||||||
|
"// baseFuel\n" +
|
||||||
"\t\tcase 727098956:\n" +
|
"\t\tcase 727098956:\n" +
|
||||||
"\t\t\treturn config->baseFuel;\n" +
|
"\t\t\treturn config->baseFuel;\n" +
|
||||||
|
"// afr_type\n" +
|
||||||
"\t\tcase -1120008897:\n" +
|
"\t\tcase -1120008897:\n" +
|
||||||
"\t\t\treturn config->afr_type;\n" +
|
"\t\t\treturn config->afr_type;\n" +
|
||||||
|
"// speedToRpmRatio\n" +
|
||||||
"\t\tcase -685727673:\n" +
|
"\t\tcase -685727673:\n" +
|
||||||
"\t\t\treturn config->speedToRpmRatio;\n" +
|
"\t\t\treturn config->speedToRpmRatio;\n" +
|
||||||
|
"// afr_typet\n" +
|
||||||
"\t\tcase 1694412179:\n" +
|
"\t\tcase 1694412179:\n" +
|
||||||
"\t\t\treturn config->afr_typet;\n" +
|
"\t\t\treturn config->afr_typet;\n" +
|
||||||
|
"// vehicleSpeedKph\n" +
|
||||||
"\t\tcase -1925174695:\n" +
|
"\t\tcase -1925174695:\n" +
|
||||||
"\t\t\treturn config->vehicleSpeedKph;\n" +
|
"\t\t\treturn config->vehicleSpeedKph;\n" +
|
||||||
|
"// isForcedInduction\n" +
|
||||||
"\t\tcase -617915487:\n" +
|
"\t\tcase -617915487:\n" +
|
||||||
"\t\t\treturn config->isForcedInduction;\n" +
|
"\t\t\treturn config->isForcedInduction;\n" +
|
||||||
|
"// enableFan1WithAc\n" +
|
||||||
"\t\tcase -298185774:\n" +
|
"\t\tcase -298185774:\n" +
|
||||||
"\t\t\treturn config->enableFan1WithAc;\n" +
|
"\t\t\treturn config->enableFan1WithAc;\n" +
|
||||||
"\t}\n" +
|
"\t}\n" +
|
||||||
|
|
|
@ -150,19 +150,23 @@ public class OutputsTest {
|
||||||
outputValueConsumer.conditional = "EFI_BOOST_CONTROL";
|
outputValueConsumer.conditional = "EFI_BOOST_CONTROL";
|
||||||
state.readBufferedReader(test, (outputValueConsumer));
|
state.readBufferedReader(test, (outputValueConsumer));
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"#include \"pch.h\"\n" +
|
"// generated by GetConfigValueConsumer.java\n" +
|
||||||
|
"#include \"pch.h\"\n" +
|
||||||
"#include \"value_lookup.h\"\n" +
|
"#include \"value_lookup.h\"\n" +
|
||||||
"float getOutputValueByName(const char *name) {\n" +
|
"float getOutputValueByName(const char *name) {\n" +
|
||||||
"\tint hash = djb2lowerCase(name);\n" +
|
"\tint hash = djb2lowerCase(name);\n" +
|
||||||
"\tswitch(hash) {\n" +
|
"\tswitch(hash) {\n" +
|
||||||
|
"// issue_294_31\n" +
|
||||||
"#if EFI_BOOST_CONTROL\n" +
|
"#if EFI_BOOST_CONTROL\n" +
|
||||||
"\t\tcase -1571463185:\n" +
|
"\t\tcase -1571463185:\n" +
|
||||||
"\t\t\treturn engine->outputChannels.issue_294_31;\n" +
|
"\t\t\treturn engine->outputChannels.issue_294_31;\n" +
|
||||||
"#endif\n" +
|
"#endif\n" +
|
||||||
|
"// enableFan1WithAc\n" +
|
||||||
"#if EFI_BOOST_CONTROL\n" +
|
"#if EFI_BOOST_CONTROL\n" +
|
||||||
"\t\tcase -298185774:\n" +
|
"\t\tcase -298185774:\n" +
|
||||||
"\t\t\treturn engine->outputChannels.enableFan1WithAc;\n" +
|
"\t\t\treturn engine->outputChannels.enableFan1WithAc;\n" +
|
||||||
"#endif\n" +
|
"#endif\n" +
|
||||||
|
"// hwChannel\n" +
|
||||||
"#if EFI_BOOST_CONTROL\n" +
|
"#if EFI_BOOST_CONTROL\n" +
|
||||||
"\t\tcase -709106787:\n" +
|
"\t\tcase -709106787:\n" +
|
||||||
"\t\t\treturn engine->outputChannels.hwChannel;\n" +
|
"\t\t\treturn engine->outputChannels.hwChannel;\n" +
|
||||||
|
|
Loading…
Reference in New Issue