parent
0e70da4ef0
commit
c577f50079
|
@ -256,9 +256,9 @@ typedef enum __attribute__ ((__packed__)) {
|
||||||
EFI_ADC_NONE = 16,
|
EFI_ADC_NONE = 16,
|
||||||
EFI_ADC_ERROR = 17,
|
EFI_ADC_ERROR = 17,
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
TEST_MAF_CHANNEL = 113,
|
TEST_MAF_CHANNEL = 18,
|
||||||
TEST_CLT_CHANNEL = 114,
|
TEST_CLT_CHANNEL = 19,
|
||||||
TEST_IAT_CHANNEL = 115,
|
TEST_IAT_CHANNEL = 20,
|
||||||
#endif
|
#endif
|
||||||
} adc_channel_e;
|
} adc_channel_e;
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,5 @@
|
||||||
package com.rusefi.board_generator;
|
package com.rusefi.board_generator;
|
||||||
|
|
||||||
import com.rusefi.EnumToString;
|
|
||||||
import com.rusefi.EnumsReader;
|
import com.rusefi.EnumsReader;
|
||||||
import com.rusefi.enum_reader.Value;
|
import com.rusefi.enum_reader.Value;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
@ -59,19 +58,21 @@ public class BoardReader {
|
||||||
private static String processSection(Map<String, Object> data, String headerEnumName, String oututEnumName, String sectionName, String NOTHING_NAME) {
|
private static String processSection(Map<String, Object> data, String headerEnumName, String oututEnumName, String sectionName, String NOTHING_NAME) {
|
||||||
Map<String, Object> outputs = (Map<String, Object>) data.get(sectionName);
|
Map<String, Object> outputs = (Map<String, Object>) data.get(sectionName);
|
||||||
|
|
||||||
Map<String, Value> s = EnumsReader.enums.get(headerEnumName);
|
Map<String, Value> enumMap = EnumsReader.enums.get(headerEnumName);
|
||||||
Objects.requireNonNull(s, "enum for " + headerEnumName);
|
Objects.requireNonNull(enumMap, "enum for " + headerEnumName);
|
||||||
System.out.println(s.size());
|
System.out.println(enumMap.size());
|
||||||
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
for (int i = 0; i < 255; i++) {
|
int maxValue = getMaxValue(enumMap.values());
|
||||||
|
|
||||||
|
for (int i = 0; i < maxValue; i++) {
|
||||||
if (sb.length() > 0)
|
if (sb.length() > 0)
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
|
|
||||||
String code;
|
String code;
|
||||||
|
|
||||||
Value v = findByOrdinal(i, s.values());
|
Value v = findByOrdinal(i, enumMap.values());
|
||||||
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
code = INVALID;
|
code = INVALID;
|
||||||
|
@ -88,6 +89,13 @@ public class BoardReader {
|
||||||
return " #define " + oututEnumName + "_enum " + sb + "\r\n";
|
return " #define " + oututEnumName + "_enum " + sb + "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int getMaxValue(Collection<Value> values) {
|
||||||
|
int result = -1;
|
||||||
|
for (Value v : values)
|
||||||
|
result = Math.max(result, v.getIntValue());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private static Value findByOrdinal(int ordinal, Collection<Value> values) {
|
private static Value findByOrdinal(int ordinal, Collection<Value> values) {
|
||||||
for (Value v : values)
|
for (Value v : values)
|
||||||
if (v.getValue().equals(String.valueOf(ordinal)))
|
if (v.getValue().equals(String.valueOf(ordinal)))
|
||||||
|
|
|
@ -17,6 +17,10 @@ public class Value implements Comparable<Value> {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getIntValue() {
|
||||||
|
return Integer.parseInt(value);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Value o) {
|
public int compareTo(Value o) {
|
||||||
return name.compareTo(o.name);
|
return name.compareTo(o.name);
|
||||||
|
|
Loading…
Reference in New Issue