refactoring
This commit is contained in:
parent
254e31bc4c
commit
0907470d7f
|
@ -7,7 +7,7 @@ package com.rusefi;
|
||||||
public class BitState {
|
public class BitState {
|
||||||
private int bitIndex;
|
private int bitIndex;
|
||||||
|
|
||||||
public void incrementBitIndex(ConfigFieldImpl cf, ConfigFieldImpl next) {
|
public void incrementBitIndex(ConfigField cf, ConfigField next) {
|
||||||
if (!cf.isBit()) {
|
if (!cf.isBit()) {
|
||||||
bitIndex = 0;
|
bitIndex = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -15,7 +15,7 @@ public class BitState {
|
||||||
incrementBitIndex(cf);
|
incrementBitIndex(cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementBitIndex(ConfigFieldImpl cf) {
|
public void incrementBitIndex(ConfigField cf) {
|
||||||
if (bitIndex == 32)
|
if (bitIndex == 32)
|
||||||
throw new TooManyBitsInARow("Too many bits in a row: " + cf.getName());
|
throw new TooManyBitsInARow("Too many bits in a row: " + cf.getName());
|
||||||
bitIndex++;
|
bitIndex++;
|
||||||
|
|
|
@ -8,6 +8,8 @@ public interface ConfigField {
|
||||||
|
|
||||||
boolean isArray();
|
boolean isArray();
|
||||||
|
|
||||||
|
String getArraySizeVariableName();
|
||||||
|
|
||||||
String getTrueName();
|
String getTrueName();
|
||||||
|
|
||||||
String getFalseName();
|
String getFalseName();
|
||||||
|
@ -53,4 +55,12 @@ public interface ConfigField {
|
||||||
double getMax();
|
double getMax();
|
||||||
|
|
||||||
int getDigits();
|
int getDigits();
|
||||||
|
|
||||||
|
String getIterateOriginalName();
|
||||||
|
|
||||||
|
int getIterateIndex();
|
||||||
|
|
||||||
|
boolean isFromIterate();
|
||||||
|
|
||||||
|
String getCommentTemplated();
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,11 @@ public class ConfigFieldImpl implements ConfigField {
|
||||||
return arraySizeVariableName != null || arraySizes.length != 0;
|
return arraySizeVariableName != null || arraySizes.length != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getArraySizeVariableName() {
|
||||||
|
return arraySizeVariableName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTrueName() {
|
public String getTrueName() {
|
||||||
return trueName;
|
return trueName;
|
||||||
|
@ -421,14 +426,17 @@ public class ConfigFieldImpl implements ConfigField {
|
||||||
this.isFromIterate = true;
|
this.isFromIterate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getIterateOriginalName() {
|
public String getIterateOriginalName() {
|
||||||
return iterateOriginalName;
|
return iterateOriginalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getIterateIndex() {
|
public int getIterateIndex() {
|
||||||
return iterateIndex;
|
return iterateIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFromIterate() {
|
public boolean isFromIterate() {
|
||||||
return isFromIterate;
|
return isFromIterate;
|
||||||
}
|
}
|
||||||
|
@ -443,6 +451,7 @@ public class ConfigFieldImpl implements ConfigField {
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getCommentTemplated() {
|
public String getCommentTemplated() {
|
||||||
return state.getVariableRegistry().applyVariables(getComment());
|
return state.getVariableRegistry().applyVariables(getComment());
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class BaseCHeaderConsumer implements ConfigurationConsumer {
|
||||||
private final StringBuilder content = new StringBuilder();
|
private final StringBuilder content = new StringBuilder();
|
||||||
|
|
||||||
private static String getHeaderText(FieldIteratorWithOffset iterator) {
|
private static String getHeaderText(FieldIteratorWithOffset iterator) {
|
||||||
ConfigFieldImpl configField = iterator.cf;
|
ConfigField configField = iterator.cf;
|
||||||
if (configField.isBit()) {
|
if (configField.isBit()) {
|
||||||
// unused bits are needed for proper struct memsize
|
// unused bits are needed for proper struct memsize
|
||||||
String comment = "\t/**" + EOL + packComment(configField.getComment(), "\t") + "\toffset " + iterator.currentOffset + " bit " + iterator.bitState.get() + " */" + EOL;
|
String comment = "\t/**" + EOL + packComment(configField.getComment(), "\t") + "\toffset " + iterator.currentOffset + " bit " + iterator.bitState.get() + " */" + EOL;
|
||||||
|
@ -34,7 +34,7 @@ public class BaseCHeaderConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
cEntry += ";" + EOL;
|
cEntry += ";" + EOL;
|
||||||
} else {
|
} else {
|
||||||
cEntry += "\t" + typeName + " " + configField.getName() + "[" + configField.arraySizeVariableName + "];" + EOL;
|
cEntry += "\t" + typeName + " " + configField.getName() + "[" + configField.getArraySizeVariableName() + "];" + EOL;
|
||||||
}
|
}
|
||||||
return cEntry;
|
return cEntry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigField;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ public interface ConfigStructure {
|
||||||
|
|
||||||
int getTotalSize();
|
int getTotalSize();
|
||||||
|
|
||||||
List<ConfigFieldImpl> getTsFields();
|
List<ConfigField> getTsFields();
|
||||||
|
|
||||||
List<ConfigFieldImpl> getcFields();
|
List<ConfigField> getcFields();
|
||||||
|
|
||||||
boolean isWithPrefix();
|
boolean isWithPrefix();
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ public class ConfigStructureImpl implements ConfigStructure {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String comment;
|
private final String comment;
|
||||||
private final boolean withPrefix;
|
private final boolean withPrefix;
|
||||||
private final List<ConfigFieldImpl> cFields = new ArrayList<>();
|
private final List<ConfigField> cFields = new ArrayList<>();
|
||||||
private final List<ConfigFieldImpl> tsFields = new ArrayList<>();
|
private final List<ConfigField> tsFields = new ArrayList<>();
|
||||||
|
|
||||||
private int totalSize;
|
private int totalSize;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class ConfigStructureImpl implements ConfigStructure {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ConfigFieldImpl> getTsFields() {
|
public List<ConfigField> getTsFields() {
|
||||||
return tsFields;
|
return tsFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class ConfigStructureImpl implements ConfigStructure {
|
||||||
* in C and TS
|
* in C and TS
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ConfigFieldImpl> getcFields() {
|
public List<ConfigField> getcFields() {
|
||||||
return cFields;
|
return cFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import com.rusefi.TypesHelper;
|
import com.rusefi.TypesHelper;
|
||||||
|
@ -52,7 +53,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String handle(ConfigFieldImpl configField, String prefix) {
|
private String handle(ConfigField configField, String prefix) {
|
||||||
if (configField.getName().contains(UNUSED))
|
if (configField.getName().contains(UNUSED))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
||||||
* More detailed technical explanation should be placed in consecutive lines
|
* More detailed technical explanation should be placed in consecutive lines
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getHumanGaugeName(String prefix, ConfigFieldImpl configField) {
|
public static String getHumanGaugeName(String prefix, ConfigField configField) {
|
||||||
String comment = configField.getCommentTemplated();
|
String comment = configField.getCommentTemplated();
|
||||||
comment = getFirstLine(comment);
|
comment = getFirstLine(comment);
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,13 @@ import java.util.List;
|
||||||
* @see PerFieldWithStructuresIterator is there a duplication?
|
* @see PerFieldWithStructuresIterator is there a duplication?
|
||||||
*/
|
*/
|
||||||
public class FieldIterator {
|
public class FieldIterator {
|
||||||
private final List<ConfigFieldImpl> fields;
|
private final List<ConfigField> fields;
|
||||||
BitState bitState = new BitState();
|
BitState bitState = new BitState();
|
||||||
private ConfigField prev = ConfigFieldImpl.VOID;
|
private ConfigField prev = ConfigFieldImpl.VOID;
|
||||||
ConfigFieldImpl next;
|
ConfigField next;
|
||||||
ConfigFieldImpl cf;
|
ConfigField cf;
|
||||||
|
|
||||||
public FieldIterator(List<ConfigFieldImpl> fields) {
|
public FieldIterator(List<ConfigField> fields) {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -7,7 +8,7 @@ import java.util.List;
|
||||||
public class FieldIteratorWithOffset extends FieldIterator {
|
public class FieldIteratorWithOffset extends FieldIterator {
|
||||||
public int currentOffset;
|
public int currentOffset;
|
||||||
|
|
||||||
public FieldIteratorWithOffset(List<ConfigFieldImpl> tsFields) {
|
public FieldIteratorWithOffset(List<ConfigField> tsFields) {
|
||||||
super(tsFields);
|
super(tsFields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ public abstract class FieldsStrategy {
|
||||||
return sensorTsPosition;
|
return sensorTsPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int writeFields(List<ConfigFieldImpl> tsFields, String prefix, int tsPosition) {
|
protected int writeFields(List<ConfigField> tsFields, String prefix, int tsPosition) {
|
||||||
FieldIterator iterator = new FieldIterator(tsFields);
|
FieldIterator iterator = new FieldIterator(tsFields);
|
||||||
for (int i = 0; i < tsFields.size(); i++) {
|
for (int i = 0; i < tsFields.size(); i++) {
|
||||||
iterator.start(i);
|
iterator.start(i);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -36,7 +37,7 @@ public class FragmentDialogConsumer implements ConfigurationConsumer {
|
||||||
FieldsStrategy fieldsStrategy = new FieldsStrategy() {
|
FieldsStrategy fieldsStrategy = new FieldsStrategy() {
|
||||||
@Override
|
@Override
|
||||||
int writeOneField(FieldIterator iterator, String prefix, int tsPosition) {
|
int writeOneField(FieldIterator iterator, String prefix, int tsPosition) {
|
||||||
ConfigFieldImpl configField = iterator.cf;
|
ConfigField configField = iterator.cf;
|
||||||
|
|
||||||
if (configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT))
|
if (configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ public class GaugeConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String handle(ConfigFieldImpl configField, String prefix) {
|
private String handle(ConfigField configField, String prefix) {
|
||||||
String comment = getHumanGaugeName("", configField);
|
String comment = getHumanGaugeName("", configField);
|
||||||
comment = ConfigFieldImpl.unquote(comment);
|
comment = ConfigFieldImpl.unquote(comment);
|
||||||
if (!prefix.isEmpty()) {
|
if (!prefix.isEmpty()) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import com.rusefi.TypesHelper;
|
import com.rusefi.TypesHelper;
|
||||||
|
@ -74,7 +75,7 @@ public class GetConfigValueConsumer implements ConfigurationConsumer {
|
||||||
writeStringToFile(mdOutputFileName, getMdContent());
|
writeStringToFile(mdOutputFileName, getMdContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String processConfig(ConfigFieldImpl cf, String prefix) {
|
private String processConfig(ConfigField cf, String prefix) {
|
||||||
if (cf.getName().contains(UNUSED) || cf.getName().contains(ALIGNMENT_FILL_AT))
|
if (cf.getName().contains(UNUSED) || cf.getName().contains(ALIGNMENT_FILL_AT))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import com.rusefi.TypesHelper;
|
import com.rusefi.TypesHelper;
|
||||||
|
@ -41,7 +42,7 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String processOutput(ConfigFieldImpl cf, String prefix) {
|
private String processOutput(ConfigField cf, String prefix) {
|
||||||
if (cf.getName().contains(UNUSED) || cf.getName().contains(ALIGNMENT_FILL_AT))
|
if (cf.getName().contains(UNUSED) || cf.getName().contains(ALIGNMENT_FILL_AT))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
|
|
||||||
|
@ -22,8 +23,8 @@ public class JavaSensorsConsumer implements ConfigurationConsumer {
|
||||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||||
FieldsStrategy fieldsStrategy = new FieldsStrategy() {
|
FieldsStrategy fieldsStrategy = new FieldsStrategy() {
|
||||||
public int writeOneField(FieldIterator iterator, String prefix, int tsPosition) {
|
public int writeOneField(FieldIterator iterator, String prefix, int tsPosition) {
|
||||||
ConfigFieldImpl configField = iterator.cf;
|
ConfigField configField = iterator.cf;
|
||||||
ConfigFieldImpl next = iterator.next;
|
ConfigField next = iterator.next;
|
||||||
|
|
||||||
if (!configField.isBit()) {
|
if (!configField.isBit()) {
|
||||||
sb.append(configField.getName()).append("(");
|
sb.append(configField.getName()).append("(");
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ class PerFieldWithStructuresIterator extends FieldIterator {
|
||||||
private final String prefixSeparator;
|
private final String prefixSeparator;
|
||||||
private final StringBuilder sb = new StringBuilder();
|
private final StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
public PerFieldWithStructuresIterator(ReaderState state, List<ConfigFieldImpl> fields, String prefix, Strategy strategy, String prefixSeparator) {
|
public PerFieldWithStructuresIterator(ReaderState state, List<ConfigField> fields, String prefix, Strategy strategy, String prefixSeparator) {
|
||||||
super(fields);
|
super(fields);
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
|
@ -24,7 +25,7 @@ class PerFieldWithStructuresIterator extends FieldIterator {
|
||||||
this.prefixSeparator = prefixSeparator;
|
this.prefixSeparator = prefixSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PerFieldWithStructuresIterator(ReaderState state, List<ConfigFieldImpl> fields, String prefix, Strategy strategy) {
|
public PerFieldWithStructuresIterator(ReaderState state, List<ConfigField> fields, String prefix, Strategy strategy) {
|
||||||
this(state, fields, prefix, strategy, "_");
|
this(state, fields, prefix, strategy, "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +56,6 @@ class PerFieldWithStructuresIterator extends FieldIterator {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Strategy {
|
interface Strategy {
|
||||||
String process(ReaderState state, ConfigFieldImpl configField, String prefix);
|
String process(ReaderState state, ConfigField configField, String prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ public class SdCardFieldsContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String processOutput(ConfigFieldImpl configField, String prefix) {
|
private String processOutput(ConfigField configField, String prefix) {
|
||||||
if (configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT))
|
if (configField.getName().startsWith(ConfigStructureImpl.ALIGNMENT_FILL_AT))
|
||||||
return "";
|
return "";
|
||||||
if (configField.getName().startsWith(ConfigStructureImpl.UNUSED_ANYTHING_PREFIX))
|
if (configField.getName().startsWith(ConfigStructureImpl.UNUSED_ANYTHING_PREFIX))
|
||||||
|
@ -38,7 +39,7 @@ public class SdCardFieldsContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLine(ConfigFieldImpl configField, String prefix, String name) {
|
private String getLine(ConfigField configField, String prefix, String name) {
|
||||||
return "\t{" + home + "." + name +
|
return "\t{" + home + "." + name +
|
||||||
", "
|
", "
|
||||||
+ DataLogConsumer.getHumanGaugeName(prefix, configField) +
|
+ DataLogConsumer.getHumanGaugeName(prefix, configField) +
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.rusefi.output;
|
package com.rusefi.output;
|
||||||
|
|
||||||
import com.opensr5.ini.field.IniField;
|
import com.opensr5.ini.field.IniField;
|
||||||
|
import com.rusefi.ConfigField;
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.ConfigFieldImpl;
|
||||||
import com.rusefi.ReaderState;
|
import com.rusefi.ReaderState;
|
||||||
import com.rusefi.TypesHelper;
|
import com.rusefi.TypesHelper;
|
||||||
|
@ -38,8 +39,8 @@ public class TsOutput {
|
||||||
FieldsStrategy strategy = new FieldsStrategy() {
|
FieldsStrategy strategy = new FieldsStrategy() {
|
||||||
@Override
|
@Override
|
||||||
public int writeOneField(FieldIterator it, String prefix, int tsPosition) {
|
public int writeOneField(FieldIterator it, String prefix, int tsPosition) {
|
||||||
ConfigFieldImpl configField = it.cf;
|
ConfigField configField = it.cf;
|
||||||
ConfigFieldImpl next = it.next;
|
ConfigField next = it.next;
|
||||||
int bitIndex = it.bitState.get();
|
int bitIndex = it.bitState.get();
|
||||||
String nameWithPrefix = prefix + configField.getName();
|
String nameWithPrefix = prefix + configField.getName();
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ public class TsOutput {
|
||||||
return sensorTsPosition;
|
return sensorTsPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String handleTsInfo(ConfigFieldImpl configField, String tsInfo, int multiplierIndex) {
|
private String handleTsInfo(ConfigField configField, String tsInfo, int multiplierIndex) {
|
||||||
if (tsInfo == null || tsInfo.trim().isEmpty()) {
|
if (tsInfo == null || tsInfo.trim().isEmpty()) {
|
||||||
// default units and scale
|
// default units and scale
|
||||||
if (isConstantsSection) {
|
if (isConstantsSection) {
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package com.rusefi.test;
|
package com.rusefi.test;
|
||||||
|
|
||||||
import com.rusefi.ConfigFieldImpl;
|
import com.rusefi.*;
|
||||||
import com.rusefi.ReaderStateImpl;
|
|
||||||
import com.rusefi.TypesHelper;
|
|
||||||
import com.rusefi.VariableRegistry;
|
|
||||||
import com.rusefi.output.*;
|
import com.rusefi.output.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -161,7 +158,7 @@ public class ConfigFieldParserTest {
|
||||||
assertEquals(16, TypesHelper.getElementSize(state, "pid_s"));
|
assertEquals(16, TypesHelper.getElementSize(state, "pid_s"));
|
||||||
|
|
||||||
ConfigStructure structure = state.getStructures().get("pid_s");
|
ConfigStructure structure = state.getStructures().get("pid_s");
|
||||||
ConfigFieldImpl firstField = structure.getcFields().get(0);
|
ConfigField firstField = structure.getcFields().get(0);
|
||||||
assertEquals("ms", firstField.getUnits());
|
assertEquals("ms", firstField.getUnits());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue