one step back for now
This commit is contained in:
Andrey 2022-04-22 01:54:54 -04:00
parent e58de47508
commit e50c678623
4 changed files with 19 additions and 10 deletions

Binary file not shown.

View File

@ -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<String> 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);
}

View File

@ -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);

View File

@ -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);