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

This commit is contained in:
rusefillc 2024-03-06 01:20:57 -05:00
parent f9a047c70b
commit 2fa73aebca
16 changed files with 33 additions and 41377 deletions

View File

@ -89,7 +89,7 @@ jobs:
echo "Status 2/3"
git status
git pull https://github.com/rusefi/rusefi master
git add 'simulator/generated/*xml'
git add 'simulator/generated/*msq'
git add 'simulator/generated/canned-tunes/*md'
echo "Status 3/3"
git status

1
.gitignore vendored
View File

@ -22,7 +22,6 @@ java_console_binary
err.txt
log.txt
*.rusefi_binary
*.msq
*.kicad_prl
.*-sentinel

View File

@ -917,11 +917,9 @@ end
}
void detectBoardType() {
#if HW_HELLEN
#if !EFI_UNIT_TEST
#if HW_HELLEN && EFI_PROD_CODE
detectHellenBoardType();
#endif /* EFI_UNIT_TEST */
#endif //HW_HELLEN
#endif //HW_HELLEN EFI_PROD_CODE
// todo: add board ID detection?
// see hellen128 which has/had alternative i2c board id?
}

View File

@ -1,3 +1,4 @@
current_configuration.msq
build_hw
logs/
rusefi_console_properties.xml

View File

@ -6,6 +6,7 @@ import com.opensr5.ini.IniFileModel;
import com.rusefi.*;
import com.rusefi.config.generated.Fields;
import com.rusefi.core.preferences.storage.Node;
import com.rusefi.enums.engine_type_e;
import com.rusefi.tune.xml.Constant;
import com.rusefi.tune.xml.Msq;
import org.jetbrains.annotations.NotNull;
@ -41,13 +42,13 @@ import static com.rusefi.tools.tune.WriteSimulatorConfiguration.INI_FILE_FOR_SIM
*/
public class TuneCanTool {
private static final Logging log = getLogging(TuneCanTool.class);
private static final String REPORTS_OUTPUT_FOLDER = "generated\\canned-tunes";
private static final String REPORTS_OUTPUT_FOLDER = "generated/canned-tunes";
public static final String SRC_TEST_RESOURCES = "src/test/resources/";
private static final String FOLDER = "generated";
public static final String SIMULATED_PREFIX = FOLDER + File.separator + "simulator_tune";
public static final String SIMULATED_SUFFIX = ".xml";
public static final String DEFAULT_TUNE = SIMULATED_PREFIX + SIMULATED_SUFFIX;
public static final String TUNE_FILE_SUFFIX = ".msq";
public static final String DEFAULT_TUNE = SIMULATED_PREFIX + TUNE_FILE_SUFFIX;
private static final String workingFolder = "downloaded_tunes";
private static IniFileModel ini;
@ -66,9 +67,9 @@ public class TuneCanTool {
// "C:\\stuff\\i\\canam-2022-short\\canam-progress-pnp-dec-29.msq", "comment");
processREOtune(1507, Fields.engine_type_e_HELLEN_154_HYUNDAI_COUPE_BK2, "COUPE-BK2");
processREOtune(1576, Fields.engine_type_e_HYUNDAI_PB, "PB");
processREOtune(1591, Fields.engine_type_e_BMW_M52, "M52");
processREOtune(1507, engine_type_e.HELLEN_154_HYUNDAI_COUPE_BK2, "COUPE-BK2");
processREOtune(1576, engine_type_e.HYUNDAI_PB, "PB");
processREOtune(1591, engine_type_e.BMW_M52, "M52");
// processREOtune(1490, Fields.engine_type_e_MRE_M111, "m111-alex");
// handle("Mitsubicha", 1258);
// handle("Scion-1NZ-FE", 1448);
@ -79,7 +80,7 @@ public class TuneCanTool {
/**
* @see WriteSimulatorConfiguration
*/
private static void processREOtune(int tuneId, int engineType, String key) throws JAXBException, IOException {
private static void processREOtune(int tuneId, engine_type_e engineType, String key) throws JAXBException, IOException {
// compare specific internet tune to total global default
handle(key + "-comparing-against-global-defaults", tuneId, TuneCanTool.DEFAULT_TUNE);
// compare same internet tune to default tune of specified engine type
@ -87,8 +88,8 @@ public class TuneCanTool {
}
@NotNull
private static String getDefaultTuneName(int engineType) {
return SIMULATED_PREFIX + "_" + engineType + SIMULATED_SUFFIX;
public static String getDefaultTuneName(engine_type_e engineType) {
return SIMULATED_PREFIX + "_" + engineType.name() + TUNE_FILE_SUFFIX;
}
private static void handle(String vehicleName, int tuneId, String defaultTuneFileName) throws JAXBException, IOException {

View File

@ -5,6 +5,7 @@ import com.opensr5.ConfigurationImage;
import com.opensr5.ini.IniFileModel;
import com.rusefi.binaryprotocol.MsqFactory;
import com.rusefi.config.generated.Fields;
import com.rusefi.enums.engine_type_e;
import com.rusefi.tune.xml.Msq;
import javax.xml.bind.JAXBException;
@ -29,17 +30,17 @@ public class WriteSimulatorConfiguration {
System.out.println("ROOT_FOLDER=" + ROOT_FOLDER);
try {
readBinaryWriteXmlTune(Fields.SIMULATOR_TUNE_BIN_FILE_NAME, TuneCanTool.DEFAULT_TUNE);
for (int type : new int[]{
for (engine_type_e type : new engine_type_e[]{
// [CannedTunes] see 'rusEfiFunctionalTest.cpp' which exports default tunes into binary files for us
Fields.engine_type_e_MRE_M111,
Fields.engine_type_e_BMW_M52,
Fields.engine_type_e_MAZDA_MIATA_NB2,
Fields.engine_type_e_HONDA_K,
Fields.engine_type_e_HELLEN_154_HYUNDAI_COUPE_BK1,
Fields.engine_type_e_HELLEN_154_HYUNDAI_COUPE_BK2,
Fields.engine_type_e_HYUNDAI_PB,
Fields.engine_type_e_MAVERICK_X3,
Fields.engine_type_e_HARLEY,
engine_type_e.MRE_M111,
engine_type_e.BMW_M52,
engine_type_e.MAZDA_MIATA_NB2,
engine_type_e.HONDA_K,
engine_type_e.HELLEN_154_HYUNDAI_COUPE_BK1,
engine_type_e.HELLEN_154_HYUNDAI_COUPE_BK2,
engine_type_e.HYUNDAI_PB,
engine_type_e.MAVERICK_X3,
engine_type_e.HARLEY,
}) {
writeSpecificEngineType(type);
}
@ -53,19 +54,19 @@ public class WriteSimulatorConfiguration {
}
}
private static void writeSpecificEngineType(int engineType) {
String engine = "_" + engineType;
private static void writeSpecificEngineType(engine_type_e engineType) {
try {
readBinaryWriteXmlTune(Fields.SIMULATOR_TUNE_BIN_FILE_NAME_PREFIX + engine + Fields.SIMULATOR_TUNE_BIN_FILE_NAME_SUFFIX,
TuneCanTool.SIMULATED_PREFIX + engine + TuneCanTool.SIMULATED_SUFFIX);
String in = Fields.SIMULATOR_TUNE_BIN_FILE_NAME_PREFIX + "_" + engineType.ordinal() + Fields.SIMULATOR_TUNE_BIN_FILE_NAME_SUFFIX;
readBinaryWriteXmlTune(in,
TuneCanTool.getDefaultTuneName(engineType));
} catch (Throwable e) {
throw new IllegalStateException("With " + engineType, e);
}
}
private static void readBinaryWriteXmlTune(String tuneBinFileName, String outputXmlFileName) throws JAXBException, IOException {
byte[] fileContent = Files.readAllBytes(new File(ROOT_FOLDER + tuneBinFileName).toPath());
System.out.println("Got " + fileContent.length + " from " + tuneBinFileName + " while expecting " + Fields.TOTAL_CONFIG_SIZE);
private static void readBinaryWriteXmlTune(String inputBinaryTuneFileName, String outputXmlFileName) throws JAXBException, IOException {
byte[] fileContent = Files.readAllBytes(new File(ROOT_FOLDER + inputBinaryTuneFileName).toPath());
System.out.println("Got " + fileContent.length + " from " + inputBinaryTuneFileName + " while expecting " + Fields.TOTAL_CONFIG_SIZE);
if (fileContent.length != Fields.TOTAL_CONFIG_SIZE)
throw new IllegalStateException("Unexpected image size " + fileContent.length + " while expecting " + Fields.TOTAL_CONFIG_SIZE);
ConfigurationImage configuration = new ConfigurationImage(fileContent);

View File

@ -1,2 +1,3 @@
flash*.bin
rusefi_tool.log
downloaded_tunes

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff