something is broken somewhere :(

This commit is contained in:
rusefi 2020-06-14 18:01:23 -04:00
parent 9a6dc8d101
commit a7aea821b7
5 changed files with 30 additions and 15 deletions

View File

@ -4,7 +4,8 @@ rem This batch files reads rusefi_enums.h and produses auto_generated_enums.* fi
cd ../../../.. cd ../../../..
java -jar ../java_tools/enum2string.jar ^ java -DSystemOut.name=gen_enum_to_string_kinetis ^
-jar ../java_tools/enum2string.jar ^
-inputPath . ^ -inputPath . ^
-outputPath config/boards/kinetis/config/controllers/algo ^ -outputPath config/boards/kinetis/config/controllers/algo ^
-enumInputFile controllers/algo/rusefi_enums.h ^ -enumInputFile controllers/algo/rusefi_enums.h ^

View File

@ -28,6 +28,13 @@ public class SystemOut {
String fileName = System.getProperty("SystemOut.name", "rusefi_tool") + LOG; String fileName = System.getProperty("SystemOut.name", "rusefi_tool") + LOG;
System.out.println("Opening " + fileName); System.out.println("Opening " + fileName);
logFile = new PrintWriter(new FileWriter(fileName, true)); logFile = new PrintWriter(new FileWriter(fileName, true));
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
close();
System.out.println("SystemOut Hook done!");
}
}));
} }
@SuppressWarnings("ThrowablePrintedToSystemOut") @SuppressWarnings("ThrowablePrintedToSystemOut")
@ -45,8 +52,10 @@ public class SystemOut {
println(object == null ? "(null)" : object.toString()); println(object == null ? "(null)" : object.toString());
} }
public static void close() { public synchronized static void close() {
if (logFile != null) {
logFile.close(); logFile.close();
}
logFile = null; logFile = null;
} }
} }

View File

@ -4,6 +4,7 @@
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/configuration_definition.iml" filepath="$PROJECT_DIR$/configuration_definition.iml" /> <module fileurl="file://$PROJECT_DIR$/configuration_definition.iml" filepath="$PROJECT_DIR$/configuration_definition.iml" />
<module fileurl="file://$PROJECT_DIR$/../enum_to_string/enum_to_string.iml" filepath="$PROJECT_DIR$/../enum_to_string/enum_to_string.iml" /> <module fileurl="file://$PROJECT_DIR$/../enum_to_string/enum_to_string.iml" filepath="$PROJECT_DIR$/../enum_to_string/enum_to_string.iml" />
<module fileurl="file://$PROJECT_DIR$/../../java_console/logging/logging.iml" filepath="$PROJECT_DIR$/../../java_console/logging/logging.iml" />
</modules> </modules>
</component> </component>
</project> </project>

View File

@ -14,8 +14,9 @@
debug="true" debug="true"
target="${javac.target}" target="${javac.target}"
destdir="build/classes" destdir="build/classes"
classpath="lib/junit.jar:lib/annotations.jar:lib/snakeyaml.jar"> classpath="lib/junit.jar:../../java_console/lib/annotations.jar:lib/snakeyaml.jar">
<src path="src"/> <src path="src"/>
<src path="../../java_console/logging/src"/>
<src path="../enum_to_string/src"/> <src path="../enum_to_string/src"/>
</javac> </javac>

View File

@ -25,7 +25,6 @@ public class BoardReader {
); );
return; return;
} }
String boardName = null; String boardName = null;
String firmwarePath = "firmware"; String firmwarePath = "firmware";
String outputPath = "."; String outputPath = ".";
@ -44,11 +43,13 @@ public class BoardReader {
} }
Yaml yaml = new Yaml(); Yaml yaml = new Yaml();
Map<String, Object> data = yaml.load(new FileReader(firmwarePath + "/config/boards/" + boardName + "/mapping.yaml")); String fileName = firmwarePath + "/config/boards/" + boardName + "/mapping.yaml";
Objects.requireNonNull(data, "mapping for " + boardName); Map<String, Object> data = yaml.load(new FileReader(fileName));
if (data == null) {
SystemOut.println("Null yaml for " + fileName);
} else {
SystemOut.println(data); SystemOut.println(data);
BufferedWriter bw = new BufferedWriter(new FileWriter(outputPath + File.separator + boardName + "_prefix.txt")); BufferedWriter bw = new BufferedWriter(new FileWriter(outputPath + File.separator + boardName + "_prefix.txt"));
bw.write(processSection(data, "brain_pin_e", "output_pin_e", "outputs", "GPIO_UNASSIGNED")); bw.write(processSection(data, "brain_pin_e", "output_pin_e", "outputs", "GPIO_UNASSIGNED"));
@ -59,6 +60,8 @@ public class BoardReader {
bw.close(); bw.close();
} }
SystemOut.close();
}
private static String processSection(Map<String, Object> data, String headerEnumName, String outputEnumName, String sectionName, String NOTHING_NAME) { private static String processSection(Map<String, Object> data, String headerEnumName, String outputEnumName, String sectionName, String NOTHING_NAME) {
Objects.requireNonNull(data, "data"); Objects.requireNonNull(data, "data");