target lambda & afr log fields broken #4727

This commit is contained in:
rusefillc 2022-11-02 21:59:09 -04:00
parent 7acdbe8766
commit 4b15104c34
3 changed files with 12 additions and 1 deletions

Binary file not shown.

View File

@ -5,6 +5,8 @@ import com.rusefi.ConfigField;
import com.rusefi.ReaderState;
import com.rusefi.TypesHelper;
import java.util.TreeSet;
import static com.rusefi.ToolUtil.EOL;
import static com.rusefi.output.JavaSensorsConsumer.quote;
@ -19,6 +21,7 @@ public class TsOutput {
private final StringBuilder settingContextHelp = new StringBuilder();
private final boolean isConstantsSection;
private final StringBuilder tsHeader = new StringBuilder();
private final TreeSet<String> usedNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
public TsOutput(boolean longForm) {
this.isConstantsSection = longForm;
@ -41,6 +44,14 @@ public class TsOutput {
int bitIndex = it.bitState.get();
String nameWithPrefix = prefix + configField.getName();
/**
* in 'Constants' section we have conditional sections and this check is not smart enough to handle those right
* A simple solution would be to allow only one variable per each conditional section - would be simpler not to check against previous field
*/
if (!usedNames.add(nameWithPrefix) && !isConstantsSection) {
throw new IllegalStateException(nameWithPrefix + " already present");
}
if (configField.getName().startsWith(ConfigStructure.ALIGNMENT_FILL_AT)) {
tsPosition += configField.getSize(next);
return tsPosition;

View File

@ -201,7 +201,7 @@ public class OutputsTest {
"\ttriggerSimulatorPins3 = \"Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\"\n", tsProjectConsumer.getSettingContextHelp().toString());
}
@Test
@Test(expected = IllegalStateException.class)
public void nameDuplicate() {
String test = "struct total\n" +
"float afr_type;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +