command line switch to DFU

This commit is contained in:
rusefi 2020-05-08 21:11:11 -04:00
parent f78889c1b3
commit b504b170d0
2 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,8 @@
rem
rem auto-detects connected running rusEfi serial port and send text 'reboot' command
rem flashes DFU
rem
java -jar ../java_console_binary/rusefi_console.jar reboot_dfu
sleep 10
..\misc\install\DfuSe\DfuSeCommand.exe -c -d --fn deliver/rusefi.dfu

View File

@ -229,7 +229,11 @@ public class Launcher {
FileLog.MAIN.start();
if (TOOL_NAME_REBOOT_ECU.equalsIgnoreCase(toolName)) {
invokeRebootTool();
sendCommand(Fields.CMD_REBOOT);
return;
}
if (Fields.CMD_REBOOT_DFU.equalsIgnoreCase(toolName)) {
sendCommand(Fields.CMD_REBOOT_DFU);
return;
}
@ -252,7 +256,7 @@ public class Launcher {
return CompileTool.run(Arrays.asList(args).subList(1, args.length));
}
private static void invokeRebootTool() throws IOException {
private static void sendCommand(String command) throws IOException {
String autoDetectedPort = PortDetector.autoDetectPort(null);
if (autoDetectedPort == null) {
System.err.println("rusEfi not detected");
@ -262,7 +266,7 @@ public class Launcher {
if (!establishConnection.isConnected())
return;
IoStream stream = establishConnection.getStream();
byte[] commandBytes = BinaryProtocol.getTextCommandBytes(Fields.CMD_REBOOT);
byte[] commandBytes = BinaryProtocol.getTextCommandBytes(command);
stream.sendPacket(commandBytes, FileLog.LOGGER);
}