diff --git a/firmware/config/boards/hellen/hellen-honda-k/prepend.txt b/firmware/config/boards/hellen/hellen-honda-k/prepend.txt index 8a57d6de76..afff933302 100644 --- a/firmware/config/boards/hellen/hellen-honda-k/prepend.txt +++ b/firmware/config/boards/hellen/hellen-honda-k/prepend.txt @@ -7,6 +7,8 @@ #define ts_show_clt_iat_pullup false #define ts_show_egt false +#define ts_drop_template_comments true + #define ts_show_etb_pins false #define ts_show_analog_divider false #define ts_show_spi false diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index e808f97e2b..14d8a2ca23 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -78,7 +78,8 @@ enable2ndByteCanID = false retrieveConfigError = "e" ;communication settings - pageActivationDelay = 500 ; Milliseconds delay after burn command. See https://sourceforge.net/p/rusefi/tickets/77/ +; Milliseconds delay after burn command. See https://sourceforge.net/p/rusefi/tickets/77/ + pageActivationDelay = 500 ;e.g. put writeblocks off and add an interwrite delay writeBlocks = on interWriteDelay = 10 diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/output/TSProjectConsumer.java b/java_tools/configuration_definition/src/main/java/com/rusefi/output/TSProjectConsumer.java index b885e1cd16..c4ac33565b 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/output/TSProjectConsumer.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/output/TSProjectConsumer.java @@ -20,10 +20,11 @@ public class TSProjectConsumer implements ConfigurationConsumer { private static final String TS_CONDITION = "@@if_"; public static final String SETTING_CONTEXT_HELP_END = "SettingContextHelpEnd"; public static final String SETTING_CONTEXT_HELP = "SettingContextHelp"; + public static final String TS_DROP_TEMPLATE_COMMENTS = "ts_drop_template_comments"; private final String tsPath; private final ReaderStateImpl state; - public boolean dropComments; + private boolean dropComments; private int totalTsSize; private final TsOutput tsOutput; @@ -52,7 +53,9 @@ public class TSProjectConsumer implements ConfigurationConsumer { tsHeader.write(tsContent.getPrefix()); tsHeader.write("; " + CONFIG_DEFINITION_START + ToolUtil.EOL); - tsHeader.write("; this section " + state.getHeader() + ToolUtil.EOL + ToolUtil.EOL); + if (!dropComments) { + tsHeader.write("; this section " + state.getHeader() + ToolUtil.EOL + ToolUtil.EOL); + } tsHeader.write("pageSize = " + totalTsSize + ToolUtil.EOL); tsHeader.write("page = 1" + ToolUtil.EOL); tsHeader.write(fieldsSection); @@ -83,6 +86,8 @@ public class TSProjectConsumer implements ConfigurationConsumer { StringBuilder prefix = new StringBuilder(); StringBuilder postfix = new StringBuilder(); + dropComments = Boolean.valueOf(state.getVariableRegistry().get(TS_DROP_TEMPLATE_COMMENTS)); + boolean isBeforeStartTag = true; boolean isAfterEndTag = false; String line; @@ -95,7 +100,7 @@ public class TSProjectConsumer implements ConfigurationConsumer { isAfterEndTag = true; continue; } - if (line.trim().startsWith("!") && dropComments) + if (line.trim().startsWith(";") && dropComments) continue; if (line.contains(TS_CONDITION)) { diff --git a/java_tools/configuration_definition/src/test/java/com/rusefi/test/TSProjectConsumerTest.java b/java_tools/configuration_definition/src/test/java/com/rusefi/test/TSProjectConsumerTest.java index 0c0a6f9130..081bb72c49 100644 --- a/java_tools/configuration_definition/src/test/java/com/rusefi/test/TSProjectConsumerTest.java +++ b/java_tools/configuration_definition/src/test/java/com/rusefi/test/TSProjectConsumerTest.java @@ -13,9 +13,9 @@ import java.io.StringBufferInputStream; import static com.rusefi.AssertCompatibility.assertEquals; public class TSProjectConsumerTest { - private static final String smallContent = "hello = \"!\"\n" + - "world!comment\n" + - "!comment2\n" + + private static final String smallContent = "hello = \";\"\n" + + "world;comment\n" + + ";comment2\n" + "end\n"; @Test @@ -141,11 +141,12 @@ public class TSProjectConsumerTest { @Test public void testReaderDropComments() throws IOException { - TSProjectConsumer consumer = new TestTSProjectConsumer(null, new ReaderStateImpl()); - consumer.dropComments = true; + ReaderStateImpl state = new ReaderStateImpl(); + TSProjectConsumer consumer = new TestTSProjectConsumer(null, state); + state.getVariableRegistry().put(TSProjectConsumer.TS_DROP_TEMPLATE_COMMENTS, "true"); TsFileContent content = consumer.getTsFileContent(new StringBufferInputStream(smallContent)); - assertEquals("hello = \"!\"\n" + - "world!comment\n" + + assertEquals("hello = \";\"\n" + + "world;comment\n" + "end\n", content.getPrefix()); assertEquals("", content.getPostfix()); }}