mirror of https://github.com/rusefi/rusefi-1.git
all tools into help
This commit is contained in:
parent
17dfcf4c62
commit
bbec7cd794
|
@ -55,20 +55,20 @@ public class Launcher {
|
||||||
protected static final String PORT_KEY = "port";
|
protected static final String PORT_KEY = "port";
|
||||||
protected static final String SPEED_KEY = "speed";
|
protected static final String SPEED_KEY = "speed";
|
||||||
|
|
||||||
private static final String TOOL_NAME_COMPILE_FSIO_FILE = "compile_fsio_file";
|
|
||||||
private static final String TOOL_NAME_REBOOT_ECU = "reboot_ecu";
|
|
||||||
private static final String TOOL_NAME_FIRING_ORDER = "firing_order";
|
|
||||||
private static final String TOOL_NAME_FUNCTIONAL_TEST = "functional_test";
|
|
||||||
private static final String TOOL_NAME_PERF_ENUMS = "ptrace_enums";
|
|
||||||
// todo: rename to something more FSIO-specific? would need to update documentation somewhere
|
|
||||||
private static final String TOOL_NAME_COMPILE = "compile";
|
|
||||||
private static final int DEFAULT_TAB_INDEX = 0;
|
private static final int DEFAULT_TAB_INDEX = 0;
|
||||||
|
|
||||||
private static Map<String, ConsoleTool> TOOLS = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
private static Map<String, ConsoleTool> TOOLS = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
TOOLS.put("help", args -> printToolsAndExit());
|
TOOLS.put("help", args -> printTools());
|
||||||
TOOLS.put("headless", args -> runHeadless());
|
TOOLS.put("headless", args -> runHeadless());
|
||||||
|
TOOLS.put("compile", args -> invokeCompileExpressionTool(args));
|
||||||
|
TOOLS.put("ptrace_enums", args -> runPerfTraceTool(args));
|
||||||
|
TOOLS.put("functional_test", args -> runFunctionalTest(args));
|
||||||
|
TOOLS.put("compile_fsio_file", args -> runCompileTool(args));
|
||||||
|
TOOLS.put("firing_order", args -> runFiringOrderTool(args));
|
||||||
|
TOOLS.put("reboot_ecu", args -> sendCommand(Fields.CMD_REBOOT));
|
||||||
|
TOOLS.put(Fields.CMD_REBOOT_DFU, args -> sendCommand(Fields.CMD_REBOOT_DFU));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String port;
|
public static String port;
|
||||||
|
@ -203,58 +203,20 @@ public class Launcher {
|
||||||
public static void main(final String[] args) throws Exception {
|
public static void main(final String[] args) throws Exception {
|
||||||
String toolName = args.length == 0 ? null : args[0];
|
String toolName = args.length == 0 ? null : args[0];
|
||||||
|
|
||||||
|
if (args.length > 0) {
|
||||||
ConsoleTool consoleTool = TOOLS.get(toolName);
|
ConsoleTool consoleTool = TOOLS.get(toolName);
|
||||||
if (consoleTool != null) {
|
if (consoleTool != null) {
|
||||||
consoleTool.runTool(args);
|
consoleTool.runTool(args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TOOL_NAME_FUNCTIONAL_TEST.equals(toolName)) {
|
|
||||||
// passing port argument if it was specified
|
|
||||||
String[] toolArgs = args.length == 1 ? new String[0] : new String[]{args[1]};
|
|
||||||
RealHwTest.main(toolArgs);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TOOL_NAME_COMPILE_FSIO_FILE.equalsIgnoreCase(toolName)) {
|
|
||||||
int returnCode = invokeCompileFileTool(args);
|
|
||||||
System.exit(returnCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TOOL_NAME_COMPILE.equals(toolName)) {
|
|
||||||
invokeCompileExpressionTool(args);
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TOOL_NAME_FIRING_ORDER.equals(toolName)) {
|
|
||||||
FiringOrderTSLogic.invoke(args[1]);
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TOOL_NAME_PERF_ENUMS.equals(toolName)) {
|
|
||||||
PerfTraceTool.readPerfTrace(args[1], args[2], args[3], args[4]);
|
|
||||||
System.exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printTools();
|
printTools();
|
||||||
|
|
||||||
System.out.println("Optional tools: " + Arrays.asList(TOOL_NAME_COMPILE_FSIO_FILE,
|
|
||||||
TOOL_NAME_COMPILE,
|
|
||||||
TOOL_NAME_REBOOT_ECU,
|
|
||||||
TOOL_NAME_FIRING_ORDER));
|
|
||||||
System.out.println("Starting rusEfi UI console " + CONSOLE_VERSION);
|
System.out.println("Starting rusEfi UI console " + CONSOLE_VERSION);
|
||||||
|
|
||||||
FileLog.MAIN.start();
|
FileLog.MAIN.start();
|
||||||
|
|
||||||
if (TOOL_NAME_REBOOT_ECU.equalsIgnoreCase(toolName)) {
|
|
||||||
sendCommand(Fields.CMD_REBOOT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Fields.CMD_REBOOT_DFU.equalsIgnoreCase(toolName)) {
|
|
||||||
sendCommand(Fields.CMD_REBOOT_DFU);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
getConfig().load();
|
getConfig().load();
|
||||||
FileLog.suspendLogging = getConfig().getRoot().getBoolProperty(GaugesPanel.DISABLE_LOGS);
|
FileLog.suspendLogging = getConfig().getRoot().getBoolProperty(GaugesPanel.DISABLE_LOGS);
|
||||||
|
@ -267,6 +229,25 @@ public class Launcher {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void runPerfTraceTool(String[] args) throws IOException {
|
||||||
|
PerfTraceTool.readPerfTrace(args[1], args[2], args[3], args[4]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void runFiringOrderTool(String[] args) throws IOException {
|
||||||
|
FiringOrderTSLogic.invoke(args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void runCompileTool(String[] args) throws IOException {
|
||||||
|
int returnCode = invokeCompileFileTool(args);
|
||||||
|
System.exit(returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void runFunctionalTest(String[] args) throws InterruptedException {
|
||||||
|
// passing port argument if it was specified
|
||||||
|
String[] toolArgs = args.length == 1 ? new String[0] : new String[]{args[1]};
|
||||||
|
RealHwTest.main(toolArgs);
|
||||||
|
}
|
||||||
|
|
||||||
private static void runHeadless() {
|
private static void runHeadless() {
|
||||||
String autoDetectedPort = PortDetector.autoDetectSerial();
|
String autoDetectedPort = PortDetector.autoDetectSerial();
|
||||||
if (autoDetectedPort == null) {
|
if (autoDetectedPort == null) {
|
||||||
|
@ -382,11 +363,6 @@ public class Launcher {
|
||||||
return staticFrame;
|
return staticFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void printToolsAndExit() {
|
|
||||||
printTools();
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void printTools() {
|
private static void printTools() {
|
||||||
for (String key : TOOLS.keySet()) {
|
for (String key : TOOLS.keySet()) {
|
||||||
System.out.println("Tool available: " + key);
|
System.out.println("Tool available: " + key);
|
||||||
|
@ -394,6 +370,6 @@ public class Launcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ConsoleTool {
|
interface ConsoleTool {
|
||||||
void runTool(String args[]);
|
void runTool(String args[]) throws Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue