Delayed A/C compressor switch #922
This commit is contained in:
parent
cc011ee081
commit
448d99a2c8
|
@ -149,6 +149,7 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
return engine->isInShutdownMode();
|
return engine->isInShutdownMode();
|
||||||
case LE_METHOD_VBATT:
|
case LE_METHOD_VBATT:
|
||||||
return getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
|
return getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
#include "fsio_getters.def"
|
||||||
default:
|
default:
|
||||||
warning(CUSTOM_FSIO_UNEXPECTED, "FSIO unexpected %d", action);
|
warning(CUSTOM_FSIO_UNEXPECTED, "FSIO unexpected %d", action);
|
||||||
return NAN;
|
return NAN;
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Tue Sep 10 22:45:42 EDT 2019
|
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Tue Sep 10 23:14:54 EDT 2019
|
||||||
|
|
||||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||||
FSIO_SETTING_FANONTEMPERATURE = 1000,
|
FSIO_SETTING_FANONTEMPERATURE = 1000,
|
||||||
FSIO_SETTING_FANOFFTEMPERATURE = 1001,
|
FSIO_SETTING_FANOFFTEMPERATURE = 1001,
|
||||||
FSIO_SETTING_ALTERNATORCONTROL_OFFSET = 1002,
|
FSIO_SETTING_ALTERNATORCONTROL_OFFSET = 1002,
|
||||||
FSIO_SETTING_ALTERNATORCONTROL_MINVALUE = 1003,
|
FSIO_SETTING_ALTERNATORCONTROL_MINVALUE = 1003,
|
||||||
FSIO_SETTING_ETB_OFFSET = 1004,
|
FSIO_SETTING_ETB_OFFSET = 1004,
|
||||||
FSIO_SETTING_ETB_MINVALUE = 1005,
|
FSIO_SETTING_ETB_MINVALUE = 1005,
|
||||||
FSIO_SETTING_IDLERPMPID_OFFSET = 1006,
|
FSIO_SETTING_IDLERPMPID_OFFSET = 1006,
|
||||||
FSIO_SETTING_IDLERPMPID_MINVALUE = 1007,
|
FSIO_SETTING_IDLERPMPID_MINVALUE = 1007,
|
||||||
FSIO_SETTING_STARTUPFUELPUMPDURATION = 1008,
|
FSIO_SETTING_STARTUPFUELPUMPDURATION = 1008,
|
||||||
FSIO_SETTING_FUELCLOSEDLOOPPID_OFFSET = 1009,
|
FSIO_SETTING_FUELCLOSEDLOOPPID_OFFSET = 1009,
|
||||||
FSIO_SETTING_FUELCLOSEDLOOPPID_MINVALUE = 1010,
|
FSIO_SETTING_FUELCLOSEDLOOPPID_MINVALUE = 1010,
|
||||||
FSIO_SETTING_AUXPID1_OFFSET = 1011,
|
FSIO_SETTING_AUXPID1_OFFSET = 1011,
|
||||||
FSIO_SETTING_AUXPID1_MINVALUE = 1012,
|
FSIO_SETTING_AUXPID1_MINVALUE = 1012,
|
||||||
FSIO_SETTING_AUXPID2_OFFSET = 1013,
|
FSIO_SETTING_AUXPID2_OFFSET = 1013,
|
||||||
FSIO_SETTING_AUXPID2_MINVALUE = 1014,
|
FSIO_SETTING_AUXPID2_MINVALUE = 1014,
|
||||||
FSIO_SETTING_AUXPID3_OFFSET = 1015,
|
FSIO_SETTING_AUXPID3_OFFSET = 1015,
|
||||||
FSIO_SETTING_AUXPID3_MINVALUE = 1016,
|
FSIO_SETTING_AUXPID3_MINVALUE = 1016,
|
||||||
FSIO_SETTING_AUXPID4_OFFSET = 1017,
|
FSIO_SETTING_AUXPID4_OFFSET = 1017,
|
||||||
FSIO_SETTING_AUXPID4_MINVALUE = 1018,
|
FSIO_SETTING_AUXPID4_MINVALUE = 1018,
|
||||||
FSIO_SETTING_IDLETIMINGPID_OFFSET = 1019,
|
FSIO_SETTING_IDLETIMINGPID_OFFSET = 1019,
|
||||||
FSIO_SETTING_IDLETIMINGPID_MINVALUE = 1020,
|
FSIO_SETTING_IDLETIMINGPID_MINVALUE = 1020,
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Tue Sep 10 23:40:30 EDT 2019
|
||||||
|
|
||||||
|
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||||
|
case FSIO_SETTING_FANONTEMPERATURE:
|
||||||
|
return engineConfiguration->fanOnTemperature;
|
||||||
|
case FSIO_SETTING_FANOFFTEMPERATURE:
|
||||||
|
return engineConfiguration->fanOffTemperature;
|
||||||
|
case FSIO_SETTING_ALTERNATORCONTROL_OFFSET:
|
||||||
|
return engineConfiguration->alternatorControl.offset;
|
||||||
|
case FSIO_SETTING_ALTERNATORCONTROL_MINVALUE:
|
||||||
|
return engineConfiguration->alternatorControl.minValue;
|
||||||
|
case FSIO_SETTING_ETB_OFFSET:
|
||||||
|
return engineConfiguration->etb.offset;
|
||||||
|
case FSIO_SETTING_ETB_MINVALUE:
|
||||||
|
return engineConfiguration->etb.minValue;
|
||||||
|
case FSIO_SETTING_IDLERPMPID_OFFSET:
|
||||||
|
return engineConfiguration->idleRpmPid.offset;
|
||||||
|
case FSIO_SETTING_IDLERPMPID_MINVALUE:
|
||||||
|
return engineConfiguration->idleRpmPid.minValue;
|
||||||
|
case FSIO_SETTING_STARTUPFUELPUMPDURATION:
|
||||||
|
return engineConfiguration->startUpFuelPumpDuration;
|
||||||
|
case FSIO_SETTING_FUELCLOSEDLOOPPID_OFFSET:
|
||||||
|
return engineConfiguration->fuelClosedLoopPid.offset;
|
||||||
|
case FSIO_SETTING_FUELCLOSEDLOOPPID_MINVALUE:
|
||||||
|
return engineConfiguration->fuelClosedLoopPid.minValue;
|
||||||
|
case FSIO_SETTING_AUXPID1_OFFSET:
|
||||||
|
return engineConfiguration->auxPid[0].offset;
|
||||||
|
case FSIO_SETTING_AUXPID1_MINVALUE:
|
||||||
|
return engineConfiguration->auxPid[0].minValue;
|
||||||
|
case FSIO_SETTING_AUXPID2_OFFSET:
|
||||||
|
return engineConfiguration->auxPid[1].offset;
|
||||||
|
case FSIO_SETTING_AUXPID2_MINVALUE:
|
||||||
|
return engineConfiguration->auxPid[1].minValue;
|
||||||
|
case FSIO_SETTING_AUXPID3_OFFSET:
|
||||||
|
return engineConfiguration->auxPid[2].offset;
|
||||||
|
case FSIO_SETTING_AUXPID3_MINVALUE:
|
||||||
|
return engineConfiguration->auxPid[2].minValue;
|
||||||
|
case FSIO_SETTING_AUXPID4_OFFSET:
|
||||||
|
return engineConfiguration->auxPid[3].offset;
|
||||||
|
case FSIO_SETTING_AUXPID4_MINVALUE:
|
||||||
|
return engineConfiguration->auxPid[3].minValue;
|
||||||
|
case FSIO_SETTING_IDLETIMINGPID_OFFSET:
|
||||||
|
return engineConfiguration->idleTimingPid.offset;
|
||||||
|
case FSIO_SETTING_IDLETIMINGPID_MINVALUE:
|
||||||
|
return engineConfiguration->idleTimingPid.minValue;
|
|
@ -21,6 +21,7 @@ java -DSystemOut.name=gen_config ^
|
||||||
-c_defines controllers\generated\rusefi_generated.h ^
|
-c_defines controllers\generated\rusefi_generated.h ^
|
||||||
-c_destination controllers\generated\engine_configuration_generated_structures.h ^
|
-c_destination controllers\generated\engine_configuration_generated_structures.h ^
|
||||||
-c_fsio_constants controllers\generated\fsio_enums_generated.def ^
|
-c_fsio_constants controllers\generated\fsio_enums_generated.def ^
|
||||||
|
-c_fsio_getters controllers\generated\fsio_getters.def ^
|
||||||
-java_destination ../java_console/models/src/com/rusefi/config/generated/Fields.java ^
|
-java_destination ../java_console/models/src/com/rusefi/config/generated/Fields.java ^
|
||||||
-romraider_destination ../java_console/rusefi.xml ^
|
-romraider_destination ../java_console/rusefi.xml ^
|
||||||
-skip build/config.gen
|
-skip build/config.gen
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
out/
|
out/
|
||||||
|
rusefi_tool.log
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class ConfigDefinition {
|
||||||
public static final String KEY_TS_DESTINATION = "-ts_destination";
|
public static final String KEY_TS_DESTINATION = "-ts_destination";
|
||||||
private static final String KEY_C_DESTINATION = "-c_destination";
|
private static final String KEY_C_DESTINATION = "-c_destination";
|
||||||
private static final String KEY_C_FSIO_CONSTANTS = "-c_fsio_constants";
|
private static final String KEY_C_FSIO_CONSTANTS = "-c_fsio_constants";
|
||||||
|
private static final String KEY_C_FSIO_GETTERS = "-c_fsio_getters";
|
||||||
private static final String KEY_C_DEFINES = "-c_defines";
|
private static final String KEY_C_DEFINES = "-c_defines";
|
||||||
private static final String KEY_WITH_C_DEFINES = "-with_c_defines";
|
private static final String KEY_WITH_C_DEFINES = "-with_c_defines";
|
||||||
private static final String KEY_JAVA_DESTINATION = "-java_destination";
|
private static final String KEY_JAVA_DESTINATION = "-java_destination";
|
||||||
|
@ -66,6 +67,7 @@ public class ConfigDefinition {
|
||||||
String destCHeaderFileName = null;
|
String destCHeaderFileName = null;
|
||||||
String destCDefinesFileName = null;
|
String destCDefinesFileName = null;
|
||||||
String destCFsioConstantsFileName = null;
|
String destCFsioConstantsFileName = null;
|
||||||
|
String destCFsioGettersFileName = null;
|
||||||
String javaDestinationFileName = null;
|
String javaDestinationFileName = null;
|
||||||
String romRaiderDestination = null;
|
String romRaiderDestination = null;
|
||||||
List<String> prependFiles = new ArrayList<>();
|
List<String> prependFiles = new ArrayList<>();
|
||||||
|
@ -81,6 +83,8 @@ public class ConfigDefinition {
|
||||||
tsPath = args[i + 1];
|
tsPath = args[i + 1];
|
||||||
} else if (key.equals(KEY_C_DESTINATION)) {
|
} else if (key.equals(KEY_C_DESTINATION)) {
|
||||||
destCHeaderFileName = args[i + 1];
|
destCHeaderFileName = args[i + 1];
|
||||||
|
} else if (key.equals(KEY_C_FSIO_GETTERS)) {
|
||||||
|
destCFsioGettersFileName = args[i + 1];
|
||||||
} else if (key.equals(KEY_C_FSIO_CONSTANTS)) {
|
} else if (key.equals(KEY_C_FSIO_CONSTANTS)) {
|
||||||
destCFsioConstantsFileName = args[i + 1];
|
destCFsioConstantsFileName = args[i + 1];
|
||||||
} else if (key.equals(KEY_ZERO_INIT)) {
|
} else if (key.equals(KEY_ZERO_INIT)) {
|
||||||
|
@ -136,8 +140,8 @@ public class ConfigDefinition {
|
||||||
destinations.add(new FileJavaFieldsConsumer(state, javaDestinationFileName));
|
destinations.add(new FileJavaFieldsConsumer(state, javaDestinationFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destCFsioConstantsFileName != null) {
|
if (destCFsioConstantsFileName != null || destCFsioGettersFileName != null) {
|
||||||
destinations.add(new FileFsioSettingsConsumer(state, destCFsioConstantsFileName));
|
destinations.add(new FileFsioSettingsConsumer(state, destCFsioConstantsFileName, destCFsioGettersFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destinations.isEmpty())
|
if (destinations.isEmpty())
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.regex.Pattern;
|
||||||
* 1/15/15
|
* 1/15/15
|
||||||
*/
|
*/
|
||||||
public class ConfigField {
|
public class ConfigField {
|
||||||
public static final ConfigField VOID = new ConfigField(null, "", null, null, null, 1, null, false, false);
|
public static final ConfigField VOID = new ConfigField(null, "", null, null, null, 1, null, false, false, null, -1);
|
||||||
|
|
||||||
private static final String typePattern = "([\\w\\d_]+)(\\[([\\w\\d]+)(\\s([\\w\\d]+))?\\])?";
|
private static final String typePattern = "([\\w\\d_]+)(\\[([\\w\\d]+)(\\s([\\w\\d]+))?\\])?";
|
||||||
private static final String namePattern = "[[\\w\\d\\s_]]+";
|
private static final String namePattern = "[[\\w\\d\\s_]]+";
|
||||||
|
@ -36,6 +36,8 @@ public class ConfigField {
|
||||||
private final boolean isIterate;
|
private final boolean isIterate;
|
||||||
private final ReaderState state;
|
private final ReaderState state;
|
||||||
private boolean fsioVisible;
|
private boolean fsioVisible;
|
||||||
|
private final String individualName;
|
||||||
|
private final int indexWithinArray;
|
||||||
|
|
||||||
public ConfigField(ReaderState state,
|
public ConfigField(ReaderState state,
|
||||||
String name,
|
String name,
|
||||||
|
@ -45,8 +47,10 @@ public class ConfigField {
|
||||||
int arraySize,
|
int arraySize,
|
||||||
String tsInfo,
|
String tsInfo,
|
||||||
boolean isIterate,
|
boolean isIterate,
|
||||||
boolean fsioVisible) {
|
boolean fsioVisible, String individualName, int indexWithinArray) {
|
||||||
this.fsioVisible = fsioVisible;
|
this.fsioVisible = fsioVisible;
|
||||||
|
this.individualName = individualName;
|
||||||
|
this.indexWithinArray = indexWithinArray;
|
||||||
Objects.requireNonNull(name, comment + " " + type);
|
Objects.requireNonNull(name, comment + " " + type);
|
||||||
assertNoWhitespaces(name);
|
assertNoWhitespaces(name);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -65,6 +69,19 @@ public class ConfigField {
|
||||||
this.isIterate = isIterate;
|
this.isIterate = isIterate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCFieldName() {
|
||||||
|
return getIndividualName() == null ? getName() : getIndividualName() + "["
|
||||||
|
+ (getIndexWithinArray() - 1) + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndividualName() {
|
||||||
|
return individualName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndexWithinArray() {
|
||||||
|
return indexWithinArray;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isBit() {
|
public boolean isBit() {
|
||||||
return BOOLEAN_T.equalsIgnoreCase(type);
|
return BOOLEAN_T.equalsIgnoreCase(type);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +127,7 @@ public class ConfigField {
|
||||||
|
|
||||||
|
|
||||||
ConfigField field = new ConfigField(state, name, comment, arraySizeAsText, type, arraySize,
|
ConfigField field = new ConfigField(state, name, comment, arraySizeAsText, type, arraySize,
|
||||||
tsInfo, isIterate, isFsioVisible);
|
tsInfo, isIterate, isFsioVisible, null, -1);
|
||||||
SystemOut.println("type " + type);
|
SystemOut.println("type " + type);
|
||||||
SystemOut.println("name " + name);
|
SystemOut.println("name " + name);
|
||||||
SystemOut.println("comment " + comment);
|
SystemOut.println("comment " + comment);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class ConfigStructure {
|
||||||
if (fillSize != 0) {
|
if (fillSize != 0) {
|
||||||
ConfigField fill = new ConfigField(state, "alignmentFill", "need 4 byte alignment",
|
ConfigField fill = new ConfigField(state, "alignmentFill", "need 4 byte alignment",
|
||||||
"" + fillSize,
|
"" + fillSize,
|
||||||
TypesHelper.UINT8_T, fillSize, null, false, false);
|
TypesHelper.UINT8_T, fillSize, null, false, false, null, -1);
|
||||||
addBoth(fill);
|
addBoth(fill);
|
||||||
}
|
}
|
||||||
totalSize += fillSize;
|
totalSize += fillSize;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ReaderState {
|
||||||
comment = line.substring(index + 1);
|
comment = line.substring(index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigField bitField = new ConfigField(state, bitName, comment, null, BOOLEAN_T, 0, null, false, false);
|
ConfigField bitField = new ConfigField(state, bitName, comment, null, BOOLEAN_T, 0, null, false, false, null, -1);
|
||||||
state.stack.peek().addBoth(bitField);
|
state.stack.peek().addBoth(bitField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ public class ReaderState {
|
||||||
structure.addC(cf);
|
structure.addC(cf);
|
||||||
for (int i = 1; i <= cf.getArraySize(); i++) {
|
for (int i = 1; i <= cf.getArraySize(); i++) {
|
||||||
ConfigField element = new ConfigField(state, cf.getName() + i, cf.getComment(), null,
|
ConfigField element = new ConfigField(state, cf.getName() + i, cf.getComment(), null,
|
||||||
cf.getType(), 1, cf.getTsInfo(), false, false);
|
cf.getType(), 1, cf.getTsInfo(), false, false, cf.getName(), i);
|
||||||
structure.addTs(element);
|
structure.addTs(element);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,21 +10,29 @@ import static com.rusefi.ConfigDefinition.EOL;
|
||||||
|
|
||||||
public class FileFsioSettingsConsumer extends FsioSettingsConsumer {
|
public class FileFsioSettingsConsumer extends FsioSettingsConsumer {
|
||||||
private final LazyFile enumFile;
|
private final LazyFile enumFile;
|
||||||
|
private final LazyFile gettersFile;
|
||||||
|
|
||||||
public FileFsioSettingsConsumer(ReaderState state, String destCFsioConstantsFileName) {
|
public FileFsioSettingsConsumer(ReaderState state, String destCFsioConstantsFileName, String destCFsioGettersFileName) {
|
||||||
super(state);
|
super(state);
|
||||||
enumFile = new LazyFile(destCFsioConstantsFileName);
|
enumFile = new LazyFile(destCFsioConstantsFileName);
|
||||||
|
gettersFile = new LazyFile(destCFsioGettersFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startFile() {
|
public void startFile() {
|
||||||
enumFile.write("// this file " + ConfigDefinition.MESSAGE + ConfigDefinition.EOL + EOL);
|
enumFile.write("// this file " + ConfigDefinition.MESSAGE + ConfigDefinition.EOL + EOL);
|
||||||
enumFile.write("// by " + getClass() + EOL);
|
enumFile.write("// by " + getClass() + EOL);
|
||||||
|
|
||||||
|
gettersFile.write("// this file " + ConfigDefinition.MESSAGE + ConfigDefinition.EOL + EOL);
|
||||||
|
gettersFile.write("// by " + getClass() + EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endFile() throws IOException {
|
public void endFile() throws IOException {
|
||||||
enumFile.write(enumDefinition.toString());
|
enumFile.write(enumDefinition.toString());
|
||||||
enumFile.close();
|
enumFile.close();
|
||||||
|
|
||||||
|
gettersFile.write(getContent());
|
||||||
|
gettersFile.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,23 +34,24 @@ public abstract class FsioSettingsConsumer implements ConfigurationConsumer {
|
||||||
@Override
|
@Override
|
||||||
public void handleEndStruct(ConfigStructure structure) {
|
public void handleEndStruct(ConfigStructure structure) {
|
||||||
if (state.stack.isEmpty()) {
|
if (state.stack.isEmpty()) {
|
||||||
handleFields(structure.tsFields, "");
|
handleFields(structure.tsFields, "", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFields(List<ConfigField> tsFields, String prefix) {
|
private void handleFields(List<ConfigField> tsFields, String prefix, String cFieldPrefix) {
|
||||||
|
|
||||||
for (int i = 0; i < tsFields.size(); i++) {
|
for (int i = 0; i < tsFields.size(); i++) {
|
||||||
ConfigField cf = tsFields.get(i);
|
ConfigField cf = tsFields.get(i);
|
||||||
writeOneField(cf, prefix);
|
writeOneField(cf, prefix, cFieldPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeOneField(ConfigField configField, String prefix) {
|
private void writeOneField(ConfigField configField, String prefix, String cNamePrefix) {
|
||||||
ConfigStructure cs = configField.getState().structures.get(configField.getType());
|
ConfigStructure cs = configField.getState().structures.get(configField.getType());
|
||||||
if (cs != null) {
|
if (cs != null) {
|
||||||
String extraPrefix = cs.withPrefix ? configField.getName() + "_" : "";
|
String extraPrefix = cs.withPrefix ? configField.getName() + "." : "";
|
||||||
handleFields(cs.tsFields, prefix + extraPrefix);
|
String cFieldPrefix = cs.withPrefix ? configField.getCFieldName() + "." : "";
|
||||||
|
handleFields(cs.tsFields, prefix + extraPrefix, prefix + cFieldPrefix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,10 +59,17 @@ public abstract class FsioSettingsConsumer implements ConfigurationConsumer {
|
||||||
|
|
||||||
String nameWithPrefix = prefix + configField.getName();
|
String nameWithPrefix = prefix + configField.getName();
|
||||||
|
|
||||||
enumDefinition.append("\tFSIO_SETTING_" + nameWithPrefix.toUpperCase() + " = " + currentIndex++ + ",\n");
|
String enumName = "FSIO_SETTING_" + nameWithPrefix.replaceAll("\\.", "_").toUpperCase();
|
||||||
|
enumDefinition.append("\t" +
|
||||||
|
enumName + " = " + currentIndex++ + ",\n");
|
||||||
|
|
||||||
|
|
||||||
content.append(nameWithPrefix + "\n");
|
String cFieldName = cNamePrefix + configField.getCFieldName();
|
||||||
|
|
||||||
|
|
||||||
|
content.append("\tcase " + enumName + ":\n");
|
||||||
|
content.append("\t\treturn engineConfiguration->" + cFieldName + ";\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@ public class ConfigFieldParserTest {
|
||||||
"end_struct\n" +
|
"end_struct\n" +
|
||||||
"struct_no_prefix engine_configuration_s\n" +
|
"struct_no_prefix engine_configuration_s\n" +
|
||||||
"\tpid_s alternatorControl;\n" +
|
"\tpid_s alternatorControl;\n" +
|
||||||
"\tpid_s etb;\n" +
|
"#define ETB_COUNT 2\n" +
|
||||||
|
"\tpid_s[ETB_COUNT iterate] etb;\n" +
|
||||||
"end_struct\n" +
|
"end_struct\n" +
|
||||||
"" +
|
"" +
|
||||||
"";
|
"";
|
||||||
|
@ -83,30 +84,47 @@ public class ConfigFieldParserTest {
|
||||||
state.readBufferedReader(reader, Arrays.asList(javaFieldsConsumer, fsioSettingsConsumer));
|
state.readBufferedReader(reader, Arrays.asList(javaFieldsConsumer, fsioSettingsConsumer));
|
||||||
|
|
||||||
|
|
||||||
assertEquals(javaFieldsConsumer.getJavaFieldsWriter(), "\tpublic static final Field OFFSET = Field.create(\"OFFSET\", 0, FieldType.INT16);\n" +
|
assertEquals("\tpublic static final Field OFFSET = Field.create(\"OFFSET\", 0, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 2, FieldType.INT16);\n" +
|
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 2, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field MINVALUE = Field.create(\"MINVALUE\", 4, FieldType.INT16);\n" +
|
"\tpublic static final Field MINVALUE = Field.create(\"MINVALUE\", 4, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field ALTERNATORCONTROL_OFFSET = Field.create(\"ALTERNATORCONTROL_OFFSET\", 0, FieldType.INT16);\n" +
|
"\tpublic static final Field ALTERNATORCONTROL_OFFSET = Field.create(\"ALTERNATORCONTROL_OFFSET\", 0, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field ALTERNATORCONTROL_PERIODMS = Field.create(\"ALTERNATORCONTROL_PERIODMS\", 2, FieldType.INT16);\n" +
|
"\tpublic static final Field ALTERNATORCONTROL_PERIODMS = Field.create(\"ALTERNATORCONTROL_PERIODMS\", 2, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field ALTERNATORCONTROL_MINVALUE = Field.create(\"ALTERNATORCONTROL_MINVALUE\", 4, FieldType.INT16);\n" +
|
"\tpublic static final Field ALTERNATORCONTROL_MINVALUE = Field.create(\"ALTERNATORCONTROL_MINVALUE\", 4, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field ETB_OFFSET = Field.create(\"ETB_OFFSET\", 8, FieldType.INT16);\n" +
|
"\tpublic static final Field ETB1_OFFSET = Field.create(\"ETB1_OFFSET\", 8, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field ETB_PERIODMS = Field.create(\"ETB_PERIODMS\", 10, FieldType.INT16);\n" +
|
"\tpublic static final Field ETB1_PERIODMS = Field.create(\"ETB1_PERIODMS\", 10, FieldType.INT16);\n" +
|
||||||
"\tpublic static final Field ETB_MINVALUE = Field.create(\"ETB_MINVALUE\", 12, FieldType.INT16);\n");
|
"\tpublic static final Field ETB1_MINVALUE = Field.create(\"ETB1_MINVALUE\", 12, FieldType.INT16);\n" +
|
||||||
|
"\tpublic static final Field ETB2_OFFSET = Field.create(\"ETB2_OFFSET\", 16, FieldType.INT16);\n" +
|
||||||
|
"\tpublic static final Field ETB2_PERIODMS = Field.create(\"ETB2_PERIODMS\", 18, FieldType.INT16);\n" +
|
||||||
|
"\tpublic static final Field ETB2_MINVALUE = Field.create(\"ETB2_MINVALUE\", 20, FieldType.INT16);\n",
|
||||||
|
javaFieldsConsumer.getJavaFieldsWriter());
|
||||||
|
|
||||||
assertEquals(fsioSettingsConsumer.getContent(), "offset\n" +
|
assertEquals("\tcase FSIO_SETTING_OFFSET:\n" +
|
||||||
"minValue\n" +
|
"\t\treturn engineConfiguration->offset;\n" +
|
||||||
"alternatorControl_offset\n" +
|
"\tcase FSIO_SETTING_MINVALUE:\n" +
|
||||||
"alternatorControl_minValue\n" +
|
"\t\treturn engineConfiguration->minValue;\n" +
|
||||||
"etb_offset\n" +
|
"\tcase FSIO_SETTING_ALTERNATORCONTROL_OFFSET:\n" +
|
||||||
"etb_minValue\n");
|
"\t\treturn engineConfiguration->alternatorControl.offset;\n" +
|
||||||
|
"\tcase FSIO_SETTING_ALTERNATORCONTROL_MINVALUE:\n" +
|
||||||
|
"\t\treturn engineConfiguration->alternatorControl.minValue;\n" +
|
||||||
|
"\tcase FSIO_SETTING_ETB1_OFFSET:\n" +
|
||||||
|
"\t\treturn engineConfiguration->etb[0].offset;\n" +
|
||||||
|
"\tcase FSIO_SETTING_ETB1_MINVALUE:\n" +
|
||||||
|
"\t\treturn engineConfiguration->etb[0].minValue;\n" +
|
||||||
|
"\tcase FSIO_SETTING_ETB2_OFFSET:\n" +
|
||||||
|
"\t\treturn engineConfiguration->etb[1].offset;\n" +
|
||||||
|
"\tcase FSIO_SETTING_ETB2_MINVALUE:\n" +
|
||||||
|
"\t\treturn engineConfiguration->etb[1].minValue;\n",
|
||||||
|
fsioSettingsConsumer.getContent());
|
||||||
|
|
||||||
assertEquals(fsioSettingsConsumer.getEnumDefinition(),
|
assertEquals("\tFSIO_SETTING_OFFSET = 1000,\n" +
|
||||||
"\tFSIO_SETTING_OFFSET = 1000,\n" +
|
|
||||||
"\tFSIO_SETTING_MINVALUE = 1001,\n" +
|
"\tFSIO_SETTING_MINVALUE = 1001,\n" +
|
||||||
"\tFSIO_SETTING_ALTERNATORCONTROL_OFFSET = 1002,\n" +
|
"\tFSIO_SETTING_ALTERNATORCONTROL_OFFSET = 1002,\n" +
|
||||||
"\tFSIO_SETTING_ALTERNATORCONTROL_MINVALUE = 1003,\n" +
|
"\tFSIO_SETTING_ALTERNATORCONTROL_MINVALUE = 1003,\n" +
|
||||||
"\tFSIO_SETTING_ETB_OFFSET = 1004,\n" +
|
"\tFSIO_SETTING_ETB1_OFFSET = 1004,\n" +
|
||||||
"\tFSIO_SETTING_ETB_MINVALUE = 1005,\n");
|
"\tFSIO_SETTING_ETB1_MINVALUE = 1005,\n" +
|
||||||
|
"\tFSIO_SETTING_ETB2_OFFSET = 1006,\n" +
|
||||||
|
"\tFSIO_SETTING_ETB2_MINVALUE = 1007,\n",
|
||||||
|
fsioSettingsConsumer.getEnumDefinition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue