diff --git a/firmware/gen_config.bat b/firmware/gen_config.bat index 1f893eddfb..1df7f9ac65 100644 --- a/firmware/gen_config.bat +++ b/firmware/gen_config.bat @@ -5,7 +5,7 @@ rem the storage section of rusefi.ini is updated as well rem lazy is broken - TS input is not considered a change rm build/config.gen -java -jar ../java_tools/ConfigDefinition.jar -definition integration\rusefi_config.txt -romraider integration -ts_destination tunerstudio -c_destination controllers\algo -java_destination ../java_console -skip build/config.gen +java -jar ../java_tools/ConfigDefinition.jar -definition integration\rusefi_config.txt -romraider integration -ts_destination tunerstudio -c_defines controllers\algo\rusefi_generated.h -c_destination controllers\algo\engine_configuration_generated_structures.h -java_destination ../java_console -skip build/config.gen rem This would automatically copy latest file to 'dev' TS project diff --git a/java_tools/ConfigDefinition.jar b/java_tools/ConfigDefinition.jar index cec97617d6..58da3e9504 100644 Binary files a/java_tools/ConfigDefinition.jar and b/java_tools/ConfigDefinition.jar differ diff --git a/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java b/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java index 00d0aae3d5..4b213074c9 100644 --- a/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java +++ b/java_tools/configuration_definition/src/com/rusefi/ConfigDefinition.java @@ -24,11 +24,11 @@ public class ConfigDefinition { private static final String ROM_RAIDER_XML_TEMPLATE = "rusefi_template.xml"; private static final String ROM_RAIDER_XML_OUTPUT = "rusefi.xml"; - private static final String ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H = "engine_configuration_generated_structures.h"; private static final String KEY_DEFINITION = "-definition"; private static final String KEY_ROM_INPUT = "-romraider"; private static final String KEY_TS_DESTINATION = "-ts_destination"; private static final String KEY_C_DESTINATION = "-c_destination"; + private static final String KEY_C_DEFINES = "-c_defines"; private static final String KEY_CONSOLE_DESTINATION = "-java_destination"; private static final String KEY_PREPEND = "-prepend"; private static final String KEY_SKIP = "-skip"; @@ -48,7 +48,8 @@ public class ConfigDefinition { String definitionInputFile = null; String tsPath = null; - String headerDestinationFolder = null; + String destCHeader = null; + String destCDefines = null; String javaConsolePath = null; String prependFile = null; String skipRebuildFile = null; @@ -61,7 +62,9 @@ public class ConfigDefinition { } else if (key.equals(KEY_TS_DESTINATION)) { tsPath = args[i + 1]; } else if (key.equals(KEY_C_DESTINATION)) { - headerDestinationFolder = args[i + 1]; + destCHeader = args[i + 1]; + } else if (key.equals(KEY_C_DEFINES)) { + destCDefines = args[i + 1]; } else if (key.equals(KEY_CONSOLE_DESTINATION)) { javaConsolePath = args[i + 1]; } else if (key.equals(KEY_PREPEND)) { @@ -86,8 +89,6 @@ public class ConfigDefinition { return; } } - String destCHeader = headerDestinationFolder + File.separator + ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H; - System.out.println("Writing C header to " + destCHeader); if (prependFile != null) readPrependValues(prependFile); @@ -98,6 +99,7 @@ public class ConfigDefinition { List destinations = new ArrayList<>(); BufferedWriter cHeader = null; if (destCHeader != null) { + System.out.println("Writing C header to " + destCHeader); cHeader = new BufferedWriter(new FileWriter(destCHeader)); destinations.add(new CHeaderConsumer(cHeader)); } @@ -118,7 +120,8 @@ public class ConfigDefinition { cHeader.close(); - VariableRegistry.INSTANCE.writeNumericsToFile(headerDestinationFolder); + if (destCDefines != null) + VariableRegistry.INSTANCE.writeNumericsToFile(destCDefines); if (javaConsolePath != null && romRaiderInputFile != null) { String inputFileName = romRaiderInputFile + File.separator + ROM_RAIDER_XML_TEMPLATE; diff --git a/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java b/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java index f999d3267f..b41066cc4b 100644 --- a/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java +++ b/java_tools/configuration_definition/src/com/rusefi/VariableRegistry.java @@ -94,8 +94,7 @@ public class VariableRegistry extends TreeMap { register(name + "_hex", Integer.toString(value, 16)); } - public void writeNumericsToFile(String headerDestinationFolder) throws IOException { - String fileName = headerDestinationFolder + File.separator + "rusefi_generated.h"; + public void writeNumericsToFile(String fileName) throws IOException { System.out.println("Writing to " + fileName); BufferedWriter cHeader = new BufferedWriter(new FileWriter(fileName));