EPIC: Improve toolset for default tune canned tune generation #4871

This commit is contained in:
rusefillc 2024-02-25 00:05:23 -05:00
parent 8c016642a3
commit bc811f3d9d
5 changed files with 14 additions and 8 deletions

View File

@ -43,6 +43,7 @@ void setHyundaiPb() {
engineConfiguration->trigger.type = trigger_type_e::TT_TOOTHED_WHEEL_60_2;
engineConfiguration->globalTriggerAngleOffset = 90;
engineConfiguration->enableSoftwareKnock = true;
engineConfiguration->etbIdleThrottleRange = 6.0;
engineConfiguration->totalGearsCount = 5;

View File

@ -46,7 +46,7 @@ static void setDefaultHPFP() {
#endif
// todo: would be nice for unit tests to be happy about these defaults
#if EFI_PROD_CODE
#if EFI_PROD_CODE || EFI_SIMULATOR
engineConfiguration->hpfpPumpVolume = 0.290;
#endif
engineConfiguration->hpfpMinAngle = 10;

View File

@ -43,12 +43,12 @@ public class CurveData implements HoHo {
return null;
ArrayIniField field = (ArrayIniField) iniField;
int curveSize = field.getRows();
BufferedReader r = TS2C.readAndScroll(msqFileName, curveName + "\"", TS2C.fileFactory);
float[] curveValues = new float[curveSize];
try {
try (BufferedReader r = TS2C.readAndScroll(msqFileName, curveName + "\"", TS2C.fileFactory)) {
readAxle(curveValues, r);
} catch (NumberFormatException e) {
throw new IllegalStateException("While " + curveName, e);
// we read potentially old tune using current IniFileModel, curve dimension might not match
System.err.println("[NumberFormatException] while " + curveName);
}
return new CurveData(curveName, curveValues);

View File

@ -46,8 +46,12 @@ public class TableData implements HoHo {
table[rowIndex] = new float[columns];
}
BufferedReader reader = TS2C.readAndScroll(msqFileName, tableName, factory);
readTable(table, reader, rows, columns);
try (BufferedReader reader = TS2C.readAndScroll(msqFileName, tableName, factory)) {
readTable(table, reader, rows, columns);
} catch (IllegalStateException e) {
// we read potentially old tune using current IniFileModel, curve dimension might not match
System.err.println("[IllegalStateException] while " + tableName);
}
return new TableData(rows, columns, table, tableName);
}

View File

@ -125,9 +125,10 @@ public class TuneCanTool {
}
String fileName = REPORTS_OUTPUT_FOLDER + "/" + vehicleName + ".md";
log.info("Writing to " + fileName);
File outputFile = new File(fileName);
log.info("Writing to " + outputFile.getAbsolutePath());
try (FileWriter w = new FileWriter(fileName)) {
try (FileWriter w = new FileWriter(outputFile)) {
w.append("# " + vehicleName + "\n\n");
w.append("// canned tune " + cannedComment + "\n\n");