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

This commit is contained in:
Andrey 2023-11-25 20:41:00 -05:00
parent 44db3b9297
commit b7584611b1
3 changed files with 40 additions and 12 deletions

View File

@ -26,9 +26,15 @@ public class WriteSimulatorConfiguration {
System.out.printf("ROOT_FOLDER=" + ROOT_FOLDER);
try {
writeTune(Fields.SIMULATOR_TUNE_BIN_FILE_NAME, TuneCanTool.DEFAULT_TUNE);
String engine = "_" + 95;
writeTune(Fields.SIMULATOR_TUNE_BIN_FILE_NAME_PREFIX + engine + Fields.SIMULATOR_TUNE_BIN_FILE_NAME_SUFFIX,
TuneCanTool.SIMULATED_PREFIX + engine + TuneCanTool.SIMULATED_SUFFIX);
for (int type : new int[]{
Fields.engine_type_e_MRE_M111,
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,
}) {
writeSpecificEngineType(type);
}
} catch (Throwable e) {
log.error("Unfortunately", e);
System.exit(-1);
@ -38,6 +44,12 @@ public class WriteSimulatorConfiguration {
}
}
private static void writeSpecificEngineType(int engineType) throws JAXBException, IOException {
String engine = "_" + engineType;
writeTune(Fields.SIMULATOR_TUNE_BIN_FILE_NAME_PREFIX + engine + Fields.SIMULATOR_TUNE_BIN_FILE_NAME_SUFFIX,
TuneCanTool.SIMULATED_PREFIX + engine + TuneCanTool.SIMULATED_SUFFIX);
}
private static void writeTune(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);

View File

@ -55,6 +55,8 @@ endif
# Pretend we are all different hardware so that all canned engine configs are included
USE_OPT += -DHW_HELLEN_HYUNDAI=1
USE_OPT += -DHW_PROTEUS=1
USE_OPT += -DHW_MICRO_RUSEFI=1
# See explanation in main firmware Makefile for these three defines
USE_OPT += $(SIMULATOR_DEBUG_LEVEL_OPT) $(RUSEFI_OPT) -DEFI_UNIT_TEST=0 -DEFI_PROD_CODE=0 -DEFI_SIMULATOR=1

View File

@ -153,6 +153,18 @@ static void runNotSquareTest() {
assertNear(getscriptTable(3)->getValue(3000, 20), 144.384);
}
static void writeEngineTypeDefaultConfig(engine_type_e type) {
engineConfiguration->engineType = type;
resetConfigurationExt(engineConfiguration->engineType);
char fileName[3000];
sprintf(fileName, "%s_%d%s",
SIMULATOR_TUNE_BIN_FILE_NAME_PREFIX,
(int)engineConfiguration->engineType,
SIMULATOR_TUNE_BIN_FILE_NAME_SUFFIX
);
writeSimulatorTune(fileName);
}
void rusEfiFunctionalTest(void) {
printToConsole("Running rusEFI simulator version:");
static char versionBuffer[20];
@ -169,15 +181,17 @@ void rusEfiFunctionalTest(void) {
// todo: reduce code duplication with initRealHardwareEngineController
initFlash();
engineConfiguration->engineType = engine_type_e::HELLEN_154_HYUNDAI_COUPE_BK2;
resetConfigurationExt(engineConfiguration->engineType);
char fileName[3000];
sprintf(fileName, "%s_%d%s",
SIMULATOR_TUNE_BIN_FILE_NAME_PREFIX,
(int)engineConfiguration->engineType,
SIMULATOR_TUNE_BIN_FILE_NAME_SUFFIX
);
writeSimulatorTune(fileName);
for (auto const type : {
engine_type_e::HELLEN_154_HYUNDAI_COUPE_BK1,
engine_type_e::HELLEN_154_HYUNDAI_COUPE_BK2,
engine_type_e::MRE_M111,
engine_type_e::HYUNDAI_PB,
engine_type_e::HONDA_K,
} ) {
writeEngineTypeDefaultConfig(type);
}
// this here is really 'reset to default configuration'
loadConfiguration();