This commit is contained in:
parent
4b9f69b02e
commit
22a947d498
|
@ -3144,4 +3144,4 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
|
|||
;addTool = toolName, PanelName
|
||||
addTool = veTableGenerator, "VE Table Generator", veTableTbl
|
||||
addTool = afrTableGenerator, "AFR Table Generator", afrTableTbl
|
||||
|
||||
|
Binary file not shown.
|
@ -1,11 +1,13 @@
|
|||
package com.rusefi.output;
|
||||
|
||||
import com.opensr5.ini.field.IniField;
|
||||
import com.rusefi.*;
|
||||
import com.rusefi.util.LazyFile;
|
||||
import com.rusefi.util.Output;
|
||||
import com.rusefi.util.SystemOut;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.rusefi.util.IoUtils.CHARSET;
|
||||
import static com.rusefi.ConfigDefinition.EOL;
|
||||
|
@ -83,13 +85,32 @@ public class TSProjectConsumer implements ConfigurationConsumer {
|
|||
tsHeader.write("\t" + addTabsUpTo(nameWithPrefix, LENGTH) + "\t\t= scalar, ");
|
||||
tsHeader.write(TypesHelper.convertToTs(configField.getType()) + ",");
|
||||
tsHeader.write("\t" + tsPosition + ",");
|
||||
tsHeader.write("\t" + configField.getTsInfo());
|
||||
tsHeader.write("\t" + handleTsInfo(configField.getTsInfo()));
|
||||
tsPosition += configField.getArraySize() * configField.getElementSize();
|
||||
}
|
||||
tsHeader.write(EOL);
|
||||
return tsPosition;
|
||||
}
|
||||
|
||||
private static String handleTsInfo(String tsInfo) {
|
||||
String[] fields = tsInfo.split("\\,");
|
||||
if (fields.length > 1) {
|
||||
/**
|
||||
* Evaluate static math on .ini layer to simplify rusEFI java and rusEFI PHP project consumers
|
||||
* https://github.com/rusefi/web_backend/issues/97
|
||||
*/
|
||||
fields[1] = " " + IniField.parseDouble(fields[1]);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String f : fields) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(f);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private int writeTunerStudio(ConfigStructure configStructure, String prefix, Writer tsHeader, int tsPosition) throws IOException {
|
||||
BitState bitState = new BitState();
|
||||
for (int i = 0; i < configStructure.tsFields.size(); i++) {
|
||||
|
|
|
@ -116,7 +116,7 @@ public class ConfigFieldParserTest {
|
|||
|
||||
state.readBufferedReader(reader, Collections.singletonList(javaFieldsConsumer));
|
||||
|
||||
assertEquals("\tperiodMs\t\t\t\t\t\t= scalar, S16,\t0,\t\"ms\", {1/10}, 0, 0, 3000, 0\n" +
|
||||
assertEquals("\tperiodMs\t\t\t\t\t\t= scalar, S16,\t0,\t\"ms\", 0.1, 0, 0, 3000, 0\n" +
|
||||
"\talignmentFill_at_2\t\t\t\t= array, U08,\t2,\t[2],\t\"units\", 1, 0, -20, 100, 0\n" +
|
||||
"; total TS size = 4\n", new String(writer.toCharArray()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue