mirror of https://github.com/rusefi/rusefi.git
only:Improve toolset for default tune canned tune generation #4871
This commit is contained in:
parent
54cb3f823f
commit
ae18056e18
|
@ -115,7 +115,7 @@ public class IoUtil {
|
|||
FileLog.MAIN.logLine("Got first signal in " + (System.currentTimeMillis() - waitStart));
|
||||
}
|
||||
|
||||
static void connectToSimulator(LinkManager linkManager, boolean startProcess) throws InterruptedException {
|
||||
public static void connectToSimulator(LinkManager linkManager, boolean startProcess) throws InterruptedException {
|
||||
if (startProcess) {
|
||||
if (!TcpConnector.getAvailablePorts().isEmpty())
|
||||
throw new IllegalStateException("Port already binded on startup?");
|
||||
|
|
|
@ -15,7 +15,7 @@ public class SimulatorExecHelper {
|
|||
|
||||
// see also SimulatorHelper
|
||||
private static final String SIMULATOR_BINARY = "../simulator/build/rusefi_simulator.exe";
|
||||
static Process simulatorProcess;
|
||||
private static Process simulatorProcess;
|
||||
|
||||
/**
|
||||
* This is currently used by auto-tests only. Todo: reuse same code for UI-launched simulator?
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.rusefi.tools;
|
||||
|
||||
import com.opensr5.ConfigurationImage;
|
||||
import com.opensr5.ini.IniFileModel;
|
||||
import com.rusefi.IoUtil;
|
||||
import com.rusefi.binaryprotocol.MsqFactory;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.tune.xml.Msq;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WriteSimulatorConfiguration {
|
||||
// f407-discovery is historically the most inclusive .ini file
|
||||
private static String INI_FILE_FOR_SIMULATOR = "../firmware/tunerstudio/generated/rusefi_f407-discovery.ini";
|
||||
|
||||
public static void main(String[] args) throws IOException, InterruptedException, JAXBException {
|
||||
// SimulatorExecHelper
|
||||
LinkManager linkManager = new LinkManager();
|
||||
IoUtil.connectToSimulator(linkManager, false);
|
||||
ConfigurationImage configuration = linkManager.getBinaryProtocol().getControllerConfiguration();
|
||||
System.out.println("Got " + 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);
|
||||
m.writeXmlFile("simulator_tune.xml");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue