only:smarter default tunes output folder
This commit is contained in:
parent
6820539e2a
commit
a27285b4f6
|
@ -60,7 +60,10 @@ jobs:
|
|||
|
||||
- name: Convert .bin from Linux Simulator into .xml
|
||||
working-directory: ./simulator/
|
||||
run: ./write_tune.sh ../firmware/tunerstudio/generated/rusefi_f407-discovery.ini
|
||||
run: |
|
||||
export DEFAULT_TUNE_OUTPUT_FOLDER=../simulator/generated/
|
||||
echo "DEFAULT_TUNE_OUTPUT_FOLDER=$DEFAULT_TUNE_OUTPUT_FOLDER"
|
||||
./write_tune.sh ../firmware/tunerstudio/generated/rusefi_f407-discovery.ini
|
||||
|
||||
- name: Commit fresh generated default simulator tune
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master'}}
|
||||
|
|
|
@ -122,6 +122,7 @@ runs:
|
|||
: Echo
|
||||
echo "rusefi_dir=${{inputs.rusefi_dir}}"
|
||||
echo "meta_info=${{inputs.meta_info}}"
|
||||
echo "sim_output=${{inputs.sim_output}}"
|
||||
|
||||
- name: Checkout Submodules
|
||||
working-directory: ${{inputs.rusefi_dir}}
|
||||
|
@ -163,7 +164,7 @@ runs:
|
|||
shopt -s expand_aliases
|
||||
if which grealpath >/dev/null 2>&1; then alias realpath='grealpath'; fi
|
||||
echo "META_OUTPUT_ROOT_FOLDER=$(realpath --relative-to=${{inputs.rusefi_dir}}/firmware ${{inputs.meta_output}})/" >> $GITHUB_ENV
|
||||
echo "SIM_OUTPUT_ROOT_FOLDER=$(realpath --relative-to=${{inputs.rusefi_dir}}/firmware ${{inputs.sim_output}})/" >> $GITHUB_ENV
|
||||
echo "DEFAULT_TUNE_OUTPUT_FOLDER=$(realpath --relative-to=${{inputs.rusefi_dir}}/firmware ${{inputs.sim_output}})/" >> $GITHUB_ENV
|
||||
source ${{inputs.rusefi_dir}}/firmware/config/boards/common_script_read_meta_env.inc "${{inputs.meta_info}}"
|
||||
cd ${{inputs.rusefi_dir}}/firmware
|
||||
ABSOLUTE_BOARD_DIR=${{github.workspace}}/$BOARD_DIR
|
||||
|
@ -339,16 +340,8 @@ runs:
|
|||
: Run Simulator
|
||||
cd ${{inputs.rusefi_dir}}/simulator/
|
||||
./build/rusefi_simulator 10
|
||||
mkdir -p ${{inputs.sim_output}}canned-tunes
|
||||
./write_tune.sh ${ABSOLUTE_BOARD_DIR}/generated/tunerstudio/generated/rusefi_${SHORT_BOARD_NAME}.ini
|
||||
cd $OLDPWD
|
||||
echo "action.yaml: Current directory: $PWD"
|
||||
if [ ! "${{inputs.sim_output}}" -ef "${{inputs.rusefi_dir}}/simulator/generated" ]; then
|
||||
ls ${{inputs.rusefi_dir}}/simulator/generated/
|
||||
mkdir -p ${{inputs.sim_output}}canned-tunes
|
||||
cp -v ${{inputs.rusefi_dir}}/simulator/generated/*.msq ${{inputs.sim_output}}
|
||||
cp -v ${{inputs.rusefi_dir}}/simulator/generated/canned-tunes/*.md ${{inputs.sim_output}}canned-tunes
|
||||
ls ${{inputs.sim_output}}
|
||||
fi
|
||||
|
||||
- name: Add Tune to Commit
|
||||
if: ${{ inputs.run_simulator == 'true' && inputs.push == 'true' }}
|
||||
|
|
|
@ -44,19 +44,23 @@ import static com.rusefi.LocalIniFileProvider.INI_FILE_FOR_SIMULATOR;
|
|||
*/
|
||||
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 = "canned-tunes";
|
||||
|
||||
private static final String FOLDER = "generated";
|
||||
public static final String SIMULATED_PREFIX = FOLDER + File.separator + "simulator_tune";
|
||||
public static final String SIMULATED_PREFIX = "simulator_tune";
|
||||
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";
|
||||
public static final String MD_FIXED_FORMATTING = "```\n";
|
||||
// IDE and GHA run from different working folders :(
|
||||
public static final String YET_ANOTHER_ROOT = "../simulator/";
|
||||
// see write_tune.sh for env variable to property mapping
|
||||
static final String ENGINE_TUNE_OUTPUT_FOLDER = System.getProperty("ENGINE_TUNE_OUTPUT_FOLDER", "../simulator/generated/");
|
||||
|
||||
protected static IniFileModel ini;
|
||||
|
||||
static {
|
||||
log.info("ENGINE_TUNE_OUTPUT_FOLDER=" + ENGINE_TUNE_OUTPUT_FOLDER);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
//writeDiffBetweenLocalTuneFileAndDefaultTune("../1.msq");
|
||||
|
@ -87,14 +91,14 @@ public class TuneCanTool {
|
|||
protected static void processREOtune(int tuneId, engine_type_e engineType, String key,
|
||||
String methodNamePrefix) throws JAXBException, IOException {
|
||||
// compare specific internet tune to total global default
|
||||
handle(key + "-comparing-against-global-defaults", tuneId, YET_ANOTHER_ROOT + TuneCanTool.DEFAULT_TUNE, methodNamePrefix);
|
||||
handle(key + "-comparing-against-global-defaults", tuneId, ENGINE_TUNE_OUTPUT_FOLDER + TuneCanTool.DEFAULT_TUNE, methodNamePrefix);
|
||||
// compare same internet tune to default tune of specified engine type
|
||||
handle(key + "-comparing-against-current-" + key + "-default", tuneId, getDefaultTuneName(engineType), methodNamePrefix);
|
||||
handle(key + "-comparing-against-current-" + key + "-default", tuneId, getDefaultTuneOutputFileName(engineType), methodNamePrefix);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getDefaultTuneName(engine_type_e engineType) {
|
||||
return YET_ANOTHER_ROOT + SIMULATED_PREFIX + "_" + engineType.name() + TUNE_FILE_SUFFIX;
|
||||
public static String getDefaultTuneOutputFileName(engine_type_e engineType) {
|
||||
return ENGINE_TUNE_OUTPUT_FOLDER + SIMULATED_PREFIX + "_" + engineType.name() + TUNE_FILE_SUFFIX;
|
||||
}
|
||||
|
||||
private static void handle(String vehicleName, int tuneId, String defaultTuneFileName, String methodNamePrefix) throws JAXBException, IOException {
|
||||
|
@ -128,14 +132,14 @@ public class TuneCanTool {
|
|||
|
||||
StringBuilder sb = getTunePatch(defaultTune, customTune, ini, customTuneFileName, methods, defaultTuneFileName, methodNamePrefix);
|
||||
|
||||
String fileNameMethods = YET_ANOTHER_ROOT + REPORTS_OUTPUT_FOLDER + "/" + vehicleName + "_methods.md";
|
||||
String fileNameMethods = ENGINE_TUNE_OUTPUT_FOLDER + REPORTS_OUTPUT_FOLDER + "/" + vehicleName + "_methods.md";
|
||||
try (FileWriter methodsWriter = new FileWriter(fileNameMethods)) {
|
||||
methodsWriter.append(MD_FIXED_FORMATTING);
|
||||
methodsWriter.append(methods);
|
||||
methodsWriter.append(MD_FIXED_FORMATTING);
|
||||
}
|
||||
|
||||
String fileName = YET_ANOTHER_ROOT + REPORTS_OUTPUT_FOLDER + "/" + vehicleName + ".md";
|
||||
String fileName = ENGINE_TUNE_OUTPUT_FOLDER + REPORTS_OUTPUT_FOLDER + "/" + vehicleName + ".md";
|
||||
File outputFile = new File(fileName);
|
||||
log.info("Writing to " + outputFile.getAbsolutePath());
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.nio.file.Files;
|
|||
import java.util.Objects;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.tools.tune.TuneCanTool.ENGINE_TUNE_OUTPUT_FOLDER;
|
||||
|
||||
/**
|
||||
* see <a href="https://github.com/rusefi/rusefi/wiki/Canned-Tune-Process">...</a>
|
||||
|
@ -24,7 +25,7 @@ import static com.devexperts.logging.Logging.getLogging;
|
|||
public class WriteSimulatorConfiguration {
|
||||
private static final Logging log = getLogging(WriteSimulatorConfiguration.class);
|
||||
|
||||
public static String ROOT_FOLDER = System.getProperty("ROOT_FOLDER", "../simulator/");
|
||||
private static final String ROOT_FOLDER = System.getProperty("ROOT_FOLDER", "../simulator/");
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 1)
|
||||
|
@ -33,10 +34,10 @@ public class WriteSimulatorConfiguration {
|
|||
IniFileModelImpl ini = new IniFileModelImpl().readIniFile(iniFileName);
|
||||
BinaryProtocol.iniFileProvider = signature -> ini;
|
||||
|
||||
System.out.println("ROOT_FOLDER=" + ROOT_FOLDER);
|
||||
log.info("ROOT_FOLDER=" + ROOT_FOLDER);
|
||||
try {
|
||||
try {
|
||||
readBinaryWriteXmlTune(iniFileName, Fields.SIMULATOR_TUNE_BIN_FILE_NAME, TuneCanTool.DEFAULT_TUNE, ini);
|
||||
readBinaryWriteXmlTune(iniFileName, Fields.SIMULATOR_TUNE_BIN_FILE_NAME, ENGINE_TUNE_OUTPUT_FOLDER + TuneCanTool.DEFAULT_TUNE, ini);
|
||||
} catch (Throwable e) {
|
||||
throw new IllegalStateException("White default tune", e);
|
||||
}
|
||||
|
@ -57,7 +58,7 @@ public class WriteSimulatorConfiguration {
|
|||
try {
|
||||
String in = Fields.SIMULATOR_TUNE_BIN_FILE_NAME_PREFIX + "_" + engineType.ordinal() + Fields.SIMULATOR_TUNE_BIN_FILE_NAME_SUFFIX;
|
||||
readBinaryWriteXmlTune(iniFileName, in,
|
||||
TuneCanTool.getDefaultTuneName(engineType), ini);
|
||||
TuneCanTool.getDefaultTuneOutputFileName(engineType), ini);
|
||||
} catch (Throwable e) {
|
||||
throw new IllegalStateException("With " + engineType, e);
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ public class WriteSimulatorConfiguration {
|
|||
Constant noiseRpmBins = m.page.get(1).getConstantsAsMap().get(name);
|
||||
if (!noiseRpmBins.getValue().contains(Fields.DEFAULT_RPM_AXIS_HIGH_VALUE + ".0"))
|
||||
throw new IllegalStateException(name + " canary wonders if everything is fine?");
|
||||
m.writeXmlFile(ROOT_FOLDER + outputXmlFileName);
|
||||
m.writeXmlFile(outputXmlFileName);
|
||||
|
||||
Msq newTuneJustToValidate = Msq.readTune(ROOT_FOLDER + outputXmlFileName);
|
||||
log.info("Looks valid " + newTuneJustToValidate);
|
||||
|
|
|
@ -7,4 +7,4 @@ then
|
|||
echo ".ini file argument is expected"
|
||||
exit -1
|
||||
fi
|
||||
java -cp ../java_tools/tune-tools/build/libs/tune-tools-all.jar com.rusefi.tools.tune.WriteSimulatorConfiguration $1
|
||||
java -DENGINE_TUNE_OUTPUT_FOLDER=$DEFAULT_TUNE_OUTPUT_FOLDER -cp ../java_tools/tune-tools/build/libs/tune-tools-all.jar com.rusefi.tools.tune.WriteSimulatorConfiguration $1
|
||||
|
|
Loading…
Reference in New Issue