only:Improve toolset for default tune canned tune generation #4871
This commit is contained in:
parent
edc390bf29
commit
8af7144649
|
@ -9,7 +9,9 @@ import com.rusefi.tune.xml.Constant;
|
|||
import com.rusefi.tune.xml.Msq;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
@ -24,31 +26,42 @@ public class TuneCanTool {
|
|||
private static final String FOLDER = "generated";
|
||||
public static final String DEFAULT_TUNE = FOLDER + File.separator + "simulator_tune.xml";
|
||||
|
||||
private static Msq simulatorDefaultTune;
|
||||
private static IniFileModel ini;
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
IniFileModel ini = new IniFileModel().readIniFile(INI_FILE_FOR_SIMULATOR);
|
||||
simulatorDefaultTune = Msq.readTune(TuneCanTool.DEFAULT_TUNE);
|
||||
ini = new IniFileModel().readIniFile(INI_FILE_FOR_SIMULATOR);
|
||||
if (ini == null)
|
||||
throw new IllegalStateException("Not found " + INI_FILE_FOR_SIMULATOR);
|
||||
Msq simulatorDefaultTune = Msq.readTune(TuneCanTool.DEFAULT_TUNE);
|
||||
|
||||
RootHolder.ROOT = "../firmware/";
|
||||
|
||||
handle("Mitsubicha", 1258);
|
||||
handle("Scion 1NZ-FE", 1448);
|
||||
handle("4g93", 1425);
|
||||
handle("BMW-mtmotorsport", 1479);
|
||||
}
|
||||
|
||||
// 3A92 "La Mitsubicha"
|
||||
// String fileName = "C:\\Users\\Dell2019\\Downloads\\1258.msq";
|
||||
// Scion 1NZ-FE "xB Chinita auto"
|
||||
// String fileName = "C:\\Users\\Dell2019\\Downloads\\1448.msq";
|
||||
// 4g93
|
||||
//String fileName = "C:\\Users\\Dell2019\\Downloads\\1425.msq";
|
||||
// mtmotorsport BMW https://rusefi.com/online/view.php?msq=1479
|
||||
String fileName = "C:\\Users\\Dell2019\\Downloads\\1479.msq";
|
||||
private static void handle(String vehicleName, int tuneId) throws JAXBException, IOException {
|
||||
String fileName = "C:\\Users\\Dell2019\\Downloads\\" + tuneId + ".msq";
|
||||
String url = "https://rusefi.com/online/view.php?msq=" + tuneId;
|
||||
|
||||
String reportsFolder = "tune_reports";
|
||||
new File(reportsFolder).mkdir();
|
||||
|
||||
Msq custom = Msq.readTune(fileName);
|
||||
StringBuilder sb = TuneCanTool.getTunePatch(simulatorDefaultTune, custom, ini);
|
||||
|
||||
StringBuilder sb = TuneCanTool.getTunePatch2(simulatorDefaultTune, custom, ini);
|
||||
|
||||
System.out.println(sb);
|
||||
FileWriter w = new FileWriter(reportsFolder + "/" + vehicleName + ".md");
|
||||
w.append("# " + vehicleName + "\n");
|
||||
w.append("Tune " + url + "\n\n");
|
||||
|
||||
w.append("```\n");
|
||||
w.append(sb);
|
||||
w.append("```\n");
|
||||
w.close();
|
||||
}
|
||||
|
||||
private static boolean isHardwareEnum(String type) {
|
||||
|
@ -59,6 +72,7 @@ public class TuneCanTool {
|
|||
case "Gpio":
|
||||
case "spi_device_e":
|
||||
case "pin_input_mode_e":
|
||||
case "pin_output_mode_e":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -71,7 +85,7 @@ public class TuneCanTool {
|
|||
}
|
||||
|
||||
@NotNull
|
||||
public static StringBuilder getTunePatch2(Msq defaultTune, Msq customTune, IniFileModel ini) throws IOException {
|
||||
public static StringBuilder getTunePatch(Msq defaultTune, Msq customTune, IniFileModel ini) throws IOException {
|
||||
List<String> options = Files.readAllLines(Paths.get(RootHolder.ROOT + "../" + ConfigDefinition.CONFIG_PATH));
|
||||
String[] totalArgs = options.toArray(new String[0]);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TuneTools {
|
|||
|
||||
@NotNull
|
||||
public static String getAssignmentCode(Constant defaultValue, String name, String value) {
|
||||
return //"\t // default " + defaultValue.getValue() + "\n" +
|
||||
return "\t // default " + defaultValue.getValue() + "\n" +
|
||||
"\tengineConfiguration->" + name + " = " + value + ";\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,39 +26,74 @@ public class LoadOlderTuneTest {
|
|||
|
||||
RootHolder.ROOT = "../../firmware/";
|
||||
|
||||
StringBuilder sb = TuneCanTool.getTunePatch2(lessOldDefaultTune, customOldTune, ini);
|
||||
StringBuilder sb = TuneCanTool.getTunePatch(lessOldDefaultTune, customOldTune, ini);
|
||||
|
||||
assertEquals("\tengineConfiguration->ignitionMode = IM_ONE_COIL;\n" +
|
||||
assertEquals("\t // default \"Single Coil\"\n" +
|
||||
"\tengineConfiguration->ignitionMode = IM_ONE_COIL;\n" +
|
||||
"\t // default 4.0\n" +
|
||||
"\tengineConfiguration->cylindersCount = 4;\n" +
|
||||
"\t // default 1000.0\n" +
|
||||
"\tengineConfiguration->tps1SecondaryMin = 0.0;\n" +
|
||||
"\t // default 0.0\n" +
|
||||
"\tengineConfiguration->tps1SecondaryMax = 1000.0;\n" +
|
||||
"\t // default 1000.0\n" +
|
||||
"\tengineConfiguration->tps2SecondaryMin = 0.0;\n" +
|
||||
"\t // default 0.0\n" +
|
||||
"\tengineConfiguration->tps2SecondaryMax = 1000.0;\n" +
|
||||
"\t // default 5.0\n" +
|
||||
"\tengineConfiguration->throttlePedalSecondaryUpVoltage = 0.0;\n" +
|
||||
"\t // default 65.0\n" +
|
||||
"\tengineConfiguration->mc33_hvolt = 0.0;\n" +
|
||||
"\t // default 13000.0\n" +
|
||||
"\tengineConfiguration->mc33_i_boost = 0.0;\n" +
|
||||
"\t // default 9400.0\n" +
|
||||
"\tengineConfiguration->mc33_i_peak = 0.0;\n" +
|
||||
"\t // default 3700.0\n" +
|
||||
"\tengineConfiguration->mc33_i_hold = 0.0;\n" +
|
||||
"\t // default 400.0\n" +
|
||||
"\tengineConfiguration->mc33_t_max_boost = 0.0;\n" +
|
||||
"\t // default 10.0\n" +
|
||||
"\tengineConfiguration->mc33_t_peak_off = 0.0;\n" +
|
||||
"\t // default 700.0\n" +
|
||||
"\tengineConfiguration->mc33_t_peak_tot = 0.0;\n" +
|
||||
"\t // default 10.0\n" +
|
||||
"\tengineConfiguration->mc33_t_bypass = 0.0;\n" +
|
||||
"\t // default 60.0\n" +
|
||||
"\tengineConfiguration->mc33_t_hold_off = 0.0;\n" +
|
||||
"\t // default 10000.0\n" +
|
||||
"\tengineConfiguration->mc33_t_hold_tot = 0.0;\n" +
|
||||
"\t // default \"PULLUP\"\n" +
|
||||
"\tengineConfiguration->clutchDownPinMode = 1.0;\n" +
|
||||
"\t // default \"PULLUP\"\n" +
|
||||
"\tengineConfiguration->clutchUpPinMode = 1.0;\n" +
|
||||
"\t // default 410.0\n" +
|
||||
"\tengineConfiguration->mapErrorDetectionTooHigh = 250.0;\n" +
|
||||
"\t // default 3.0\n" +
|
||||
"\tengineConfiguration->idleStepperReactionTime = 10.0;\n" +
|
||||
"\t // default 200.0\n" +
|
||||
"\tengineConfiguration->idleStepperTotalSteps = 150.0;\n" +
|
||||
"\t // default \"true\"\n" +
|
||||
"\tengineConfiguration->stepperForceParkingEveryRestart = false;\n" +
|
||||
"\t // default -20.0\n" +
|
||||
"\tengineConfiguration->idlerpmpid_iTermMin = -200.0;\n" +
|
||||
"\t // default 20.0\n" +
|
||||
"\tengineConfiguration->idlerpmpid_iTermMax = 200.0;\n" +
|
||||
"\t // default 300.0\n" +
|
||||
"\tengineConfiguration->idlePidRpmUpperLimit = 0.0;\n" +
|
||||
"\t // default 5.0\n" +
|
||||
"\tengineConfiguration->idlePidDeactivationTpsThreshold = 2.0;\n" +
|
||||
"\t // default 0.0\n" +
|
||||
"\tengineConfiguration->warningPeriod = 10.0;\n" +
|
||||
"\t // default \"false\"\n" +
|
||||
"\tengineConfiguration->isHip9011Enabled = true;\n" +
|
||||
"\tengineConfiguration->hip9011IntHoldPinMode = OM_OPENDRAIN;\n" +
|
||||
"\tengineConfiguration->hip9011CsPinMode = ", sb.substring(0, 1500));
|
||||
"\t // default 0.0\n" +
|
||||
"\tengineConfiguration->hip9011PrescalerAndSDO = 6.0;\n" +
|
||||
"\t // default 20.0\n" +
|
||||
"\tengineConfiguration->knockDetectionWindowStart = 35.0;\n" +
|
||||
"\t // default 60.0\n" +
|
||||
"\tengineConfiguration->knockDetectionWindowEnd = 135.0;\n" +
|
||||
"\t // default \"false\"\n" +
|
||||
"\tengine", sb.substring(0, 2200));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
|
|
Loading…
Reference in New Issue