only:Improve toolset for default tune canned tune generation #4871
This commit is contained in:
parent
43ae2856a1
commit
d0bb16d42f
|
@ -50,30 +50,30 @@ jobs:
|
||||||
working-directory: ./simulator/
|
working-directory: ./simulator/
|
||||||
run: ./build/rusefi_simulator 10
|
run: ./build/rusefi_simulator 10
|
||||||
|
|
||||||
# - name: Load Default Tune from Linux Simulator
|
- name: Load Default Tune from Linux Simulator
|
||||||
# working-directory: ./simulator/
|
working-directory: ./simulator/
|
||||||
# run: ./write_tune.sh
|
run: ./write_tune.sh
|
||||||
#
|
|
||||||
# - name: Commit fresh generated default simulator tune
|
- name: Commit fresh generated default simulator tune
|
||||||
# env:
|
env:
|
||||||
# ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||||||
# run: |
|
run: |
|
||||||
# git config --local user.email "action@github.com"
|
git config --local user.email "action@github.com"
|
||||||
# git config --local user.name "GitHub gen-default-tune Action"
|
git config --local user.name "GitHub gen-default-tune Action"
|
||||||
# git add simulator/generated
|
git add 'simulator/generated/*xml'
|
||||||
# git status
|
git status
|
||||||
# OUT=$(git commit -am "Auto-generated default tune" 2>&1) || echo "commit failed, finding out why"
|
OUT=$(git commit -am "Auto-generated default tune" 2>&1) || echo "commit failed, finding out why"
|
||||||
# if echo "$OUT" | grep 'nothing to commit'; then
|
if echo "$OUT" | grep 'nothing to commit'; then
|
||||||
# echo "default tune: looks like nothing to commit"
|
echo "default tune: looks like nothing to commit"
|
||||||
# echo "::set-env name=NOCOMMIT::true"
|
echo "::set-env name=NOCOMMIT::true"
|
||||||
# exit 0
|
exit 0
|
||||||
# elif echo "$OUT" | grep 'changed'; then
|
elif echo "$OUT" | grep 'changed'; then
|
||||||
# echo "default tune: looks like something has changed"
|
echo "default tune: looks like something has changed"
|
||||||
# exit 0
|
exit 0
|
||||||
# else
|
else
|
||||||
# echo "default tune: looks like something unexpected"
|
echo "default tune: looks like something unexpected"
|
||||||
# exit 1
|
exit 1
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
- name: Upload Linux built simulator
|
- name: Upload Linux built simulator
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|
|
@ -2132,6 +2132,8 @@ end_struct
|
||||||
#define PROTOCOL_COIL1_SHORT_NAME "c1"
|
#define PROTOCOL_COIL1_SHORT_NAME "c1"
|
||||||
#define PROTOCOL_INJ1_SHORT_NAME "i1"
|
#define PROTOCOL_INJ1_SHORT_NAME "i1"
|
||||||
|
|
||||||
|
#define SIMULATOR_TUNE_BIN_FILE_NAME "generated/simulator_tune_image.bin"
|
||||||
|
|
||||||
! some board files override this value using prepend file
|
! some board files override this value using prepend file
|
||||||
#define ts_show_hip9011 false
|
#define ts_show_hip9011 false
|
||||||
#define ts_show_tps_sent false
|
#define ts_show_tps_sent false
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class SimulatorExecHelper {
|
||||||
BufferedReader err =
|
BufferedReader err =
|
||||||
new BufferedReader(new InputStreamReader(process.getErrorStream()));
|
new BufferedReader(new InputStreamReader(process.getErrorStream()));
|
||||||
try {
|
try {
|
||||||
String prefix = "from console: ";
|
String prefix = "ERROR from console: ";
|
||||||
Consumer<String> PRINT_AND_LOG = string -> {
|
Consumer<String> PRINT_AND_LOG = string -> {
|
||||||
System.out.println(prefix + string);
|
System.out.println(prefix + string);
|
||||||
FileLog.SIMULATOR_CONSOLE.logLine(string);
|
FileLog.SIMULATOR_CONSOLE.logLine(string);
|
||||||
|
|
|
@ -2,15 +2,14 @@ package com.rusefi.tools;
|
||||||
|
|
||||||
import com.opensr5.ConfigurationImage;
|
import com.opensr5.ConfigurationImage;
|
||||||
import com.opensr5.ini.IniFileModel;
|
import com.opensr5.ini.IniFileModel;
|
||||||
import com.rusefi.IoUtil;
|
|
||||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
|
||||||
import com.rusefi.binaryprotocol.MsqFactory;
|
import com.rusefi.binaryprotocol.MsqFactory;
|
||||||
import com.rusefi.io.LinkManager;
|
import com.rusefi.config.generated.Fields;
|
||||||
import com.rusefi.tune.xml.Msq;
|
import com.rusefi.tune.xml.Msq;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class WriteSimulatorConfiguration {
|
public class WriteSimulatorConfiguration {
|
||||||
|
@ -27,17 +26,18 @@ public class WriteSimulatorConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeTune() throws InterruptedException, JAXBException, IOException {
|
private static void writeTune() throws JAXBException, IOException {
|
||||||
LinkManager linkManager = new LinkManager();
|
String s = "generated/simulator_tune_image.bin";
|
||||||
IoUtil.connectToSimulator(linkManager, true);
|
byte[] fileContent = Files.readAllBytes(new File(s).toPath());
|
||||||
BinaryProtocol bp = Objects.requireNonNull(linkManager.getBinaryProtocol(), "getBinaryProtocol");
|
System.out.println("Got " + fileContent.length + " from " + s + " while expecting " + Fields.TOTAL_CONFIG_SIZE);
|
||||||
ConfigurationImage configuration = bp.getControllerConfiguration();
|
if (fileContent.length != Fields.TOTAL_CONFIG_SIZE)
|
||||||
|
throw new IllegalStateException("Unexpected image size " + fileContent.length);
|
||||||
|
ConfigurationImage configuration = new ConfigurationImage(fileContent);
|
||||||
System.out.println("Got " + Objects.requireNonNull(configuration, "configuration"));
|
System.out.println("Got " + Objects.requireNonNull(configuration, "configuration"));
|
||||||
IniFileModel ini = new IniFileModel().readIniFile(INI_FILE_FOR_SIMULATOR);
|
IniFileModel ini = new IniFileModel().readIniFile(INI_FILE_FOR_SIMULATOR);
|
||||||
if (ini == null)
|
if (ini == null)
|
||||||
throw new IllegalStateException("Not found " + INI_FILE_FOR_SIMULATOR);
|
throw new IllegalStateException("Not found " + INI_FILE_FOR_SIMULATOR);
|
||||||
Msq m = MsqFactory.valueOf(configuration, ini);
|
Msq m = MsqFactory.valueOf(configuration, ini);
|
||||||
new File(FOLDER).mkdirs();
|
|
||||||
m.writeXmlFile(FOLDER + File.separator + "simulator_tune.xml");
|
m.writeXmlFile(FOLDER + File.separator + "simulator_tune.xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,12 @@ static void runChprintfTest() {
|
||||||
static void runCanGpioTest() {
|
static void runCanGpioTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void writeSimulatorTune() {
|
||||||
|
FILE *ptr = fopen("generated/simulator_tune_image.bin", "wb");
|
||||||
|
fwrite(&persistentState.persistentConfiguration, 1, sizeof(persistentState.persistentConfiguration), ptr);
|
||||||
|
fclose(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
void rusEfiFunctionalTest(void) {
|
void rusEfiFunctionalTest(void) {
|
||||||
printToConsole("Running rusEFI simulator version:");
|
printToConsole("Running rusEFI simulator version:");
|
||||||
static char versionBuffer[20];
|
static char versionBuffer[20];
|
||||||
|
@ -112,6 +118,8 @@ void rusEfiFunctionalTest(void) {
|
||||||
|
|
||||||
initStatusLoop();
|
initStatusLoop();
|
||||||
|
|
||||||
|
writeSimulatorTune();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* !!!! TESTS !
|
* !!!! TESTS !
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue