time to use DFU
This commit is contained in:
parent
5a38fc99a8
commit
608b9e6f0b
|
@ -0,0 +1 @@
|
|||
java -jar console/rusefi_console.jar dfu $1
|
|
@ -72,7 +72,8 @@ public class ConsoleTools {
|
|||
|
||||
registerTool("version", ConsoleTools::version, "Only print version");
|
||||
|
||||
registerTool("lightui", ConsoleTools::lightUI, "Start lightweight GUI for tiny screens");
|
||||
registerTool("lightui", strings -> lightUI(), "Start lightweight GUI for tiny screens");
|
||||
registerTool("dfu", DfuTool::run, "Program specified file into ECU via DFU");
|
||||
|
||||
|
||||
registerTool("detect", ConsoleTools::detect, "Find attached rusEFI");
|
||||
|
@ -115,7 +116,7 @@ public class ConsoleTools {
|
|||
System.out.println("tune_CRC16=" + crc16);
|
||||
}
|
||||
|
||||
private static void lightUI(String[] strings) {
|
||||
private static void lightUI() {
|
||||
LightweightGUI.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.rusefi.tools;
|
||||
|
||||
import com.rusefi.dfu.BinaryImage;
|
||||
import com.rusefi.dfu.DfuImage;
|
||||
import com.rusefi.dfu.DfuLogic;
|
||||
import com.rusefi.dfu.HexImage;
|
||||
import com.rusefi.dfu.usb4java.DfuDeviceLocator;
|
||||
import com.rusefi.dfu.usb4java.USBDfuConnection;
|
||||
import cz.jaybee.intelhex.IntelHexException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DfuTool {
|
||||
public static void run(String[] args) throws IOException, IntelHexException {
|
||||
if (args.length < 2) {
|
||||
System.err.println(".dfu or .hex filename parameter expected");
|
||||
return;
|
||||
}
|
||||
String fileName = args[1];
|
||||
|
||||
DfuLogic.Logger logger = DfuLogic.Logger.CONSOLE;
|
||||
USBDfuConnection device = DfuDeviceLocator.findDevice(logger);
|
||||
if (device == null) {
|
||||
System.err.println("No DFU devices found");
|
||||
return;
|
||||
}
|
||||
|
||||
BinaryImage image = fileName.toLowerCase().trim().endsWith(".dfu") ? new DfuImage().read(fileName) : HexImage.loadHexToBuffer(fileName, device.getFlashRange());
|
||||
|
||||
DfuLogic.uploadImage(logger, device, image, device.getFlashRange());
|
||||
|
||||
logger.info("DfuSe DFU " + device);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue