mirror of https://github.com/rusefi/rusefi.git
EPIC: Improve toolset for default tune canned tune generation #4871
only: smarter logic of embedded entities
This commit is contained in:
parent
a181d07ccb
commit
169fffe633
|
@ -4,10 +4,13 @@ import com.rusefi.ConfigField;
|
|||
import com.rusefi.ReaderState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ConfigStructure {
|
||||
String UNUSED_ANYTHING_PREFIX = "unused";
|
||||
|
||||
Map<String, ConfigField> getCurrentInstance();
|
||||
|
||||
ConfigStructure getParent();
|
||||
|
||||
String getName();
|
||||
|
|
|
@ -26,6 +26,8 @@ public class ConfigStructureImpl implements ConfigStructure {
|
|||
|
||||
private final Map<String, ConfigField> tsFieldsMap = new TreeMap<>();
|
||||
|
||||
private final Map</*type name*/String, ConfigField> currentInstance = new TreeMap<>();
|
||||
|
||||
private int totalSize;
|
||||
|
||||
private final BitState readingBitState = new BitState();
|
||||
|
@ -40,6 +42,11 @@ public class ConfigStructureImpl implements ConfigStructure {
|
|||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ConfigField> getCurrentInstance() {
|
||||
return currentInstance;
|
||||
}
|
||||
|
||||
public void addBitField(ConfigFieldImpl bitField) {
|
||||
addBoth(bitField);
|
||||
this.readingBitState.incrementBitIndex(bitField);
|
||||
|
@ -115,6 +122,7 @@ public class ConfigStructureImpl implements ConfigStructure {
|
|||
public void addTs(ConfigFieldImpl cf) {
|
||||
tsFields.add(cf);
|
||||
tsFieldsMap.put(cf.getName(), cf);
|
||||
currentInstance.put(cf.getTypeName(), cf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.opensr5.ini.IniFileModel;
|
|||
import com.rusefi.*;
|
||||
import com.rusefi.core.preferences.storage.Node;
|
||||
import com.rusefi.enums.engine_type_e;
|
||||
import com.rusefi.output.ConfigStructure;
|
||||
import com.rusefi.parse.TypesHelper;
|
||||
import com.rusefi.tune.xml.Constant;
|
||||
import com.rusefi.tune.xml.Msq;
|
||||
|
@ -239,13 +240,11 @@ public class TuneCanTool implements TuneCanToolConstants {
|
|||
} else if (cf.getParentStructureType().getName().equals("persistent_config_s")) {
|
||||
parentReference = "config->";
|
||||
} else {
|
||||
// todo: for instance map.samplingAngle
|
||||
//throw new IllegalStateException("Unexpected " + cf.getParent());
|
||||
log.info("Unable to locate parent: " + cf + " / parent=" + cf.getParentStructureType());
|
||||
continue;
|
||||
// todo: unit test?
|
||||
String path = getPath(cf.getParentStructureType());
|
||||
parentReference = "engineConfiguration->" + path + ".";
|
||||
}
|
||||
|
||||
|
||||
if (cf.getArraySizes().length == 2) {
|
||||
TableData tableData = TableData.readTable(customTuneFileName, fieldName, ini);
|
||||
if (tableData == null) {
|
||||
|
@ -336,6 +335,11 @@ public class TuneCanTool implements TuneCanToolConstants {
|
|||
return sb;
|
||||
}
|
||||
|
||||
private static String getPath(ConfigStructure parentType) {
|
||||
String parentTypeName = parentType.getName();
|
||||
return parentType.getParent().getCurrentInstance().get(parentTypeName).getName();
|
||||
}
|
||||
|
||||
private final static Set<String> HARDWARE_PROPERTIES = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
static {
|
||||
|
|
Loading…
Reference in New Issue