something is broken somewhere :(

This commit is contained in:
rusefi 2020-06-14 18:01:23 -04:00
parent 015832e116
commit a0593844c7
4 changed files with 28 additions and 14 deletions

View File

@ -28,6 +28,13 @@ public class SystemOut {
String fileName = System.getProperty("SystemOut.name", "rusefi_tool") + LOG;
System.out.println("Opening " + fileName);
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")
@ -45,8 +52,10 @@ public class SystemOut {
println(object == null ? "(null)" : object.toString());
}
public static void close() {
logFile.close();
public synchronized static void close() {
if (logFile != null) {
logFile.close();
}
logFile = null;
}
}

View File

@ -4,6 +4,7 @@
<modules>
<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$/../../java_console/logging/logging.iml" filepath="$PROJECT_DIR$/../../java_console/logging/logging.iml" />
</modules>
</component>
</project>

View File

@ -14,8 +14,9 @@
debug="true"
target="${javac.target}"
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="../../java_console/logging/src"/>
<src path="../enum_to_string/src"/>
</javac>

View File

@ -25,7 +25,6 @@ public class BoardReader {
);
return;
}
String boardName = null;
String firmwarePath = "firmware";
String outputPath = ".";
@ -44,20 +43,24 @@ public class BoardReader {
}
Yaml yaml = new Yaml();
Map<String, Object> data = yaml.load(new FileReader(firmwarePath + "/config/boards/" + boardName + "/mapping.yaml"));
Objects.requireNonNull(data, "mapping for " + boardName);
SystemOut.println(data);
String fileName = firmwarePath + "/config/boards/" + boardName + "/mapping.yaml";
Map<String, Object> data = yaml.load(new FileReader(fileName));
if (data == null) {
SystemOut.println("Null yaml for " + fileName);
} else {
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, "adc_channel_e", "adc_channel_e", "analog_inputs", "EFI_ADC_NONE"));
bw.write(processSection(data, "brain_pin_e", "output_pin_e", "outputs", "GPIO_UNASSIGNED"));
bw.write(processSection(data, "adc_channel_e", "adc_channel_e", "analog_inputs", "EFI_ADC_NONE"));
bw.write(processSection(data, "brain_pin_e", "brain_input_pin_e", "event_inputs", "GPIO_UNASSIGNED"));
bw.write(processSection(data, "brain_pin_e", "switch_input_pin_e", "switch_inputs", "GPIO_UNASSIGNED"));
bw.write(processSection(data, "brain_pin_e", "brain_input_pin_e", "event_inputs", "GPIO_UNASSIGNED"));
bw.write(processSection(data, "brain_pin_e", "switch_input_pin_e", "switch_inputs", "GPIO_UNASSIGNED"));
bw.close();
bw.close();
}
SystemOut.close();
}
private static String processSection(Map<String, Object> data, String headerEnumName, String outputEnumName, String sectionName, String NOTHING_NAME) {