diff --git a/firmware/config/boards/hellen/uaefi121/compile_firmware.sh b/firmware/config/boards/hellen/uaefi121/compile_firmware.sh index 634105dee6..ea78abc427 100755 --- a/firmware/config/boards/hellen/uaefi121/compile_firmware.sh +++ b/firmware/config/boards/hellen/uaefi121/compile_firmware.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -cd ../../../.. && bash bin/compile.sh config/boards/hellen/uaefi/meta-info.env +cd ../../../.. && bash bin/compile.sh config/boards/hellen/uaefi121/meta-info.env diff --git a/firmware/config/boards/hellen/uaefi121/connectors/uaefi121.yaml b/firmware/config/boards/hellen/uaefi121/connectors/uaefi121.yaml index 64709b3a17..cfc0949ca8 100644 --- a/firmware/config/boards/hellen/uaefi121/connectors/uaefi121.yaml +++ b/firmware/config/boards/hellen/uaefi121/connectors/uaefi121.yaml @@ -268,7 +268,7 @@ pins: - pin: 43a class: outputs - mega: MM100_LED2_GREEN + meta: MM100_LED2_GREEN ts_name: ___ High Side Output function: High-side high current output @@ -500,14 +500,14 @@ pins: - pin: 86a ts_name: ___ LS5_HOT - mega: MM100_IGN7 + meta: MM100_IGN7 class: outputs function: Low-Side 5 always hot / relay capable output type: ls - pin: 87a ts_name: ___ LS6_HOT - mega: MM100_IGN8 + meta: MM100_IGN8 class: outputs function: Low-Side 6 always hot / relay capable output type: ls diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java b/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java index 390987af57..7cace05e99 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/pinout/PinoutLogic.java @@ -22,6 +22,13 @@ public class PinoutLogic { private static final String NONE = "NONE"; private static final String QUOTED_NONE = quote(NONE); + private static final String ID = "id"; + private static final String META = "meta"; + private static final String CLASS = "class"; + private static final String PIN = "pin"; + private static final String TS_NAME = "ts_name"; + private static final String FUNCTION = "function"; + private static final String TYPE = "type"; private final ArrayList globalList = new ArrayList<>(); private final Map tsNameById = new TreeMap<>(); @@ -146,8 +153,9 @@ public class PinoutLogic { log.info("Got from " + yamlFile + ": " + data); Objects.requireNonNull(data, "data"); for (Map pin : data) { - Object pinId = pin.get("id"); - Object metaAsObject = pin.get("meta"); + validateKeys(pin.keySet()); + Object pinId = pin.get(ID); + Object metaAsObject = pin.get(META); if (metaAsObject != null && !(metaAsObject instanceof String)) throw new IllegalStateException("[" + metaAsObject + "] meta could only be a string for " + pinId); String meta = (String) metaAsObject; @@ -166,15 +174,15 @@ public class PinoutLogic { } else { headerValue = (pinId instanceof String) ? (String) pinId : null; } - Object pinClass = pin.get("class"); - Object pinName = pin.get("pin"); - Object pinTsName = pin.get("ts_name"); - Object pinFunction = pin.get("function"); + Object pinClass = pin.get(CLASS); + Object pinName = pin.get(PIN); + Object pinTsName = pin.get(TS_NAME); + Object pinFunction = pin.get(FUNCTION); if (pinTsName == null && pinFunction != null) pinTsName = pinFunction; - Object pinType = pin.get("type"); + Object pinType = pin.get(TYPE); if (pinId == null || pinClass == null || pinTsName == null) { - log.info("Skipping incomplete section " + pinId + "/" + pinClass + "/" + pinTsName); + log.info("Skipping incomplete section pinId=" + pinId + "/pinClass=" + pinClass + "/pinTsName=" + pinTsName); continue; } if (pinName != null) { @@ -213,6 +221,14 @@ public class PinoutLogic { } } + private static void validateKeys(Set key) { + Set copy = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); + copy.addAll(key); + copy.removeAll(Arrays.asList(ID, CLASS, META, FUNCTION, TS_NAME, PIN, TYPE, "color")); + if (!copy.isEmpty()) + throw new IllegalStateException("Unexpected key(s): " + copy); + } + private static String applyMetaMapping(Map metaMapping, String id) { return metaMapping.getOrDefault(id, id); }