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