From b504b170d0990d7369a082ef9cb0f27bc506f816 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 8 May 2020 21:11:11 -0400 Subject: [PATCH] command line switch to DFU --- firmware/flash_reboot_dfu.bat | 8 ++++++++ java_console/ui/src/com/rusefi/Launcher.java | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 firmware/flash_reboot_dfu.bat diff --git a/firmware/flash_reboot_dfu.bat b/firmware/flash_reboot_dfu.bat new file mode 100644 index 0000000000..c4602a28b9 --- /dev/null +++ b/firmware/flash_reboot_dfu.bat @@ -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 \ No newline at end of file diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index 44bbd95350..8e155513b4 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -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); }