target lambda & afr log fields broken #4727
This commit is contained in:
parent
7acdbe8766
commit
4b15104c34
Binary file not shown.
|
@ -5,6 +5,8 @@ import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import com.rusefi.TypesHelper;
|
import com.rusefi.TypesHelper;
|
||||||
|
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import static com.rusefi.ToolUtil.EOL;
|
import static com.rusefi.ToolUtil.EOL;
|
||||||
import static com.rusefi.output.JavaSensorsConsumer.quote;
|
import static com.rusefi.output.JavaSensorsConsumer.quote;
|
||||||
|
|
||||||
|
@ -19,6 +21,7 @@ public class TsOutput {
|
||||||
private final StringBuilder settingContextHelp = new StringBuilder();
|
private final StringBuilder settingContextHelp = new StringBuilder();
|
||||||
private final boolean isConstantsSection;
|
private final boolean isConstantsSection;
|
||||||
private final StringBuilder tsHeader = new StringBuilder();
|
private final StringBuilder tsHeader = new StringBuilder();
|
||||||
|
private final TreeSet<String> usedNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
public TsOutput(boolean longForm) {
|
public TsOutput(boolean longForm) {
|
||||||
this.isConstantsSection = longForm;
|
this.isConstantsSection = longForm;
|
||||||
|
@ -41,6 +44,14 @@ public class TsOutput {
|
||||||
int bitIndex = it.bitState.get();
|
int bitIndex = it.bitState.get();
|
||||||
String nameWithPrefix = prefix + configField.getName();
|
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)) {
|
if (configField.getName().startsWith(ConfigStructure.ALIGNMENT_FILL_AT)) {
|
||||||
tsPosition += configField.getSize(next);
|
tsPosition += configField.getSize(next);
|
||||||
return tsPosition;
|
return tsPosition;
|
||||||
|
|
|
@ -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());
|
"\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() {
|
public void nameDuplicate() {
|
||||||
String test = "struct total\n" +
|
String test = "struct total\n" +
|
||||||
"float afr_type;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +
|
"float afr_type;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +
|
||||||
|
|
Loading…
Reference in New Issue