diff --git a/java_tools/ConfigDefinition.jar b/java_tools/ConfigDefinition.jar index d6d2667a28..34c3b51c0f 100644 Binary files a/java_tools/ConfigDefinition.jar and b/java_tools/ConfigDefinition.jar differ diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderState.java b/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderState.java index 43d958096f..e64c37f05f 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderState.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderState.java @@ -24,8 +24,6 @@ import static com.rusefi.output.JavaSensorsConsumer.quote; * 12/19/18 */ public class ReaderState { - // https://github.com/rusefi/web_backend/issues/166 - private static final int MSQ_LENGTH_LIMIT = 34; // used to update other files public List inputFiles = new ArrayList<>(); @@ -313,8 +311,6 @@ public class ReaderState { private static String getCommentWithIndex(ConfigField cf, int i) { String unquoted = unquote(cf.getCommentOrName()); String string = unquoted + " " + i; - if (string.length() > MSQ_LENGTH_LIMIT) - throw new IllegalStateException("[" + string + "] is too long for rusEFI online"); return quote(string); } diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/output/TsOutput.java b/java_tools/configuration_definition/src/main/java/com/rusefi/output/TsOutput.java index d3c8160dc0..6dc5d36e3f 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/output/TsOutput.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/output/TsOutput.java @@ -4,6 +4,7 @@ import com.opensr5.ini.field.IniField; import com.rusefi.ConfigField; import com.rusefi.ReaderState; import com.rusefi.TypesHelper; +import com.rusefi.VariableRegistry; import java.io.IOException; @@ -16,6 +17,8 @@ import static com.rusefi.output.JavaSensorsConsumer.quote; */ @SuppressWarnings({"StringConcatenationInsideStringBufferAppend", "DanglingJavadoc"}) public class TsOutput { + // https://github.com/rusefi/web_backend/issues/166 + private static final int MSQ_LENGTH_LIMIT = 34; private final StringBuilder settingContextHelp = new StringBuilder(); private final boolean isConstantsSection; private final boolean registerOffsets; @@ -51,7 +54,16 @@ public class TsOutput { ConfigStructure cs = configField.getStructureType(); if (configField.getComment() != null && configField.getComment().trim().length() > 0 && cs == null) { - settingContextHelp.append("\t" + nameWithPrefix + " = \"" + configField.getCommentContent() + "\"" + EOL); + String commentContent = configField.getCommentContent(); + commentContent = state.variableRegistry.applyVariables(commentContent); + int newLineIndex = commentContent.indexOf("\\n"); + if (newLineIndex != -1) { + // we might have detailed long comment for header javadoc but need a short field name for logs/rusEFI online + commentContent = commentContent.substring(0, newLineIndex); + } +// if (!isConstantsSection && commentContent.length() > MSQ_LENGTH_LIMIT) +// throw new IllegalStateException("[" + commentContent + "] is too long for rusEFI online"); + settingContextHelp.append("\t" + nameWithPrefix + " = \"" + commentContent + "\"" + EOL); } if (registerOffsets) { state.variableRegistry.register(nameWithPrefix + "_offset", tsPosition); diff --git a/java_tools/configuration_definition/src/test/java/com/rusefi/test/OutputsTest.java b/java_tools/configuration_definition/src/test/java/com/rusefi/test/OutputsTest.java index 2eec8eadb1..dd9557aa8e 100644 --- a/java_tools/configuration_definition/src/test/java/com/rusefi/test/OutputsTest.java +++ b/java_tools/configuration_definition/src/test/java/com/rusefi/test/OutputsTest.java @@ -12,15 +12,16 @@ import static org.junit.Assert.assertEquals; public class OutputsTest { @Test public void generateSomething() throws IOException { + ReaderState state = new ReaderState(); + state.variableRegistry.register("GAUGE_NAME_FUEL_WALL_CORRECTION", "wall"); String test = "struct total\n" + "float afr_type;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" + - "uint8_t afr_typet;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" + - "bit isForcedInduction;Does the vehicle have a turbo or supercharger?\n" + + "uint8_t afr_typet;@@GAUGE_NAME_FUEL_WALL_CORRECTION@@;\"ms\", 1, 0, 0, 3000, 0\n" + + "bit isForcedInduction;isForcedInduction\\nDoes the vehicle have a turbo or supercharger?\n" + "bit enableFan1WithAc;+Turn on this fan when AC is on.\n" + - "angle_t m_requested_pump;Computed requested pump duration in degrees (not including deadtime)\n" + - "float tCharge;speed density\\nRate-of-change limiter is applied to degrees, so we store both Kelvin and degrees.;\n" + + "angle_t m_requested_pump;Computed requested pump \n" + + "float tCharge;speed density\n" + "end_struct\n"; - ReaderState state = new ReaderState(); OutputsSectionConsumer tsProjectConsumer = new OutputsSectionConsumer(null); state.readBufferedReader(test, tsProjectConsumer);